GitXplorerGitXplorer
j

compose-systemd

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
2b6fa696a82a687874e0cad9a868063415189899

version 1.6.1

jjrd committed 2 years ago
Unverified
1cd684916851b1d2953110ae50dd8a281d30375b

version 1.6.0

jjrd committed 2 years ago
Unverified
e831f59d9727499d7b35e2b2b12359eefeff1705

version 1.5.0

jjrd committed 2 years ago
Unverified
6ed7c793f55a057856647f08327103c6dc90fcd9

Update tests

jjrd committed 2 years ago
Unverified
e069e4dbf83636d58369c60a73d8a50db9a0a77c

Use wait-for-cpu-idle python script to delay service start

jjrd committed 2 years ago
Unverified
0d56cc1efd38a0d538803786eef0e7fe35388875

Be compatible with legacy `docker-compose` command and new `docker compose` command

jjrd committed 2 years ago

README

The README file for this repository.

compose-dirs

This script is used to install and manage docker compose projects with systemd.

A semi-automatic dependency mechanism is available.

This can be used to automatically start the different compose services in the correct order (but no waiting for availability is done, as containers in a compose file).

Configuration

You need to copy compose-dirs.conf in /etc/ and compose-dirs in /usr/local/bin/ or any directory in your PATH

Edit /etc/compose-dirs.conf file to adjust configuration to your liking.

By default, the following configuration is:

  • compose directory: /etc/compose
  • compose user: compose
  • systemd base service name: compose@.service
  • dependencies file: /etc/compose/compose.deps

Dependencies:

  • bash
  • systemd
  • docker with Compose v2 or docker-compose
  • python3
  • coreutils
  • findutils

compose.deps format

This file specify one compose directory per line, following by a colon and a coma separated list of compose directories dependencies.

Ex:

compose_1:
compose_2:
compose_3:compose_1,compose_2
compose_4:compose_2

Installation

Install the Systemd service template:

compose-dirs install

Usage

Every time you modify a compose project or a dependency, just run:

compose-dirs update

or run:

compose-dirs update your_application

You can then start the whole chain with:

compose-dirs start

Or just your application with:

compose-dirs start your_application

There are also stop, restart and status commands.

Use -h or --help to get help.

Use -v or --verbose to get verbose output.

Use -V or --version to show compose-dirs version.

Testing

You can use ./testindocker to install it in a temporary docker

  • Add app1: and app2: to /etc/compose/compose.deps file by using docker exec or a local ssh connection.
  • Install systemd services: compose-dirs update
  • Start them: systemctl start compose@app1, same for app2.