diff --git a/nginx/.env.example b/nginx/.env.example index d63211e..81e3e0d 100644 --- a/nginx/.env.example +++ b/nginx/.env.example @@ -63,3 +63,9 @@ GITEA_HOST=gitea_app_1 PODGRAB_DOMAIN= ### Hostname PODGRAB_HOST=podgrab_app_1 + +## Woodpecker +### Domain name +WOODPECKER_DOMAIN= +### Hostname +WOODPECKER_HOST=woodpecker_app_1 diff --git a/nginx/sites-available/woodpecker.conf.template b/nginx/sites-available/woodpecker.conf.template new file mode 100644 index 0000000..af0f386 --- /dev/null +++ b/nginx/sites-available/woodpecker.conf.template @@ -0,0 +1,22 @@ +server { + # SSL Key locations + ssl_certificate /etc/letsencrypt/live/${WOODPECKER_DOMAIN}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/${WOODPECKER_DOMAIN}/privkey.pem; + + listen ${HTTPS_PORT} ssl; + listen [::]:${HTTPS_PORT} ssl; + server_name ${WOODPECKER_DOMAIN}; + + location / { + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + + proxy_pass http://${WOODPECKER_HOST}:8000; + proxy_redirect off; + proxy_http_version 1.1; + proxy_buffering off; + + chunked_transfer_encoding off; + } +} diff --git a/woodpecker/.env.example b/woodpecker/.env.example new file mode 100644 index 0000000..0bc284b --- /dev/null +++ b/woodpecker/.env.example @@ -0,0 +1,16 @@ +# Allow all users to use it +DRONE_OPEN=true +# Drone needs to know its own location +DRONE_HOST= +# The same, but without the https in front of it +DRONE_SERVER= +# Shared secret to communicate with agents +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_URL= diff --git a/woodpecker/docker-compose.yml b/woodpecker/docker-compose.yml new file mode 100644 index 0000000..a0d3405 --- /dev/null +++ b/woodpecker/docker-compose.yml @@ -0,0 +1,67 @@ +version: '2.4' + +services: + # The main drone instance + app: + # Latest version as of writing this document + image: 'laszlocloud/woodpecker-server:v0.13.0' + restart: 'always' + + depends_on: + db: + condition: 'service_healthy' + + env_file: + - '.env' + networks: + - 'default' + - 'nginx' + ports: + # Used to communicate with the agents (I think) + - '9000:9000' + 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-agent:v0.13.0' + restart: 'always' + command: 'agent' + + depends_on: + app: + condition: 'service_started' + + environment: + - 'DRONE_SERVER=${DRONE_SERVER}' + - 'DRONE_SECRET=${DRONE_SECRET}' + volumes: + - '/var/run/docker.sock:/var/run/docker.sock' + +networks: + nginx: + external: true + +volumes: + db-data: + server-data: