commit b2000af0b12ebafd24c8daf86f12931868926b30 Author: Nick Dumas Date: Mon Jan 30 23:57:18 2023 +0000 Initial commit: working drone installation diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose/drone.yml b/docker-compose/drone.yml new file mode 100644 index 0000000..d1b5caf --- /dev/null +++ b/docker-compose/drone.yml @@ -0,0 +1,55 @@ +version: '3.6' +services: + drone: + container_name: drone + image: drone/drone:${DRONE_VERSION:-1.6.4} + restart: unless-stopped + environment: + # https://docs.drone.io/server/provider/gitea/ + - DRONE_DATABASE_DRIVER=sqlite3 + - DRONE_DATABASE_DATASOURCE=/data/database.sqlite + - DRONE_GITEA_SERVER=https://code.ndumas.com + - DRONE_GIT_ALWAYS_AUTH=false + - DRONE_RPC_SECRET=${DRONE_RPC_SECRET} + - DRONE_SERVER_PROTO=https + - DRONE_SERVER_HOST=drone.ndumas.com + - DRONE_TLS_AUTOCERT=false + - DRONE_USER_CREATE=${DRONE_USER_CREATE} + - DRONE_GITEA_CLIENT_ID=${DRONE_GITEA_CLIENT_ID} + - DRONE_GITEA_CLIENT_SECRET=${DRONE_GITEA_CLIENT_SECRET} + ports: + - "3001:80" + - "3002:443" + networks: + - cicd_net + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./drone:/data:z + + drone-runner: + container_name: drone-runner + image: drone/drone-runner-docker:${DRONE_RUNNER_VERSION:-1} + restart: unless-stopped + depends_on: + - drone + environment: + # https://docs.drone.io/runner/docker/installation/linux/ + # https://docs.drone.io/server/metrics/ + - DRONE_RPC_PROTO=https + - DRONE_RPC_HOST=drone.ndumas.com + - DRONE_RPC_SECRET=${DRONE_RPC_SECRET} + - DRONE_RUNNER_NAME="${HOSTNAME}-runner" + - DRONE_RUNNER_CAPACITY=2 + - DRONE_RUNNER_NETWORKS=cicd_net + - DRONE_DEBUG=false + - DRONE_TRACE=false + ports: + - "3000:3000" + networks: + - cicd_net + volumes: + - /var/run/docker.sock:/var/run/docker.sock + +networks: + cicd_net: + name: cicd_net diff --git a/drone.sh b/drone.sh new file mode 100755 index 0000000..5a1d91b --- /dev/null +++ b/drone.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +export HOSTNAME=$(hostname) +export DRONE_VERSION=2.16.0 +export DRONE_RUNNER_VERSION=1.8.3 +export GITEA_ADMIN_USER="admin" +export DRONE_RPC_SECRET="$(echo ${HOSTNAME} | openssl dgst -md5 -hex)" +export DRONE_USER_CREATE="username:${GITEA_ADMIN_USER},machine:false,admin:true,token:${DRONE_RPC_SECRET}" +docker-compose -f docker-compose/drone.yml up -d