Skip to main content

Process manager

Project description

Encab: A Simple Process Manager

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
      main:
         command: httpd-foreground

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

   INFO  encab: encab 0.0.7
   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 controll system not designed to run in a Container environment.

Note

This tool is still under development. Sufficient for local experiments but not mature enough for production use!

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

  • Python Version >= 3.9
  • activated Python virtual environment such as [miniconda][2] or [virtualenv][3]
   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 0.0.7
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 0.0.7
    INFO  encab: Using configuration file ./encab.yml, source: Default location.
    INFO  main: Hello world!
    INFO  main: Exited with rc: 0
    

Similar Projects

Project details


Download files

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

Source Distribution

encab-0.0.7.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

encab-0.0.7-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: encab-0.0.7.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for encab-0.0.7.tar.gz
Algorithm Hash digest
SHA256 123cdf9f1a70dfc1e1afcf8c7e4b04686351937daba3af8f455ebfada7d4a842
MD5 e34a7b5f04ef5f9de070950299b957c7
BLAKE2b-256 d41d296ba34db47b1f4946136fd71d7aac814dc1730bcc5dce6a99ab8f26fe28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: encab-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for encab-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 848762a50ba6f21edd434219433ade9870ceea6890f1eb92d5c207b8651c308b
MD5 b5a6fdec217dc08df09fe1b71dc8903f
BLAKE2b-256 1b75d353fb04ab69f4c4d1ae07ff2e0e18d4cb2302246019294731e61491d501

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page