From 3823fe7a8527f2f71a0591582d79a4a035de00e5 Mon Sep 17 00:00:00 2001 From: mr-vercetti <87.milewski@gmail.com> Date: Sat, 19 Nov 2022 20:50:04 +0100 Subject: [PATCH] Add gitea and drone --- README.md | 4 ++ docker/.env.example | 21 +++++++ docker/stacks/softdev/softdev.yml | 94 +++++++++++++++++++++++++++++++ docker/stacks/swag/swag.yml | 6 +- 4 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 docker/stacks/softdev/softdev.yml diff --git a/README.md b/README.md index e161aea..629054c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,10 @@ All services are deployed using Docker compose and are run as a non-root user. * [Redis](https://github.com/docker-library/redis) - cache service * [MariaDB](https://github.com/linuxserver/docker-mariadb) - database +### Software development +* [Gitea](https://github.com/go-gitea/gitea) - git web service +* [Drone](https://github.com/harness/drone) - ci/cd + ### Other * [Bitwarden](https://github.com/dani-garcia/vaultwarden) - the best password manager * [Wireguard](https://github.com/linuxserver/docker-wireguard) - VPN server diff --git a/docker/.env.example b/docker/.env.example index 8244bcb..a32ede5 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -37,3 +37,24 @@ DUPLICATI_UID= DUPLICATI_GID= BACKUP_SOURCE_DIR= BACKUP_DIR= + +# netdata +HOSTNAME= + +# gitea +# you need to create "git" user and group +GITEA_UID= +GITEA_GID= +GITEA_MYSQL_ROOT_PASSWORD= +GITEA_MYSQL_DATABASE= +GITEA_MYSQL_USER= +GITEA_MYSQL_PASSWORD= + +# drone +DRONE_GITEA_SERVER=https://git.domain.com +DRONE_SERVER_HOST=https://drone.domain.com +DRONE_RPC_SECRET= +# generate these in gitea +DRONE_GITEA_CLIENT_ID= +DRONE_GITEA_CLIENT_SECRET= +DRONE_USER_CREATE=username:<--USERNAME-->,machine:false,admin:true,token:${DRONE_RPC_SECRET} diff --git a/docker/stacks/softdev/softdev.yml b/docker/stacks/softdev/softdev.yml new file mode 100644 index 0000000..5efbdca --- /dev/null +++ b/docker/stacks/softdev/softdev.yml @@ -0,0 +1,94 @@ +services: + gitea-db: + image: mysql:8 + container_name: gitea-db + networks: + - softdev + environment: + - MYSQL_ROOT_PASSWORD=${GITEA_MYSQL_ROOT_PASSWORD} + - MYSQL_USER=${GITEA_MYSQL_USER} + - MYSQL_PASSWORD=${GITEA_MYSQL_PASSWORD} + - MYSQL_DATABASE=${GITEA_MYSQL_DATABASE} + volumes: + - ${APPS_DIR}/gitea-db:/var/lib/mysql + restart: unless-stopped + + gitea: + image: gitea/gitea + container_name: gitea + networks: + - proxy + - softdev + environment: + - USER_UID=${GITEA_UID} + - USER_GID=${GITEA_GID} + - GITEA__database__DB_TYPE=mysql + - GITEA__database__HOST=gitea-db:3306 + - GITEA__database__NAME=${GITEA_MYSQL_DATABASE} + - GITEA__database__USER=${GITEA_MYSQL_USER} + - GITEA__database__PASSWD=${GITEA_MYSQL_PASSWORD} + volumes: + - ${APPS_DIR}/gitea:/data + - /home/git/.ssh/:/data/git/.ssh + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "2222:22" + restart: unless-stopped + depends_on: + - gitea-db + + drone: + image: drone/drone + container_name: drone + environment: + - DRONE_DATABASE_DRIVER=sqlite3 + - DRONE_DATABASE_DATASOURCE=/data/database.sqlite + - DRONE_GITEA_SERVER=${DRONE_GITEA_SERVER} + - DRONE_RPC_SECRET=${DRONE_RPC_SECRET} + - DRONE_SERVER_PROTO=https + - DRONE_SERVER_HOST=${DRONE_SERVER_HOST} + - DRONE_GITEA_CLIENT_ID=${DRONE_GITEA_CLIENT_ID} + - DRONE_GITEA_CLIENT_SECRET=${DRONE_GITEA_CLIENT_SECRET} + - DRONE_LOGS_DEBUG=true + - DRONE_USER_CREATE=${DRONE_USER_CREATE} + ports: + - "3001:80" + - "9001:9000" + networks: + - proxy + - softdev + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ${APPS_DIR}/drone:/data + restart: unless-stopped + depends_on: + - gitea + + drone-runner: + container_name: drone-runner + image: drone/drone-runner-docker + environment: + - DRONE_RPC_PROTO=http + - DRONE_RPC_HOST=drone + - DRONE_RPC_SECRET=${DRONE_RPC_SECRET} + - DRONE_RUNNER_NAME=runner + - DRONE_RUNNER_CAPACITY=2 + - DRONE_RUNNER_NETWORKS=softdev + ports: + - "3002:3000" + networks: + - softdev + volumes: + - /var/run/docker.sock:/var/run/docker.sock + restart: unless-stopped + depends_on: + - drone + +networks: + proxy: + external: + name: proxy + softdev: + name: softdev diff --git a/docker/stacks/swag/swag.yml b/docker/stacks/swag/swag.yml index eeb35f4..434d769 100644 --- a/docker/stacks/swag/swag.yml +++ b/docker/stacks/swag/swag.yml @@ -14,11 +14,13 @@ services: - SUBDOMAINS=wildcard - VALIDATION=dns - DNSPLUGIN=cloudflare + - EXTRA_DOMAINS=${EXTRA_DOMAINS} + - PROPAGATION=30 volumes: - ${APPS_DIR}/swag:/config ports: - - 443:443 - - 80:80 + - "443:443" + - "80:80" restart: unless-stopped networks: