Drone CI server and Drone Docker runner. (#34)
All checks were successful
continuous-integration/drone/push Build is passing

Drone CI server and Drone Docker runner.

Closes #27.

Reviewed-on: #34
This commit is contained in:
Alexey Skobkin 2022-03-29 17:23:14 +03:00
parent 233bd0b700
commit 49419eab8f
9 changed files with 145 additions and 0 deletions

10
.drone.yml Normal file
View file

@ -0,0 +1,10 @@
kind: pipeline
type: docker
name: default
steps:
- name: validate
image: 'docker/compose:1.29.2'
commands:
- for DIR in */ ; do if [[ $(expr match "$DIR" "_.*") != 0 ]] ; then echo "SKIPPING $DIR" && continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done
- for DIR in */ ; do if [[ $(expr match "$DIR" "_.*") != 0 ]] ; then echo "SKIPPING $DIR" && continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done

View file

@ -1,3 +1,5 @@
[![Build Status](https://ci.skobk.in/api/badges/skobkin/docker-stacks/status.svg)](https://ci.skobk.in/skobkin/docker-stacks)
# Docker Compose config collection
## How to set up?
@ -33,6 +35,8 @@ Not every stack is tested to fully work.
| App Name | Status | Image | Description | Links |
|-------------------------|--------------|----------------------------------------------|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ARK Server | ✅ | `thmhoag/arkserver` | ARK: Survival Evolved game server with ArkManager. | [Website](http://playark.com), [Steam](https://store.steampowered.com/app/346110/ARK_Survival_Evolved/), [Image Github](https://github.com/thmhoag/arkserver), [ArkManager](https://github.com/arkmanager/ark-server-tools) |
| Drone | ✅ | `drone/drone` | Continuous integration platform. | [Website](https://www.drone.io), [Github](https://github.com/harness/drone), [Image](https://hub.docker.com/r/drone/drone) |
| Drone Docker Runner | ✅ | `drone/drone-runner-docker` | CI runner daemon for Docker. | [Website](https://www.drone.io), [Github](https://github.com/drone-runners/drone-runner-docker), [Image](https://hub.docker.com/r/drone/drone-runner-docker) |
| Duplicati | ✅ | `linuxserver/duplicati` | Backup solution with many storage backends. | [Website](https://www.duplicati.com), [Github](https://github.com/duplicati/duplicati) |
| Element-web | ✅ | `vectorim/element-web` | Web Matrix client. | [Website](https://element.io), [Github](https://github.com/vector-im/element-web/) |
| emby | ✅ | `emby/embyserver` | Media server with online transcoding support. | [Website](https://emby.media) |

18
drone-runner/.env.dist Normal file
View file

@ -0,0 +1,18 @@
# see https://hub.docker.com/r/drone/drone-runner-docker
IMAGE_VERSION=1
WEBUI_BIND_ADDR=127.0.0.1
WEBUI_BIND_PORT=8387
# Drone settings
# https://docs.drone.io/runner/docker/installation/linux/
DRONE_RPC_PROTO=https
DRONE_RPC_HOST=drone.domain.tld
DRONE_RPC_SECRET=super-duper-secret
DRONE_RUNNER_CAPACITY=2
DRONE_RUNNER_NAME=runner-name
# Service settings
LOG_MAX_SIZE=5m
LOG_MAX_FILE=5

View file

@ -0,0 +1,21 @@
# https://hub.docker.com/r/drone/drone-runner-docker
version: '3.7'
services:
drone-runner:
image: "drone/drone-runner-docker:${IMAGE_VERSION:-1}"
container_name: drone-runner
volumes:
# Mounting Docker socket inside the container to control temporary Docker containers from runner.
- "/var/run/docker.sock:/var/run/docker.sock"
ports:
# Optional, used for dashboard:
# https://discourse.drone.io/t/drone-agent-port/5914/5
- "${WEBUI_BIND_ADDR:-127.0.0.1}:${WEBUI_BIND_PORT:-8387}:3000"
env_file: .env
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "${LOG_MAX_SIZE:-5m}"
max-file: "${LOG_MAX_FILE:-5}"

View file

@ -0,0 +1,19 @@
server {
listen 80;
server_name drone-runner.domain.tld;
#charset utf-8;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass http://127.0.0.1:8387/;
}
}

30
drone/.env.dist Normal file
View file

@ -0,0 +1,30 @@
# see https://hub.docker.com/r/drone/drone
IMAGE_VERSION=2
HOST_DATA_DIR=./data
WEBUI_BIND_ADDR=127.0.0.1
WEBUI_BIND_PORT=8386
# Drone settings
# https://docs.drone.io/server/reference/
DRONE_GITEA_SERVER=https://gitea.domain.tld
DRONE_GITEA_CLIENT_ID=xxx
DRONE_GITEA_CLIENT_SECRET=yyy
DRONE_RPC_SECRET=super-duper-secret
DRONE_SERVER_HOST=drone.domain.tld
DRONE_SERVER_PROTO=https
#DRONE_DATABASE_DRIVER=mysql
#DRONE_DATABASE_DRIVER=postgres
DRONE_DATABASE_DRIVER=sqlite3
#DRONE_DATABASE_DATASOURCE=root:password@tcp(1.2.3.4:3306)/drone?parseTime=true
#DRONE_DATABASE_DATASOURCE=postgres://root:password@1.2.3.4:5432/postgres?sslmode=disable
DRONE_DATABASE_DATASOURCE=/data/database.sqlite
# Optional string value. Configures the secret key used to encrypt secrets in the database.
# Encryption is disabled by default and must be configured before the system is first used.
#DRONE_DATABASE_SECRET=zzz
# Service settings
LOG_MAX_SIZE=5m
LOG_MAX_FILE=5

2
drone/data/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/*
!/.gitignore

22
drone/docker-compose.yml Normal file
View file

@ -0,0 +1,22 @@
# https://hub.docker.com/r/drone/drone
version: '3.7'
services:
drone:
image: "drone/drone:${IMAGE_VERSION:-2}"
container_name: drone
hostname: drone
extra_hosts:
# Not necessary, but allows to access to local database if chosen over SQLite.
- "host.docker.internal:host-gateway"
volumes:
- "${HOST_DATA_DIR:-./data}:/data"
ports:
- "${WEBUI_BIND_ADDR:-127.0.0.1}:${WEBUI_BIND_PORT:-8386}:80"
env_file: .env
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "${LOG_MAX_SIZE:-5m}"
max-file: "${LOG_MAX_FILE:-5}"

19
drone/nginx/drone.conf Normal file
View file

@ -0,0 +1,19 @@
server {
listen 80;
server_name drone.domain.tld;
#charset utf-8;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass http://127.0.0.1:8386/;
}
}