deployment/stacks/woodpecker.yml

100 lines
2.5 KiB
YAML

version: '3.4'
services:
app:
image: 'woodpeckerci/woodpecker-server:next'
deploy:
mode: 'replicated'
replicas: 1
placement:
constraints:
- 'node.labels.class==admin'
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.woodpecker.rule=Host(`ci.rustybever.be`)'
- 'traefik.http.routers.woodpecker.tls=true'
- 'traefik.http.routers.woodpecker.tls.certresolver=letsEncrypt'
- 'traefik.http.services.woodpecker.loadbalancer.server.port=8000'
environment:
- 'WOODPECKER_OPEN=true'
- 'WOODPECKER_ADMIN=Chewing_Bever'
- 'WOODPECKER_HOST=https://ci.rustybever.be'
- 'WOODPECKER_DATABASE_DRIVER=postgres'
- 'WOODPECKER_DATABASE_DATASOURCE=postgres://woodpecker:woodpecker@db:5432/woodpecker?sslmode=disable'
- 'WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}'
- 'WOODPECKER_GITEA=true'
- 'WOODPECKER_GITEA_URL=https://git.rustybever.be'
- 'WOODPECKER_GITEA_CLIENT=${WOODPECKER_GITEA_CLIENT}'
- 'WOODPECKER_GITEA_SECRET=${WOODPECKER_GITEA_SECRET}'
networks:
- default
- public
ports:
# Used for external agents to connect
- 9000:9000
db:
image: 'postgres:14.1-alpine'
deploy:
mode: 'replicated'
replicas: 1
placement:
constraints:
- 'node.labels.class==admin'
healthcheck:
test: pg_isready -U woodpecker -d woodpecker
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
environment:
- 'POSTGRES_USER=woodpecker'
- 'POSTGRES_PASSWORD=woodpecker'
- 'POSTGRES_DB=woodpecker'
volumes:
- 'db-data:/var/lib/postgresql/data'
agent-1:
image: 'woodpeckerci/woodpecker-agent:latest'
command: agent
deploy:
mode: 'global'
placement:
constraints:
- 'node.hostname==gamma'
environment:
- 'WOODPECKER_SERVER=app:9000'
- 'WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
agent-2:
image: 'woodpeckerci/woodpecker-agent:latest'
command: agent
deploy:
mode: 'global'
placement:
constraints:
- 'node.hostname==alpha'
environment:
- 'WOODPECKER_SERVER=app:9000'
- 'WOODPECKER_AGENT_SECRET=${WOODPECKER_AGENT_SECRET}'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
public:
external: true
volumes:
db-data: