-
Notifications
You must be signed in to change notification settings - Fork 0
Restructure Docker Compose Setup With Modular Extensions #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b1b0125
Restructure Docker Compose setup around env-var driven configuration
danielesser a34c023
Add nginx extension for HTTPS reverse proxy with automatic certificates
danielesser 4dbbc0c
Add watchtower extension for automatic container updates
danielesser ec617b6
Add backup extension for database and workflow-data backups
danielesser 47eb302
Add portainer extension for web-based Docker stack management
danielesser 7abe6a3
Fix README heading levels and MongoDB password rotation guidance
danielesser 529106a
Vagrantfile: bump to debian/bookworm64 and forward extension ports
danielesser 7e5b442
README: add Pulls and Docs badges
danielesser a6970bd
Add CI workflow to validate Compose files on every push
danielesser 65cb233
Vagrantfile: fall back to a free host port on conflict
danielesser a6a6a87
docker-compose.yml: warn that default secrets are public
danielesser aa68f99
extensions/portainer: bind to 127.0.0.1 instead of all interfaces
danielesser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Copy this file to `.env` (same directory as docker-compose.yml) and adjust | ||
| # the values you want to change. Anything left out keeps the default baked | ||
| # into docker-compose.yml. | ||
| # | ||
| # Changing a value here updates it everywhere it's used — e.g. | ||
| # MONGO_ROOT_PASSWORD is shared by the api and mongodb services, so you only | ||
| # need to change it once, right here. | ||
|
|
||
| # MongoDB root credentials, used by both the api and mongodb services. | ||
| # Changing MONGO_ROOT_PASSWORD after the database was initialized doesn't | ||
| # rotate it automatically — see docs.nodepit.com/runner/configuration. | ||
| MONGO_ROOT_USERNAME=root | ||
| MONGO_ROOT_PASSWORD=drnFEtX_PWKizUzKr3KT | ||
|
|
||
| # Shared secret between the api and executor services. | ||
| API_KEY=nYCA3oaqhYJ__GEteWye | ||
|
|
||
| # The URL Runner is reachable at. Change for anything beyond local use, e.g. | ||
| # https://npr.example.com — required when using the nginx extension. | ||
| WEB_BASE_URL=http://localhost:8080 | ||
|
|
||
| # --- extensions/nginx --- | ||
| # Public domain name, must match WEB_BASE_URL above and have a DNS entry | ||
| # pointing at this server. | ||
| # DOMAIN=npr.example.com | ||
| # Email address used for Let's Encrypt certificate registration/renewal. | ||
| # LETSENCRYPT_EMAIL=admin@example.com | ||
|
|
||
| # --- extensions/backup --- | ||
| # Local backups (./extensions/backup/archive) and the daily schedule/ | ||
| # retention work without any of these being set. Set the following to also | ||
| # ship backups to an S3-compatible bucket: | ||
| # BACKUP_S3_BUCKET=my-npr-backups | ||
| # BACKUP_S3_ACCESS_KEY_ID= | ||
| # BACKUP_S3_SECRET_ACCESS_KEY= | ||
| # BACKUP_S3_ENDPOINT=s3.amazonaws.com | ||
| # BACKUP_S3_PATH= | ||
| # BACKUP_CRON_EXPRESSION=0 3 * * * | ||
| # BACKUP_RETENTION_DAYS=7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: Validate Compose | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| validate: | ||
| name: Validate (${{ matrix.name }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - name: base | ||
| files: -f docker-compose.yml | ||
| - name: nginx | ||
| files: -f docker-compose.yml -f extensions/nginx/docker-compose.yml | ||
| - name: watchtower | ||
| files: -f docker-compose.yml -f extensions/watchtower/docker-compose.yml | ||
| - name: backup | ||
| files: -f docker-compose.yml -f extensions/backup/docker-compose.yml | ||
| - name: portainer | ||
| files: -f docker-compose.yml -f extensions/portainer/docker-compose.yml | ||
| - name: all extensions combined | ||
| files: -f docker-compose.yml -f extensions/nginx/docker-compose.yml -f extensions/watchtower/docker-compose.yml -f extensions/backup/docker-compose.yml -f extensions/portainer/docker-compose.yml | ||
| env: | ||
| DOMAIN: example.com | ||
| LETSENCRYPT_EMAIL: admin@example.com | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| - run: docker compose ${{ matrix.files }} config --quiet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| .vagrant | ||
| .env | ||
| extensions/nginx/conf.d/default.conf | ||
| extensions/backup/archive/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # NodePit Runner — backup extension | ||
| # | ||
| # Backs up the mongodb database (via mongodump, so it's consistent even | ||
| # while Runner is running) and the api-data volume (uploaded workflows and | ||
| # environments) on a daily schedule. The executor-data volume is excluded — | ||
| # it's the executor's working/cache directory, not source-of-truth data. | ||
| # | ||
| # By default, backups are written locally to ./extensions/backup/archive on | ||
| # the host. To also (or instead) ship them off-site, set the AWS_S3_* / S3_* | ||
| # variables in .env — see .env.example. Uses | ||
| # https://offen.github.io/docker-volume-backup/ under the hood. | ||
| # | ||
| # Usage: | ||
| # docker compose -f docker-compose.yml -f extensions/backup/docker-compose.yml up -d | ||
|
|
||
| services: | ||
| mongodb: | ||
| volumes: | ||
| - mongodb-dump:/dump | ||
| labels: | ||
| docker-volume-backup.archive-pre: >- | ||
| /bin/sh -c 'mongodump --archive --gzip | ||
| --uri="mongodb://${MONGO_ROOT_USERNAME:-root}:${MONGO_ROOT_PASSWORD:-drnFEtX_PWKizUzKr3KT}@localhost/nodepit-runner?authSource=admin" | ||
| > /dump/mongodb.archive.gz' | ||
| docker-volume-backup.archive-post: "rm -f /dump/mongodb.archive.gz" | ||
|
|
||
| backup: | ||
| image: offen/docker-volume-backup:v2.48.2 | ||
| restart: unless-stopped | ||
| environment: | ||
| BACKUP_CRON_EXPRESSION: ${BACKUP_CRON_EXPRESSION:-0 3 * * *} | ||
| BACKUP_FILENAME: npr-backup-%Y-%m-%dT%H-%M-%S.tar.gz | ||
| BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-7} | ||
| # Leave unset to skip shipping backups off-site — local backups under | ||
| # ./extensions/backup/archive still happen either way. | ||
| AWS_S3_BUCKET_NAME: ${BACKUP_S3_BUCKET:-} | ||
| AWS_S3_PATH: ${BACKUP_S3_PATH:-} | ||
| AWS_ACCESS_KEY_ID: ${BACKUP_S3_ACCESS_KEY_ID:-} | ||
| AWS_SECRET_ACCESS_KEY: ${BACKUP_S3_SECRET_ACCESS_KEY:-} | ||
| AWS_ENDPOINT: ${BACKUP_S3_ENDPOINT:-s3.amazonaws.com} | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock:ro | ||
| - mongodb-dump:/backup/mongodb-dump:ro | ||
| - api-data:/backup/api-data:ro | ||
| - ./extensions/backup/archive:/archive | ||
|
|
||
| volumes: | ||
| mongodb-dump: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # disable nginx file upload limit which is per default `1m` | ||
|
danielesser marked this conversation as resolved.
|
||
| # https://nginx.org/en/docs/http/ngx_http_core_module.html | ||
| client_max_body_size 0; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # NodePit Runner — nginx extension | ||
| # | ||
| # Adds an HTTPS reverse proxy (nginx-proxy) in front of the web/api services, | ||
| # with automatic Let's Encrypt certificates via acme-companion. | ||
| # | ||
| # Requires DOMAIN and LETSENCRYPT_EMAIL to be set in .env (see | ||
| # .env.example), and a DNS entry pointing DOMAIN at this server. Also set | ||
| # WEB_BASE_URL=https://<DOMAIN> in .env so links generated by Runner use the | ||
| # public HTTPS URL. | ||
| # | ||
| # Usage: | ||
| # docker compose -f docker-compose.yml -f extensions/nginx/docker-compose.yml up -d | ||
|
|
||
| services: | ||
| web: | ||
| environment: | ||
| VIRTUAL_HOST: ${DOMAIN:?Set DOMAIN in .env before using the nginx extension — see .env.example} | ||
| LETSENCRYPT_HOST: ${DOMAIN:?Set DOMAIN in .env before using the nginx extension — see .env.example} | ||
| LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:?Set LETSENCRYPT_EMAIL in .env before using the nginx extension — see .env.example} | ||
|
|
||
| nginx-proxy: | ||
| image: nginxproxy/nginx-proxy:1.11.5 | ||
| restart: unless-stopped | ||
| ports: | ||
| - 80:80 | ||
| - 443:443 | ||
| volumes: | ||
| - certs:/etc/nginx/certs | ||
| - vhost:/etc/nginx/vhost.d | ||
| - html:/usr/share/nginx/html | ||
| - /var/run/docker.sock:/tmp/docker.sock:ro | ||
| - ./extensions/nginx/conf.d:/etc/nginx/conf.d | ||
| labels: | ||
| - com.github.nginx-proxy.nginx=true | ||
|
|
||
| acme-companion: | ||
| image: nginxproxy/acme-companion:2.8.1 | ||
| restart: unless-stopped | ||
| volumes: | ||
| - certs:/etc/nginx/certs | ||
| - vhost:/etc/nginx/vhost.d | ||
| - html:/usr/share/nginx/html | ||
| - acme:/etc/acme.sh | ||
| - /var/run/docker.sock:/var/run/docker.sock:ro | ||
|
|
||
| volumes: | ||
| certs: | ||
| vhost: | ||
| html: | ||
| acme: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # NodePit Runner — portainer extension | ||
| # | ||
| # Adds Portainer CE, a web UI for managing the Docker stack (start/stop | ||
| # containers, view logs, inspect resource usage) without needing the CLI. | ||
| # On first visit, it asks you to create an admin account. | ||
| # | ||
| # Bound to 127.0.0.1 only — with the Docker socket mounted, anyone who can | ||
| # log in has root-equivalent access to the host, so it's not exposed | ||
| # publicly by default. On a remote host, reach it via an SSH tunnel: | ||
| # ssh -L 9000:localhost:9000 user@host | ||
| # The nginx extension doesn't proxy Portainer, only web/api — combining | ||
| # the two requires extending extensions/nginx yourself. | ||
| # | ||
| # Usage: | ||
| # docker compose -f docker-compose.yml -f extensions/portainer/docker-compose.yml up -d | ||
| # Open http://localhost:9000 | ||
|
|
||
| services: | ||
| portainer: | ||
| image: portainer/portainer-ce:2.39.5 | ||
| restart: unless-stopped | ||
| ports: | ||
| - 127.0.0.1:9000:9000 | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
| - portainer-data:/data | ||
|
|
||
| volumes: | ||
| portainer-data: |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.