Skip to main content

Run multiple services inside a docker container

Project description

multi-start

GitHub Workflow Status Code style: black PyPI PyPI - Python Version License: BSD 3-Clause

This tool aims to help running multiple services inside a single docker container.

Sometimes you might want to have backend, frontend and nginx (or a combination of those) inside a single container. This tool may help with:

  • Prepare final Nginx configs using parse-template
  • Wait until backend and frontend start responding before running Nginx
  • Stop every process if one of them exits so the whole container stops gracefully

Installation

pip install multi-start

Usage

multi-start --help

Usage: multi-start [OPTIONS]

  Run multiple services at once. Set DEBUG environment variable to 1 for more
  verbose output when running.

Options:
  --backend / --no-backend        Enable backend service  [default: no-
                                  backend]
  --backend-cmd TEXT              Command to start backend service  [default:
                                  poetry run invoke serve]
  --backend-dir TEXT              Working directory for the backend  [default:
                                  backend]
  --backend-port INTEGER          Port number that backend is running at if
                                  port is used
  --backend-socket TEXT           UNIX socket path that backend is running at
                                  if socket is used  [default:
                                  /run/nginx/uvicorn.sock]
  --frontend / --no-frontend      Enable frontend service  [default: no-
                                  frontend]
  --frontend-port INTEGER         Port number that frontend is running at
                                  [default: 3000]
  --frontend-cmd TEXT             Command to start frontend service  [default:
                                  pnpm run start]
  --frontend-dir TEXT             Working directory for the frontend
                                  [default: frontend]
  --nginx / --no-nginx            Enable nginx  [default: no-nginx]
  --nginx-cmd TEXT                Command to start Nginx  [default: nginx -g
                                  "daemon off;"]
  --service-wait-time FLOAT       How long to wait for a service to be up an
                                  running (sec)  [default: 3.0]

Development

Make sure you install pre-commit and run:

pre-commit install

For testing you can use e.g.

poetry run multi-start \
  --backend \
  --backend-dir ../another-project/src \
  --backend-cmd "poetry run invoke dev" \
  --backend-port 8080

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

multi_start-1.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

multi_start-1.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file multi_start-1.1.0.tar.gz.

File metadata

  • Download URL: multi_start-1.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1019-azure

File hashes

Hashes for multi_start-1.1.0.tar.gz
Algorithm Hash digest
SHA256 21e0c3359f9eb6b818ee536e9d3ed55c400b073ffa41d19903460af8ba63468f
MD5 2313b80a6226ca1940725fc20f632d95
BLAKE2b-256 c8560b3efef08706a80dea24b26ccb5ba48dba9508db0e37e11ffa057b602c2c

See more details on using hashes here.

File details

Details for the file multi_start-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: multi_start-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1019-azure

File hashes

Hashes for multi_start-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 898a9efeb4546fb3dcd47941b860a839b66b25ea906ebdb32c7d6af1bc9f14df
MD5 0a3ee6d2c3b0c2e69e616ab0f80fadaa
BLAKE2b-256 b25e5ff21247e8a7ed6ebd540ab6c65d5757f300a41a615b3ae7b39b6bcb8ad9

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