Packaging tools for shanty services.

Related tags

Miscellaneous parcel
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')
You might also like...
Open source tools to allow working with ESP devices in the browser

ESP Web Tools Allow flashing ESPHome or other ESP-based firmwares via the browser. Will automatically detect the board type and select a supported fir

Scientific color maps and standardization tools
Scientific color maps and standardization tools

Scicomap is a package that provides scientific color maps and tools to standardize your favourite color maps if you don't like the built-in ones. Scicomap currently provides sequential, bi-sequential, diverging, circular, qualitative and miscellaneous color maps. You can easily draw examples, compare the rendering, see how colorblind people will perceive the color maps. I will illustrate the scicomap capabilities below.

Unofficial Valorant documentation and tools for third party developers

Valorant Third Party Toolkit This repository contains unofficial Valorant documentation and tools for third party developers. Our goal is to centraliz

AMTIO aka All My Tools in One

AMTIO AMTIO aka All My Tools In One. I plan to put a bunch of my tools in this one repo since im too lazy to make one big tool. Installation git clone

A beacon generator using Cobalt Strike and a variety of tools.
A beacon generator using Cobalt Strike and a variety of tools.

Beaconator is an aggressor script for Cobalt Strike used to generate either staged or stageless shellcode and packing the generated shellcode using your tool of choice.

Control your gtps with gtps-tools!
Control your gtps with gtps-tools!

Note Please give credit to me! Do not try to sell this app, because this app is 100% open source! Do not try to reupload and rename the creator app! S

Set of tools to analyze Tinynuke samples

tinynuke-toolset You'll find in that repository a set of tools and scripts I developped to analyze Tinynuke samples. Dll extractor: script used to ext

Tools for collecting social media data around focal events

Social Media Focal Events The focalevents codebase provides tools for organizing data collected around focal events on social media. It is often diffi

Simple tools to make/dump CPC+ CPR cartridge files

Simple tools to make/dump CPC+ CPR cartridge files mkcpr.py: make a CPR file from files (one chunk per file); see notes cprdump.py: dump the chunks of

Owner
null
Python client SDK designed to simplify integrations by automating key generation and certificate enrollment using Venafi machine identity services.

This open source project is community-supported. To report a problem or share an idea, use Issues; and if you have a suggestion for fixing the issue,

Venafi, Inc. 13 Sep 27, 2022
Vector tile server for the Wildfire Predictive Services Unit

wps-tileserver Vector tile server for the Wildfire Predictive Services Unit Overview The intention of this project is to: provide tools to easily spin

Province of British Columbia 6 Dec 20, 2022
Programmatic interface to Synapse services for Python

A Python client for Sage Bionetworks' Synapse, a collaborative, open-source research platform that allows teams to share data, track analyses, and collaborate

Sage Bionetworks 54 Dec 23, 2022
🏆 A ranked list of awesome Python open-source libraries and tools. Updated weekly.

Best-of Python ?? A ranked list of awesome Python open-source libraries & tools. Updated weekly. This curated list contains 230 awesome open-source pr

Machine Learning Tooling 2.7k Jan 3, 2023
A fancy and practical functional tools

Funcy A collection of fancy functional tools focused on practicality. Inspired by clojure, underscore and my own abstractions. Keep reading to get an

Alexander Schepanovski 2.9k Dec 29, 2022
A Python utility belt containing simple tools, a stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress, and more made easy!

Ubelt is a small library of robust, tested, documented, and simple functions that extend the Python standard library. It has a flat API that all behav

Jon Crall 638 Dec 13, 2022
Some ideas and tools to develop Python 3.8 plugins for GIMP 2.99.4

gimp-python-development Some ideas and tools to develop Python 3.8 plugins for GIMP 2.99.4. GIMP 2.99.4 is the latest unstable pre-release of GIMP 3.

Ismael Benito 53 Sep 25, 2022
Socorro is the Mozilla crash ingestion pipeline. It accepts and processes Breakpad-style crash reports. It provides analysis tools.

Socorro Socorro is a Mozilla-centric ingestion pipeline and analysis tools for crash reports using the Breakpad libraries. Support This is a Mozilla-s

Mozilla Services 552 Dec 19, 2022
addon for blender to import mocap data from tools like easymocap, frankmocap and Vibe

b3d_mocap_import addon for blender to import mocap data from tools like easymocap, frankmocap and Vibe ==================VIBE================== To use

Carlos Barreto 97 Dec 7, 2022
Blender addons - A collection of Blender tools I've written for myself over the years.

gret A collection of Blender tools I've written for myself over the years. I use these daily so they should be bug-free, mostly. Feel free to take and

null 217 Jan 8, 2023