{"id":17967188,"url":"https://github.com/tschaefer/supervisor","last_synced_at":"2025-10-20T05:55:42.691Z","repository":{"id":259497173,"uuid":"878017041","full_name":"tschaefer/supervisor","owner":"tschaefer","description":"The Docker GitOps service :rocket:","archived":false,"fork":false,"pushed_at":"2025-01-14T12:57:44.000Z","size":544,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T13:40:45.198Z","etag":null,"topics":["docker","docker-compose","gitops","polling","rails","rest-api","webhook"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tschaefer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-24T16:22:21.000Z","updated_at":"2025-01-14T12:28:02.000Z","dependencies_parsed_at":"2024-10-26T01:48:47.974Z","dependency_job_id":"63f18282-6422-4679-b9d6-ac43262f3c3b","html_url":"https://github.com/tschaefer/supervisor","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.34615384615384615","last_synced_commit":"d44c791f31facd5677b9576910c84b82d590919a"},"previous_names":["tschaefer/supervisor"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschaefer%2Fsupervisor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschaefer%2Fsupervisor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschaefer%2Fsupervisor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschaefer%2Fsupervisor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tschaefer","download_url":"https://codeload.github.com/tschaefer/supervisor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234715615,"owners_count":18875905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","gitops","polling","rails","rest-api","webhook"],"created_at":"2024-10-29T14:04:28.759Z","updated_at":"2025-09-30T07:31:32.313Z","avatar_url":"https://github.com/tschaefer.png","language":"Ruby","readme":"\n# Supervisor\n\nSupervisor is a Docker GitOps service that allows you to manage `docker-compose` based stacks through a REST API. The minimal input required to manage stacks includes a unique name, a URL to the git repository hosting the stack files, and a strategy for updating the stack (either via polling or webhook). Authentication and authorization are handled via HTTP headers.\n\n* [Supervisor](#supervisor)\n   * [Status](#status)\n   * [Features](#features)\n   * [Requirements](#requirements)\n   * [Running Supervisor](#running-supervisor)\n      * [Exposing Port and HTTPS Requirements](#exposing-port-and-https-requirements)\n   * [REST API](#rest-api)\n      * [Authentication](#authentication)\n      * [API Endpoints](#api-endpoints)\n      * [Creating a Stack](#creating-a-stack)\n         * [Parameters](#parameters)\n      * [List Stacks](#list-stacks)\n      * [Show Stack](#show-stack)\n      * [Show Stack Statistics](#show-stack-statistics)\n      * [Update Stack](#update-stack)\n      * [Delete Stack](#delete-stack)\n      * [Get Stack Log](#get-stack-log)\n      * [Control Stack](#control-stack)\n   * [Metrics](#metrics)\n   * [Dashboard](#dashboard)\n   * [License](#license)\n   * [Is it any good?](#is-it-any-good)\n\n## Status\n[![GitHub Actions Workflow CI Status](https://img.shields.io/github/actions/workflow/status/tschaefer/supervisor/ci.yml?label=ci)](https://github.com/tschaefer/supervisor/actions)\n[![GitHub Actions Workflow Docker Release Status](https://img.shields.io/github/actions/workflow/status/tschaefer/supervisor/docker-release.yml?label=docker-release)](https://github.com/tschaefer/supervisor/actions)\n\n[![GitHub Release](https://img.shields.io/github/v/release/tschaefer/supervisor)](https://github.com/tschaefer/supervisor/releases/latest)\n[![Container image](https://img.shields.io/badge/image-latest-blue)](https://github.com/tschaefer/supervisor/pkgs/container/supervisor/latest)\n\n## Features\n\n- Manage Docker Compose-based stacks via REST API\n- GitOps strategy support:\n  - **Polling**: Define an interval to automatically pull updates.\n  - **Webhook**: Trigger updates via webhooks, with support for signatures.\n- Supports Git repository authentication (username and token).\n- Custom Docker Compose variables and additional Compose files can be passed with each stack.\n- Secured with HTTP authorization headers.\n\n## Requirements\n\n- Docker must be installed on the host system.\n\n## Running Supervisor\n\nTo run Supervisor as a Docker container:\n\n```\ndocker container run --name supervisor \\\n  --detach \\\n  --volume /var/run/docker.sock:/var/run/docker.sock \\\n  --volume /var/lib/container/supervisor:/rails/storage \\\n  --env SUPERVISOR_SECRET_KEY_BASE=\"af8758d92e3eccfbcc84a6bd6684060d\" \\\n  --env SUPERVISOR_API_KEY=\"8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --env SUPERVISOR_RAILS_LOG_LEVEL=\"info\" \\\n  --publish 3000:3000 \\\n  ghcr.io/tschaefer/supervisor\n```\n\n### Managing and deploying Supervisor\n\n[Supervisor Client](https://github.com/tschaefer/supervisor-client) is a\nRuby library and command-line tool that allows you to manage stacks and deploy\nthe Supervisor service.\n\n### Exposing Port and HTTPS Requirements\n\n- The Supervisor container exposes **port 3000** for HTTP traffic but **only accepts HTTPS connections**.\n- You need to set up a reverse proxy (such as Nginx or Traefik) to handle HTTPS termination and forward traffic to the container on port 3000.\n\n## REST API\n\nYou can interact with Supervisor via its REST API to manage stacks.\n\n### Authentication\n\nAll requests to the API must be authorized using the `Authorization` HTTP header, which should contain the API key provided during setup.\n\n```\n--header \"Authorization: Bearer \u003cyour-api-key\u003e\"\n```\n\n### API Endpoints\n\n- **`POST /stacks`**: Create a new stack.\n- **`GET /stacks`**: List all stacks.\n- **`GET /stacks/\u003cstack_uuid\u003e`**: Show details of a specific stack.\n- **`GET /stacks/\u003cstack_uuid\u003e/stats`**: Show statistics for a specific stack.\n- **`PATCH/PUT /stacks/\u003cstack_uuid\u003e`**: Update a stack.\n- **`DELETE /stacks/\u003cstack_uuid\u003e`**: Delete a stack.\n- **`POST /stacks/\u003cstack_uuid\u003e/webhook`**: Trigger a stack update.\n- **`POST /stacks/\u003cstack_uuid\u003e/control`**: Control the stack (start, stop, restart, redeploy).\n- **`GET /stacks/\u003cstack_uuid\u003e/log`**: Retrieve last stack log entries or stream logs (Server-sent events).\n- **`GET /up`**: Check the health of the Supervisor service. (No authorization required)\n\n### Creating a Stack\n\nThe following `curl` command demonstrates how to create a new stack using Supervisor's REST API:\n\n```\ncurl --request POST \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  --json '{\n    \"name\": \"whoami\",\n    \"git_repository\": \"https://github.com/tschaefer/infrastructure\",\n    \"git_username\": \"tschaefer\",\n    \"git_token\": \"github_pat_...FFF\",\n    \"git_reference\": \"refs/heads/main\",\n    \"compose_file\": \"lib/stack/whoami/docker-compose.yml\",\n    \"compose_includes\": [\n      \"lib/stack/whoami/includes/traefik.yml\",\n      \"lib/stack/whoami/includes/network.yml\"\n    ],\n    \"compose_variables\": {\n      \"NETWORK_IPV4_WHOAMI\": \"172.18.100.111\",\n      \"NETWORK_ID\": \"core\"\n    },\n    \"strategy\": \"polling\",\n    \"polling_interval\": \"300\"\n    \"signature_header\": \"X-Hub-Signature-256\",\n    \"signature_secret\": \"2ede1091492a7c4205ae9c0ee9ed7376\n  }' \\\n  https://supervisor.example.com/stacks\n```\n\n#### Parameters\n\n- `name`: Unique name for the stack.\n- `git_repository`: URL to the git repository containing the stack's `docker-compose.yml` file.\n- `git_username`: (Optional) Username for accessing the repository.\n- `git_token`: (Optional) Token for accessing the repository.\n- `git_reference`: Git reference (e.g., branch or tag) to track.\n- `compose_file`: Path to the `docker-compose.yml` file in the repository.\n- `compose_includes`: (Optional) A list of additional Compose files to be included.\n- `compose_variables`: (Optional) Variables to pass to the compose file.\n- `strategy`: GitOps strategy. Can be `polling` or `webhook`.\n- `polling_interval`: (For `polling` strategy) Interval in seconds for polling the repository for changes.\n- `signature_header` and `signature_secret`: (For `webhook` strategy) Additional data required for webhooks.\n\nAny update beside the `name`, `strategy` and required attributes will apply a redeploy of the stack.\n\n### List Stacks\n\nTo retrieve a list of all managed stacks:\n\n```\ncurl --request GET \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  https://supervisor.example.com/stacks/\n```\n\n### Show Stack\n\nTo view the details of a specific stack (replace `\u003cstack_uuid\u003e` with the actual stack ID):\n\n```\ncurl --request GET \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e\n```\n\n### Show Stack Statistics\n\nTo view statistics for a specific stack, such as the number of processed or failed runs and the last run timestamp:\n\n```\ncurl --request GET \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e/stats\n```\n\n### Update Stack\n\nTo update a stack (e.g., changing the `strategy`):\n\n```\ncurl --request PATCH \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  --json '{ \"strategy\": \"webhook\" }' \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e\n```\n\n### Delete Stack\n\nTo delete a stack:\n\n```\ncurl --request DELETE \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e\n```\n\n### Get Stack Log\n\nTo retrieve logs for a stack (Server-sent events):\n\n```\ncurl --request GET \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  --no-buffer \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e/log?follow=true\n```\n\nTo retrieve the last log entries (default is 1, max is 100):\n\n```\ncurl --request GET \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e/log?entries=50\n```\n\n### Control Stack\n\nTo control a stack (start, stop, restart, redeploy):\n\n```\ncurl --request POST \\\n  --silent \\\n  --header \"Authorization: Bearer 8db7fde4-6a11-462e-ba27-6897b7c9281b\" \\\n  --verbose \\\n  --json '{ \"command\": \"start\" }' \\\n  https://supervisor.example.com/stacks/\u003cstack_uuid\u003e/control\n```\n\n## Metrics\n\nTo retrieve Prometheus metrics, you can access the\n`http://supervisor.example.com:9394/metrics` endpoint.\n\n  * `supervisor_total_stacks`: The total number of stacks. (gauge)\n  * `supervisor_total_healthy_stacks`: The total number of healthy stacks. (gauge)\n  * `supervisor_total_unhealthy_stacks`: The total number of unhealthy stacks. (gauge)\n  * `supervisor_jobs_execution_time`: The time taken to execute stack jobs, measured in seconds. (histogram)\n  * `supervisor_jobs_executed_total`: The total number of stack jobs executed. (counter)\n  * `supervisor_jobs_succeeded_total`: The total number of stack jobs that succeeded. (counter)\n  * `supervisor_jobs_failed_total`: The total number of stack jobs that failed. (counter)\n\n## Dashboard\n\nSupervisor provides a simple dashboard to view and monitor stacks. The\ndashboard is accessible at the URL path `/dashboard` of the Supervisor service.\nThe access is restricted by basic authentication. The credentials are set\nvia the environment variables `SUPERVISOR_DASHBOARD_USERNAME` and\n`SUPERVISOR_DASHBOARD_PASSWORD`. The default credentials username is\n`supervisor` and the password is `supervisor` as well.\n\n![Dashboard view](.screenshots/supervisor-dashboard.jpg \"Dashboard view\")\n\n## License\n\nSupervisor is released under the [MIT License](https://opensource.org/licenses/MIT).\n\n## Is it any good?\n\n[Yes.](https://news.ycombinator.com/item?id=3067434)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschaefer%2Fsupervisor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftschaefer%2Fsupervisor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschaefer%2Fsupervisor/lists"}