diff --git a/woodpecker/docker-compose.yml b/woodpecker/docker-compose.yml new file mode 100644 index 0000000..b7f2211 --- /dev/null +++ b/woodpecker/docker-compose.yml @@ -0,0 +1,83 @@ +version: '2.4' + +services: + # The main drone instance + app: + # Latest version as of writing this document + image: 'laszlocloud/woodpecker-server:v0.12.0' + restart: 'always' + + depends_on: + db: + condition: 'service_healthy' + healthcheck: + test: 'curl -f http://localhost:8000/ || exit 1' + interval: '30s' + retries: 3 + timeout: '5s' + start_period: '10s' + + environment: + # Allow all Gitea users to use it + - 'DRONE_OPEN=true' + # Drone needs to know its own location + - 'DRONE_HOST=${DRONE_HOST}' + # Shared secret to communicate with agents + - 'DRONE_SECRET=${DRONE_SECRET}' + # Tell Drone to use postgres + - 'DRONE_DATABASE_DRIVER=postgres' + - 'DRONE_DATABASE_DATASOURCE=postgres://woodpecker:woodpecker@db:5432/woodpecker?sslmode=disable' + + # These are just a guess based on the documentation + - 'DRONE_GITEA=true' + - 'DRONE_GITEA_CLIENT=${GITEA_CLIENT}' + - 'DRONE_GITEA_SECRET=${GITEA_SECRET}' + networks: + - 'default' + - 'nginx' + ports: + # Used to communicate with the agents (I think) + - '9000:9000' + # Also needs port 8000 for web UI (so proxy_pass to 8000) + volumes: + - 'server-data:/var/lib/drone' + + # Database for the server + db: + image: 'postgres:13.2-alpine' + restart: 'always' + + healthcheck: + test: 'pg_isready -U woodpecker' + interval: '30s' + timeout: '5s' + retries: 3 + start_period: '0s' + + environment: + - 'POSTGRES_DB=woodpecker' + - 'POSTGRES_USER=woodpecker' + - 'POSTGRES_PASSWORD=woodpecker' + + volumes: + - 'db-data:/var/lib/postgresql/data' + + # We can deploy more agents by using the scale command + # Each agent can do one parallel build by default + agent: + image: 'laszlocloud/woodpecker-server:v0.12.0' + restart: 'always' + command: 'agent' + + depends_on: + - 'app' + + environment: + - 'DRONE_SERVER=${DRONE_HOST}' + - 'DRONE_SECRET=${DRONE_SECRET}' + volumes: + - '/var/run/docker.sock:/var/run/docker.sock' + +volumes: + db-data: + server-data: