Packaging tools for shanty services.

Related tags

Miscellaneousparcel
Overview

parcel

Packaging tools for shanty services.

What?

Services are docker containers deployed by shanty on a hosting appliance. Each service consists of the main parts:

  • A docker image
  • A service definition (.yml file used by docker)
  • Metadata, a name, description, dependencies and author information
  • Configuration, variable declarations to be used in the service defition.

A service is packaged as a tarball, minimal tarball contents would be:

/
- manifest.json
- service.yml
/.signatures/
- manifest.json.sig
- service.yml.sig

manifest.json contains metadata about the service, service.yml contains the docker service definitions. Variable substitution is performed on service.yml before it is deployed. Variables can be sourced from manifest.json or can include values from the hosting appliance settings. an example manifest.json might look like:

{
  "name": "example",
  "author": "[email protected]",
  "version": "0.9.8",
  "image": "shantysocial/echo",
  "image_tag": "12934324",
  "service_definition": "service.yml",
  "variables": {
  },
  "settings": [
    "SHANTY_OAUTH_TOKEN"
  ],
  "options": {
    "OPTION_A_ENABLED": {
      "type": "boolean",
      "description": "Toggles option A",
      "default": true
    }
  },
  "files": [
    "foo_config.cfg"
  ]
}

NOTE: The author email address is significant in that it defines the PGP key used to sign and verify the parcel file.

Settings are pulled from the shanty appliance global configuration. Options are obtained from the user at installation time. Options are private to the service while settings are global.

The corresponding service.yml file might look like this:

version: "3"

services:
  example:
    image: this_value_is_ignored_and_can_be_omitted
    environment:
      - ENV_VAR0_NAME=${SHANTY_OAUTH_TOKEN}
      - ENV_VAR1_NAME=${OPTION_A_ENABLED}
  configs:
    - source: foo_config
      target: /etc/foo_config/foo_config.cfg
      mode: 0444

configs:
  foo_config:
    file: foo_config.cfg

How?

You must first write a manifest.json file and service.yml if the service.yml refers to any configuration files, the must be named in the manifest.json so that they are bundled. File names must be unique.

Once you have your manifest, you can package it by running shanty-parcel

$ shanty-parcel lint manifest.json
$ shanty-parcel build --lint manifest.json

Which will first check for common errors, and then produce the parcel file example.pcl.

Library

This package can also be used as a library, for loading, verifying and preparing pacels for deployment.

from pprint import pprint
import docker
import shanty_parcel


p = shanty_parcel.load('example.pcl', verify=True)

# You can also lazily check the signature.
p.verify()

# Print the contents.
pprint(p.files)

# Configure the service.
config = {}
for option in p.options:
    value = input(f"Please enter a value of type {option.type} for {option.name} [enter for default: {option.default}] ")
    config[option.name] = value

print("Example needs the following settings:")
for setting in p.settings:
    print(f" - {setting.name}")

p.configure(config, settings)

# Save the .yml and supporting files in given directory.
p.write('/path/for/output/')

# Deploy the service.
docker.swarm.deploy('/path/for/output/example.yml')
An OBS script to fuze files together

OBS TEXT FUZE Fuze text files and inject the output into a text source. The Index file directory should be a list of file directorys for the text file

SuperZooper3 1 Dec 27, 2021
A cookiecutter to start a Python package with flawless practices and a magical workflow 🧙🏼‍♂️

PyPackage Cookiecutter This repository is a cookiecutter to quickly start a Python package. It contains a ton of very useful features 🐳 : Package man

Daniel Leal 16 Dec 13, 2021
NExT-Ford-aula4 - NExT Ford aula4

Questão 1: vocês deveram fazer o passo a passo de como ficará as pilhas(Stack) e

Gerson 1 Jan 06, 2022
Um sistema de llogin feito em uma interface grafica.

Interface-para-login Um sistema de login feito com JSON. Utilizando a biblioteca Tkinter, eu criei um sistema de login, onde guarda a informações de l

Mobben 1 Nov 28, 2021
Create standalone, installable R Shiny apps using Electron

WARNING This is still very much a work in progress and nothing can be assumed stable in any way Temp notes: Two types of created installer, based on w

Chase Clark 5 Dec 24, 2021
Dungeon Dice Rolls is an aplication that the user can roll dices (d4, d6, d8, d10, d12, d20 and d100) and store the results in one of the 6 arrays.

Dungeon Dice Rolls is an aplication that the user can roll dices (d4, d6, d8, d10, d12, d20 and d100) and store the results in one of the 6 arrays.

Bracero 1 Dec 31, 2021
Listen Surah, prepare for next and Endless life...

Al-Quran In this repository, I have linked up all Surah with Arabic-Bangla Audio From Youtube. So, you just need to choose and listen. and the ( surah

SpiderX 1 Sep 30, 2022
Checking-For-Fibonacci-Syquence-In-Python - Checking For Fibonacci Syquence In Python

Checking-For-Fibonacci-Syquence-In-Python The Fibonacci sequence is a set of num

John Michael Oliba 1 Feb 14, 2022
Python for Microscopists and other image processing enthusiasts

The YouTube channel associated with this code walks you through the entire process of learning to code in Python; all the way from basics to advanced machine learning and deep learning.

Dr. Sreenivas Bhattiprolu 2.3k Jan 01, 2023
Sublime Text 2/3 style auto completion for ST4

Hippie Autocompletion Sublime Text 2/3 style auto completion for ST4: cycle through words, do not show popup. Simply hit Tab to insert completion, hit

Alexander Schepanovski 20 May 19, 2022
A dead-simple service that notifies you when something goes down.

Totmannschalter Totmannschalter (German for dead man's switch) is a simple service that notifies you when it has not received any message from a servi

1 Dec 20, 2021
CountdownTimer - Countdown Timer For Python

Countdown Timer This python script asks for the user time (input) in seconds, an

Arinzechukwu Okoye 1 Jan 01, 2022
Additional useful operations for Python

Pyteal Extensions Additional useful operations for Python Available Operations MulDiv64: calculate m1*m2/d with no overflow on multiplication (TEAL 3+

Ulam Labs 11 Dec 14, 2022
Programming in Bioinformatics, Block 3

Programming in Bioinformatics - Block 3 I. Setting up Environment and Running the Code Create the environment using the pibi_block3.yml file with the

2 Dec 10, 2021
SEH-Helper - Binary Ninja plugin for exploring Structured Exception Handlers

SEH Helper Author: EliseZeroTwo A Binary Ninja helper for exploring structured e

Elise 74 Dec 26, 2022
This repository contains code for building education startup.

Learning Management System Overview It's the code for EssayBrain, a tool for teacher that automatically grades and validates essays. In order to valid

Shyam Das Shrestha 1 Nov 21, 2021
Ontario-Covid-Screening - An automated Covid-19 School Screening Tool for Ontario

Ontario-Covid19-Screening An automated Covid-19 School Screening Tool for Ontari

Rayan K 0 Feb 20, 2022
GUI tool to manage the contents of chests in Botw

Botw chest manager is a small gui tool allowing to easily manage chests. Sometimes Ice Spear can be very time consuming when adding a simple chest. The purpose of this light tool is to add a new ches

3 Aug 25, 2022
Implementation of the Folders📂 esoteric programming language, a language with no code and just folders.

Folders.py Folders is an esoteric programming language, created by Daniel Temkin in 2015, which encodes the program entirely into the directory struct

Sina Khalili 425 Dec 17, 2022
Linux Security and Monitoring Scripts

Linux Security and Monitoring Scripts These are a collection of security and monitoring scripts you can use to monitor your Linux installation for sec

Andre Pawlowski 65 Aug 27, 2022