Initial import

This commit is contained in:
Glenn Y. Rolland 2022-08-18 20:29:48 +02:00
commit 63f5586d52
4 changed files with 145 additions and 0 deletions

5
Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM drone/drone-runner-docker:1.8.2
COPY entrypoint-wrapper.sh /usr/bin/entrypoint-wrapper
# ENTRYPOINT ["/usr/bin/entrypoint-wrapper"]

44
README.md Normal file
View file

@ -0,0 +1,44 @@
# Drone Server
## Setup on Dokku
Create APP
dokku apps:create cicd
Setup Network & Domains
dokku network:create cicd_net
dokku network:set cicd initial-network cicd_net
dokku config:set --no-restart cicd DOKKU_LETSENCRYPT_EMAIL=username@example.com
Setup Database
dokku postgres:create cicd
dokku postgres:link cicd cicd
Setup Volumes
dokku storage:mount cicd /home/data/cicd.drone:/data
Setup Configuration
dokku config:set cicd DRONE_DATABASE_DRIVER=postgres
dokku config:set cicd DRONE_GIT_ALWAYS_AUTH=false
dokku config:set cicd DRONE_GITEA_SERVER=https://gitea.example.com
dokku config:set cicd DRONE_SERVER_HOST=cicd.example.com
dokku config:set cicd DRONE_SERVER_PROTO=https
dokku config:set cicd DRONE_TLS_AUTOCERT=false
Setup Secrets
dokku config:set cicd DRONE_COOKIE_SECRET=$(openssl rand -hex 16)
dokku config:set cicd DRONE_RPC_SECRET=$(openssl rand -hex 16)
dokku config:set cicd DRONE_GITEA_CLIENT_ID=FIXME
dokku config:set cicd DRONE_GITEA_CLIENT_SECRET=FIXME
Deploy
git remote add dokku dokku@dinlas.apps.glenux.net:cicd
git push

88
docker-compose.yml Normal file
View file

@ -0,0 +1,88 @@
---
version: '3.6'
# References
# * https://www.alexhyett.com/drone-ci-raspberry-pi
services:
# gitea:
# container_name: gitea
# image: gitea/gitea:${GITEA_VERSION:-1.10.6}
# restart: unless-stopped
# environment:
# # https://docs.gitea.io/en-us/install-with-docker/#environments-variables
# - APP_NAME="Gitea"
# - USER_UID=1000
# - USER_GID=1000
# - RUN_MODE=prod
# - DOMAIN=${IP_ADDRESS}
# - SSH_DOMAIN=${IP_ADDRESS}
# - HTTP_PORT=3000
# - ROOT_URL=http://${IP_ADDRESS}:3000
# - SSH_PORT=222
# - SSH_LISTEN_PORT=22
# - DB_TYPE=sqlite3
# ports:
# - "3000:3000"
# - "222:22"
# networks:
# - cicd_net
# volumes:
# - ./gitea:/data
drone:
container_name: drone
image: "drone/drone:${DRONE_VERSION:-2.12.1}"
restart: unless-stopped
depends_on: []
environment:
# https://docs.drone.io/server/provider/gitea/
- DRONE_DATABASE_DRIVER=sqlite3
- DRONE_DATABASE_DATASOURCE=/data/database.sqlite
- DRONE_GIT_ALWAYS_AUTH="false"
- DRONE_RPC_SECRET="${DRONE_RPC_SECRET}"
- DRONE_SERVER_PROTO=http
- DRONE_SERVER_HOST="${IP_ADDRESS}:3001"
- DRONE_TLS_AUTOCERT="false"
- DRONE_USER_CREATE="${DRONE_USER_CREATE}"
# DRONE_GITEA_SERVER: "http://${IP_ADDRESS}:3000/"
# DRONE_GITEA_CLIENT_ID: "${DRONE_GITEA_CLIENT_ID}"
# DRONE_GITEA_CLIENT_SECRET: "${DRONE_GITEA_CLIENT_SECRET}"
ports:
- "3001:80"
- "9001:9000"
networks:
- cicd_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./drone:/data
drone-runner:
container_name: drone-runner
image: drone/drone-runner-docker:${DRONE_RUNNER_VERSION:-1.8.2}
restart: unless-stopped
depends_on:
- drone
environment:
# https://docs.drone.io/runner/docker/installation/linux/
# https://docs.drone.io/server/metrics/
DRONE_RPC_PROTO: http
DRONE_RPC_HOST: drone
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:
- "3002:3000"
networks:
- cicd_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
cicd_net:
name: cicd_net
#

8
entrypoint-wrapper.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
echo "# Entrypoint Wrapper"
echo "- Setting DRONE_DATABASE_DATASOURCE from DATABASE_URL"
DRONE_DATABASE_DATASOURCE="${DATABASE_URL}"
export DRONE_DATABASE_DATASOURCE
exec /bin/drone-server "$@"