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')
IG Trading Algos and Scripts in Python

IG_Trading_Algo_Scripts_Python IG Trading Algos and Scripts in Python This project is a collection of my work over 2 years building IG Trading Algorit

191 Oct 11, 2022
Capture screen and download off Roku based devices

rokuview Capture screen and download off Roku based devices Tested on Hisense TV with Roku OS built-in No guarantee this will work with all Roku model

3 May 27, 2021
Create beautiful diagrams just by typing mathematical notation in plain text.

Penrose Penrose is an early-stage system that is still in development. Our system is not ready for contributions or public use yet, but hopefully will

Penrose 5.6k Jan 08, 2023
Lenovo Yoga Ideapad Autocharge

Description This program uses the conservation_mode of Lonovo Ideapad / Yoga not

1 Jan 09, 2022
Configure request params such as text, color, size etc. And then download the image

Configure request params such as text, color, size etc. And then download the image

6 Aug 18, 2022
Meower a social media platform written in Scratch 3.0 and Python

Meower Meower is a social media platform written in Scratch 3.0 and Python, ported to HTML for self-hosting. Try Beta 4.6 Changelog for 4.6 Start impl

Meower Media Co. 23 Dec 02, 2022
Automatically re-open threads when they get archived, no matter your boost level!

ThreadPersist Automatically re-open threads when they get archived, no matter your boost level! Installation You will need to install poetry to run th

7 Sep 18, 2022
An app to help people apply for admissions on schools/hostels

Admission-helper About An app to help people apply for admissions on schools/hostels This app is a rewrite of Admission-helper-beta-v5.8.9 and I impor

Advik 3 Apr 24, 2022
A toy repo illustrating a minimal installable Python package

MyToy: a minimal Python package This repository contains a minimal, toy Python package with a few files as illustration for students of how to lay out

Fernando Perez 19 Apr 24, 2022
Gerador de dafaces

🎴 DefaceGenerator Obs: esse script foi criado com a intenção de ajudar pessoas iniciantes no hacking que ainda não conseguem criar suas próprias defa

LordShinigami 3 Jan 09, 2022
Transform a Google Drive server into a VFX pipeline ready server

Google Drive VFX Server VFX Pipeline About The Project Quick tutorial to setup a Google Drive Server for multiple machines access, and VFX Pipeline on

Valentin Beaumont 17 Jun 27, 2022
Multi View Stereo on Internet Images

Evaluating MVS in a CPC Scenario This repository contains the set of artficats used for the ENGN8601/8602 research project. The thesis emphasizes on t

Namas Bhandari 1 Nov 10, 2021
A bot to view Dilbert comics directly from Discord and get updates of the comics automatically.

A bot to view Dilbert comics directly from Discord and get updates of the comics automatically

Raghav Sharma 3 Nov 30, 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
Hello, Welcome to this repo. don't forget to read guidelines in readme.md

Hacktoberfest_2021 If you looking for your first contribution, we are here to help. Just create a simple program using any language you like in our fo

Wafa Rifqi Anafin 117 Dec 14, 2022
JHBuild is a tool designed to ease building collections of source packages, called “modules”.

JHBuild README JHBuild is a tool designed to ease building collections of source packages, called “modules”. JHBuild was originally written for buildi

GNOME Github Mirror 46 Nov 22, 2022
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
[CVPR 2020] Rethinking Class-Balanced Methods for Long-Tailed Visual Recognition from a Domain Adaptation Perspective

Rethinking Class-Balanced Methods for Long-Tailed Visual Recognition from a Domain Adaptation Perspective [Arxiv] This is PyTorch implementation of th

Abdullah Jamal 22 Nov 19, 2022
x-tools is a collection of tools developed in Python

x-tools X-tools is a collection of tools developed in Python Commands\

5 Jan 24, 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 07, 2022