Skip to main content

Encab: A Simple Process Manager

image image image

Encab is a process manager that simplifies running multiple services in a container or from the command line.

It's essentially a replacement for complex, hand-written Docker Container Entrypoint scripts, especially when dockerizing complex legacy applications.

  1. Add it as your Dockerfile Entrypoint, together with the encab configuration file encab.yml,
   ...
   ADD encab.yml .
   ENTRYPOINT ["encab"]
  1. Define what you want to run in your container in encab.yml,
   programs:
      cron:
         command: cron -f
         restart_delay: 1
      main:
         command: httpd-foreground

and encab cares for the rest. Run it and you'll always know who's logging what...

   INFO  encab: encab 1.0.5
   INFO  encab: Using configuration file ./encab.yml, source: Default location.
   ERROR main: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
   ERROR main: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
   ERROR main: [Wed Jan 18 09:47:12.417275 2023] [mpm_event:notice] [pid 12:tid 140142563044672] AH00489: Apache/2.4.54 (Unix) configured -- resuming normal operations
   ERROR main: [Wed Jan 18 09:47:12.417830 2023] [core:notice] [pid 12:tid 140142563044672] AH00094: Command line: 'httpd -D FOREGROUND'
   INFO  cron: Hello Wed Jan 18 09:48:01 UTC 2023

It shares some similarities with supervisord which I've used before I wrote encab but supervisord is a process control system not designed to run in a Container environment.

Features

  • run multiple programs in a container at a time with transparent logging
  • run programs as different users
  • handle environment variables in a flexible way
  • simplify container debugging
  • load, build, validate environment variables

Documentation

Encab Documentation

Installation

Install locally

Prerequisites

   pip install -U encab

Run locally

  1. Create sample encab file encab.yml
   encab:
      dry_run: false
   programs:
      main:
         sh:
            - echo "Hello Encab!"
  1. Run locally:
   encab

The result will be something like this:

INFO  encab: encab 1.0.5
INFO  encab: Using configuration file ./encab.yml, source: Default location.
INFO  main: Hello Encab!
INFO  main: Exited with rc: 0

Install in Container

Prerequisites

  • Docker from your Linux distribution or Docker Desktop.

Run in Container

  1. Create sample encab file encab.yml
   encab:
      dry_run: false
   programs:
      main:
         sh:
            - echo "Hello Encab!"
  1. Add Encab to your Docker file.

    FROM python:3.10.8-slim-bullseye
    # --------------------------------------------
    # Install Venv 
    #
    ENV VIRTUAL_ENV=/opt/encabenv
    ENV PATH="$VIRTUAL_ENV/bin:$PATH"
    RUN python3 -m venv $VIRTUAL_ENV && \
       pip install --upgrade pip
    # --------------------------------------------
    # Install Encab 
    #
    
    RUN pip install encab
    
    # -------------------------------------------
    # add configuration file
    #
    ADD encab.yml .
    
    # -------------------------------------------
    # set encab as entrypoint
    ENTRYPOINT ["encab"]
    
  2. Build container

    docker build -t encab_minimum .
    
  3. Run container

    docker run encab_minimum
    

    Result:

    INFO  encab: encab 1.0.5
    INFO  encab: Using configuration file ./encab.yml, source: Default location.
    INFO  main: Hello world!
    INFO  main: Exited with rc: 0
    

Similar Projects

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

encab-1.0.5.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

encab-1.0.5-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file encab-1.0.5.tar.gz.

File metadata

  • Download URL: encab-1.0.5.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for encab-1.0.5.tar.gz
Algorithm Hash digest
SHA256 757c90ab325f2e9ea217fa3c26210c26449fc0d04760fdbb55d3f995d11497f0
MD5 9203054d1725d4fc2db1b22005ee46d5
BLAKE2b-256 81ba6190db386bedf92881795d2bd0df31ae388d098a41f5c91384b11f8aeef1

See more details on using hashes here.

File details

Details for the file encab-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: encab-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for encab-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9defada61ab21bec830ae3afea8c6e59ffeb13707b9035f1d0bc8d544ab8f1d8
MD5 0cf0ab68d5d99e07ff71735d3da3a3c6
BLAKE2b-256 4ff21b1d8db632039e1812d0775a34440c2313bea0db88951e261077951c48b3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page