basic setup

This commit is contained in:
brooke 2025-06-07 16:16:38 -04:00
parent d3350339ba
commit 4115774d98
2 changed files with 57 additions and 23 deletions

View File

@ -1,35 +1,52 @@
---
services:
app:
image: nginx:1.27.5
image: data.forgejo.org/forgejo/runner:4.0.0
networks:
- proxy
- internal
environment:
DOCKER_HOST: tcp://dind:2375
deploy:
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
## Redirect HTTP to HTTPS
# - "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.scheme=https"
# - "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.permanent=true"
## When you're ready for release, run "abra recipe sync <name>" to set this
- "coop-cloud.${STACK_NAME}.version="
## Enable backups: https://docs.coopcloud.tech/maintainers/handbook/#how-do-i-configure-backuprestore
# - "backupbot.backup=true"
# - "backupbot.backup.path=/some/path"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
entrypoint: /custom-entrypoint.sh
configs:
- source: entrypoint
target: /custom-entrypoint.sh
mode: 0555
volumes:
- data:/data
secrets:
- act_runner_instance
- act_runner_token
dind:
image: docker:dind
privileged: 'true'
command: ['dockerd', '-H', 'tcp://0.0.0.0:2375', '--tls=false']
deploy:
restart_policy:
condition: on-failure
networks:
- internal
networks:
proxy:
internal:
volumes:
data:
secrets:
act_runner_instance:
external: true
name: ${STACK_NAME}_act_runner_instance_${SECRET_ACT_RUNNER_INSTANCE_VERSION}
act_runner_token:
external: true
name: ${STACK_NAME}_act_runner_token_${SECRET_ACT_RUNNER_TOKEN_VERSION}
configs:
entrypoint:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: entrypoint.sh

17
entrypoint.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
# Read instance and token from Docker secrets
INSTANCE=$(cat /run/secrets/act_runner_instance)
TOKEN=$(cat /run/secrets/act_runner_token)
# Check if .runner file exists
if [ ! -f .runner ]; then
echo "No .runner file exists. Running registration..."
forgejo-runner register --instance "${INSTANCE}" --token "${TOKEN}" --no-interactive
else
echo ".runner file exists. Skipping registration."
fi
# Run forgejo-runner daemon
exec forgejo-runner daemon