From 0167c5d8eb8431e6a86d36851791d3d8d5a37bd6 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 15:57:44 +0300 Subject: [PATCH 01/13] drone. draft. --- drone/.env.dist | 30 ++++++++++++++++++++++++++++++ drone/data/.gitignore | 2 ++ drone/docker-compose.yml | 19 +++++++++++++++++++ drone/nginx/drone.conf | 19 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 drone/.env.dist create mode 100644 drone/data/.gitignore create mode 100644 drone/docker-compose.yml create mode 100644 drone/nginx/drone.conf diff --git a/drone/.env.dist b/drone/.env.dist new file mode 100644 index 0000000..6f32896 --- /dev/null +++ b/drone/.env.dist @@ -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 \ No newline at end of file diff --git a/drone/data/.gitignore b/drone/data/.gitignore new file mode 100644 index 0000000..a68d087 --- /dev/null +++ b/drone/data/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore diff --git a/drone/docker-compose.yml b/drone/docker-compose.yml new file mode 100644 index 0000000..6466b25 --- /dev/null +++ b/drone/docker-compose.yml @@ -0,0 +1,19 @@ +# https://hub.docker.com/r/drone/drone +version: '3.7' + +services: + drone: + image: "drone/drone:${IMAGE_VERSION:-2}" + container_name: drone + hostname: drone + 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}" diff --git a/drone/nginx/drone.conf b/drone/nginx/drone.conf new file mode 100644 index 0000000..fb8dce3 --- /dev/null +++ b/drone/nginx/drone.conf @@ -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/; + } +} \ No newline at end of file -- 2.40.1 From 0ac705229b5ddf1beb40343c92f9bc87069370c8 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 15:58:00 +0300 Subject: [PATCH 02/13] drone-runner. draft. --- drone-runner/.env.dist | 18 ++++++++++++++++++ drone-runner/docker-compose.yml | 18 ++++++++++++++++++ drone-runner/nginx/drone-runner.conf | 19 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 drone-runner/.env.dist create mode 100644 drone-runner/docker-compose.yml create mode 100644 drone-runner/nginx/drone-runner.conf diff --git a/drone-runner/.env.dist b/drone-runner/.env.dist new file mode 100644 index 0000000..9dfdd71 --- /dev/null +++ b/drone-runner/.env.dist @@ -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=3000 + +# 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 diff --git a/drone-runner/docker-compose.yml b/drone-runner/docker-compose.yml new file mode 100644 index 0000000..97dc984 --- /dev/null +++ b/drone-runner/docker-compose.yml @@ -0,0 +1,18 @@ +# 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: + - "${HOST_DATA_DIR:-./data}:/data" + ports: + - "${WEBUI_BIND_ADDR:-127.0.0.1}:${WEBUI_BIND_PORT:-3000}:3000" + env_file: .env + restart: unless-stopped + logging: + driver: "json-file" + options: + max-size: "${LOG_MAX_SIZE:-5m}" + max-file: "${LOG_MAX_FILE:-5}" diff --git a/drone-runner/nginx/drone-runner.conf b/drone-runner/nginx/drone-runner.conf new file mode 100644 index 0000000..12f6662 --- /dev/null +++ b/drone-runner/nginx/drone-runner.conf @@ -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:3000/; + } +} -- 2.40.1 From 3b2fba1309ab119b122563a201952a20da9939d2 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:06:34 +0300 Subject: [PATCH 03/13] drone. drone-runner. README.md status. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7d11915..20e3d8e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,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 | Not tested | `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 | Not tested | `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) | -- 2.40.1 From b671d984d05a4b5d2147a757446c1609968195cd Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:15:36 +0300 Subject: [PATCH 04/13] drone. Adding host mapping for host.docker.internal. --- drone/docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drone/docker-compose.yml b/drone/docker-compose.yml index 6466b25..e8886ba 100644 --- a/drone/docker-compose.yml +++ b/drone/docker-compose.yml @@ -6,6 +6,9 @@ services: 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: -- 2.40.1 From 9b3ccd284eaf13cd46b521de7fa58218f8808ab7 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:17:57 +0300 Subject: [PATCH 05/13] drone. Comment for port mapping. --- drone-runner/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drone-runner/docker-compose.yml b/drone-runner/docker-compose.yml index 97dc984..a59134b 100644 --- a/drone-runner/docker-compose.yml +++ b/drone-runner/docker-compose.yml @@ -8,6 +8,8 @@ services: volumes: - "${HOST_DATA_DIR:-./data}:/data" 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:-3000}:3000" env_file: .env restart: unless-stopped -- 2.40.1 From b1988747cdab77754bcf2f62dd4d06256e29a6e4 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:31:55 +0300 Subject: [PATCH 06/13] drone-runner. Adding missing Docker socket mount. --- drone-runner/docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drone-runner/docker-compose.yml b/drone-runner/docker-compose.yml index a59134b..697d4da 100644 --- a/drone-runner/docker-compose.yml +++ b/drone-runner/docker-compose.yml @@ -6,7 +6,8 @@ services: image: "drone/drone-runner-docker:${IMAGE_VERSION:-1}" container_name: drone-runner volumes: - - "${HOST_DATA_DIR:-./data}:/data" + # 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 -- 2.40.1 From 8720253e7875a1a436163c7f9f644087d0df8099 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:33:58 +0300 Subject: [PATCH 07/13] drone-runner. Changing port number to avoid conflict with Gitea. --- drone-runner/.env.dist | 2 +- drone-runner/docker-compose.yml | 2 +- drone-runner/nginx/drone-runner.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drone-runner/.env.dist b/drone-runner/.env.dist index 9dfdd71..5d80b5e 100644 --- a/drone-runner/.env.dist +++ b/drone-runner/.env.dist @@ -2,7 +2,7 @@ IMAGE_VERSION=1 WEBUI_BIND_ADDR=127.0.0.1 -WEBUI_BIND_PORT=3000 +WEBUI_BIND_PORT=8387 # Drone settings # https://docs.drone.io/runner/docker/installation/linux/ diff --git a/drone-runner/docker-compose.yml b/drone-runner/docker-compose.yml index 697d4da..6ba1970 100644 --- a/drone-runner/docker-compose.yml +++ b/drone-runner/docker-compose.yml @@ -11,7 +11,7 @@ services: 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:-3000}:3000" + - "${WEBUI_BIND_ADDR:-127.0.0.1}:${WEBUI_BIND_PORT:-8387}:3000" env_file: .env restart: unless-stopped logging: diff --git a/drone-runner/nginx/drone-runner.conf b/drone-runner/nginx/drone-runner.conf index 12f6662..793b943 100644 --- a/drone-runner/nginx/drone-runner.conf +++ b/drone-runner/nginx/drone-runner.conf @@ -14,6 +14,6 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; - proxy_pass http://127.0.0.1:3000/; + proxy_pass http://127.0.0.1:8387/; } } -- 2.40.1 From b4d565a4543f9a02df2553e4590f732d99c941d3 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:51:14 +0300 Subject: [PATCH 08/13] drone. Adding .drone.yml CI configuration and build badge to README.md. --- .drone.yml | 10 ++++++++++ README.md | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..21cbdc3 --- /dev/null +++ b/.drone.yml @@ -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 [[ $DIR == _* ]] ; then continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done + - for DIR in */ ; do if [[ $DIR == _* ]] ; then continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done diff --git a/README.md b/README.md index 20e3d8e..22a011d 100644 --- a/README.md +++ b/README.md @@ -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? -- 2.40.1 From d98394ca256785e83225d0b0ef55399d9f789070 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:55:28 +0300 Subject: [PATCH 09/13] drone. Trying regex approach in .drone.yml. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 21cbdc3..fb900aa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,5 +6,5 @@ steps: - name: validate image: 'docker/compose:1.29.2' commands: - - for DIR in */ ; do if [[ $DIR == _* ]] ; then continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done - - for DIR in */ ; do if [[ $DIR == _* ]] ; then continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done + - for DIR in */ ; do if [[ $DIR =~ ^_ ]] ; then continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done + - for DIR in */ ; do if [[ $DIR =~ ^_ ]] ; then continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done -- 2.40.1 From 54b8827980fe858f716a05a050168ef8fa335908 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 16:58:26 +0300 Subject: [PATCH 10/13] drone. Trying $(expr) regex approach in .drone.yml. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index fb900aa..f184779 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,5 +6,5 @@ steps: - name: validate image: 'docker/compose:1.29.2' commands: - - for DIR in */ ; do if [[ $DIR =~ ^_ ]] ; then continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done - - for DIR in */ ; do if [[ $DIR =~ ^_ ]] ; then continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done + - for DIR in */ ; do if [[ $(expr match "$DIR" '^_') != 0 ]] ; then continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done + - for DIR in */ ; do if [[ $(expr match "$DIR" '^_') != 0 ]] ; then continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done -- 2.40.1 From e0af7b5909247b38ecc4378f83bc7fdf02fc9e84 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 17:00:52 +0300 Subject: [PATCH 11/13] drone. More verbose output for directory test in .drone.yml. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index f184779..ff21030 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,5 +6,5 @@ steps: - name: validate image: 'docker/compose:1.29.2' commands: - - for DIR in */ ; do if [[ $(expr match "$DIR" '^_') != 0 ]] ; then continue; fi && test -f $DIR/.env.dist && cp $DIR/.env.dist $DIR/.env ; done - - for DIR in */ ; do if [[ $(expr match "$DIR" '^_') != 0 ]] ; then continue; fi && echo $DIR && cd $DIR && docker-compose config && cd .. ; done + - 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 -- 2.40.1 From 67d6fb23f84e3368e1fde949f15a30778d8beee2 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 17:04:17 +0300 Subject: [PATCH 12/13] drone. Removing '^' anchor from regular expression. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index ff21030..e953834 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,5 +6,5 @@ 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 + - 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 -- 2.40.1 From 4718c5ea5fcadd37d4a7695cbfa6187a744923eb Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Mar 2022 17:13:50 +0300 Subject: [PATCH 13/13] drone. drone-runner. Marking as tested. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22a011d..3883f61 100644 --- a/README.md +++ b/README.md @@ -35,8 +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 | Not tested | `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 | Not tested | `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) | +| 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) | -- 2.40.1