Skip to main content

Postal

A light Docker control tool designed around compose and swarm
Documentation
PyPi Package

Getting Started

Postal requires that you have python >= 3.6, docker, and docker-compose installed. Postal is designed for use on Linux.

Installing Client

To install:
pip install docker-postal

For the console script to be installed you may need to install with:
pip install --user docker-postal

Or unfortunately if (~/.local/bin) is not on your system path:
sudo pip install docker-postal

Installing Service

To install the postal server, you must first setup a secure S3 bucket to store configurations.

S3 Bucket

To setup S3, create a secure, private, encrypted bucket. Then create user to access this bucket with the following permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObjectAcl",
                "s3:GetObject",
                "s3:ListBucket",
                "s3:DeleteObject",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::example-bucket-name/*",
                "arn:aws:s3:::example-bucket-name"
            ]
        }
    ]
}

Postal Service

The postal service runs an openssh server than enables remote access to the docker daemon/swarm.

On swarm manager, login to a docker repository where images will be pushed and retrieved:

docker login

Create postal config folder and add an authorized key:

mkdir /data/postal
touch /data/postal/authorized_keys
chmod 600 /data/postal/authorized_keys
sudo chown -R root:root /data/postal
sudo nano /data/postal/authorized_keys # paste in your public key and save

Clone postal repository:

git clone https://github.com/obe-de/postal
cd postal

Create an environment file:

nano stack/production.env

Then paste:

POSTAL_AWS_BUCKET=example-bucket-name
POSTAL_AWS_REGION=us-east-2
AWS_ACCESS_KEY_ID=YOURKEY
AWS_SECRET_ACCESS_KEY=yoursecret

Deploy postal stack:

docker stack rm postal # (optional)
docker build -t postal:latest -f stack/postal/Dockerfile .
docker stack deploy -c stack/production.yml postal

Check that everything is working:

docker service ls | grep postal

(Optional) Check that you can exec bash in the container:

docker exec -it $(docker ps -aqf "name=postal_postal") bash

Login from the client:

postal login -u root -a yourdomain -p 5020

Connecting and Deploying

After you have deployed the postal service check that your public key has been added (instructions below) so you have permission to connect.

  1. Login to the postal service using postal login.
  2. Double check that you have connected by running a swarm command like postal swarm ps.
  3. Enter project directory that you want to deploy.
  4. Configure project environment variables: postal config ls and postal config set etc.
  5. Create a production.yml file in the stack with env_file: production.env if you want the project's production configuration injected.
  6. Make sure the ports you have selected in production.yml aren't going to clash with an existing service.
  7. Deploy working directory using postal swarm deploy -w.
  8. Check the status of your service using postal swarm service ls
  9. Debug services that fail to replicate using docker service ps --no-trunc your_service_name_here
  10. Your service should be accessible via any node on the swarm if you used the swarms overlay network.

Todo

  • Don't use disk backed temp files for RPC input / output
  • Deploy from git origin

Release files for docker-postal 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docker-postal 0.0.13
File Size Uploaded
docker-postal-0.0.13.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docker-postal 0.0.13
File Interpreter ABI Platform
docker_postal-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size:23.7 kB

Release files / docker-postal-0.0.13.tar.gz

Download URL docker-postal-0.0.13.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c41260584daa3b9fa912f134e75c78a3087fed330f35f13168840b6c9ebb6ec7
BLAKE2b-256 checksum
How to use checksums
03def15cdd66c83a03af0f19fae1854e3704fec840659f9ced9b1d809c0798e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.6.9 Linux/5.4.0-58-generic

Release files / docker_postal-0.0.13-py3-none-any.whl

Download URL docker_postal-0.0.13-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9665b016263fe5362ce1d7c1de7c66f5b6b8e7ab56dd431c4c45a16b1f74ef3f
BLAKE2b-256 checksum
How to use checksums
31b74c378bb7ed5e7154aca21bc4a887df2e8d97e9210111adf246e92b350175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.6.9 Linux/5.4.0-58-generic

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

2 release files

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page