From 0df43ef27aa2bdee62ddc6fbff28780e568f67ba Mon Sep 17 00:00:00 2001 From: greglebreton Date: Fri, 10 Mar 2023 23:19:54 +0100 Subject: [PATCH] maj .env +process --- .env | 24 ++++++++++++++---- README.md | 62 ++++++++++++++++++++++++++++++++++++++-------- docker-compose.yml | 8 +++--- 3 files changed, 75 insertions(+), 19 deletions(-) diff --git a/.env b/.env index 16e0895..7b09fc8 100644 --- a/.env +++ b/.env @@ -1,6 +1,20 @@ -POSTGRES_PAASWORD= +# DATABASE +POSTGRES_DB= +POSTGRES_USER= +POSTGRES_PASSWORD= + +# GITEA GITEA_SSH_PORT= -DRONE_SERVER_PORT= -DRONE_SECRET= -ROOT_URL= -SSH_DOMAIN= \ No newline at end of file +#DRONE_SERVER_PORT= +#DRONE_SECRET= +ROOT_URL="https://git.mondomaine.tld" +SSH_DOMAIN="git.mondomaine.tld" +DOMAIN="git.mondomaine.tld" + +# DRONE +DRONE_GITEA_SERVER="https://git.mondomaine.tld" +DRONE_GITEA_CLIENT_ID="" +DRONE_GITEA_CLIENT_SECRET="" +DRONE_RPC_SECRET="" +DRONE_GITEA_GIT_USERNAME="" +DRONE_GITEA_GIT_PASSWORD="" \ No newline at end of file diff --git a/README.md b/README.md index bd219f7..5f2ca5a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GITEA DRONE CI DOCKER-COMPOSE DEPLOYEMENT -This repository aim to deploy an open-source CI-CD platform with a SCM (Gitea), CI server and runners (Drone) via docker-compose. +Stack de déployement de Gitea avec Drone CI pour héberger son code avec des runners pour le CI/CD [Gitea site](https://gitea.io) @@ -8,28 +8,70 @@ This repository aim to deploy an open-source CI-CD platform with a SCM (Gitea), ## PRE-REQUIS -- [Docker](https://https://www.google.com) +- [Docker](https://www.google.com) - [Docker-compose](https://www.google.com) ## USAGE +:warning: deployer gitea en premier (sans drone ci) + +### GITEA + +- Renseigner le fichier .env avec le bon nom de domaine + +> Note: nécessite une configuration nginx fonctionnelle + +- deployer gitea: +```bash +docker-compose up -d +``` + +- Créer l'utilisateur admin avec son mot de passe + +- Dans le profil de l'utilisateur, aller à l'onglet application pour créer l'authentification Oauth2 pour le drone (DRONE_GITEA_CLIENT_ID, DRONE_GITEA_CLIENT_SECRET) et renseigner celles-ci dans le fichier .env + +- Renseigner le DRONE_RPC_SECRET (aéatoire, c'est pour authentifier le drone runner et le drone server entre eux) + +### DRONE CI + +- Renseigner le fichier .env avec le bon nom de domaine, le DRONE_RPC_SECRET (aéatoire, c'est pour authentifier le drone runner et le drone server entre eux) ainsi que le nom d'utilisateur et le mot de passe de l'admin créé plus haut + + +- deployer drone ci: ```bash docker-compose up -d ``` -## CONFIG +## CONFIGURATION -- .env +- gitea/conf/app.ini +``` +# DNS +[server] +DOMAIN = gitea.mondomaine.tld +SSH_DOMAIN = gitea.mondomaine.tld +ROOT_URL = https://gitea.mondomaine.tld/ +LANDING_PAGE = explore + +# SSO +[service] +DISABLE_REGISTRATION = true +ALLOW_ONLY_EXTERNAL_REGISTRATION = true +[openid] +ENABLE_OPENID_SIGNIN = true + +# THEMES +[ui] +THEMES = gitea,arc-green,github,matrix,tangerine-dream,earl-grey +DEFAULT_THEME = gitea +``` -- app.ini (thèmes) +> Note: Pour le SSO, aller dans les la partie administration du site sur gitea, onglet source d'authentificationet ajouter une source d'authentification (pour keycloak: https://adresse-du-keycloak/auth/realms/gregan/.well-known/openid-configuration) ## TO DO -- [x] Drone server config -- [x] Config all via .env -- [x] Test -- [ ] Comments +- [ ] Config all via .env -## CONTRIBUTING +## CONTRIBUTION this docker-compose file is based on https://github.com/ruanbekker/drone-gitea-traefik-docker-blogpost \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 88be41e..7c82845 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,13 +21,13 @@ services: networks: - gitea volumes: - - ./gitea:/data + - ./gitea:/data/gitea - ./config:/etc/gitea - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - "3000:3000" - - "${SSH_PORT}:22" + - "${GITEA_SSH_PORT}:22" depends_on: - gitea-db @@ -72,7 +72,7 @@ services: - DRONE_RPC_SECRET=${DRONE_RPC_SECRET} - DRONE_GITEA_CLIENT_ID=${DRONE_GITEA_CLIENT_ID} - DRONE_GITEA_CLIENT_SECRET=${DRONE_GITEA_CLIENT_SECRET} - - DRONE_ADMIN=${DRONE_ADMIN} + - DRONE_ADMIN=${DRONE_GITEA_GIT_USERNAME} - DRONE_USER_CREATE="username:${DRONE_GITEA_GIT_USERNAME},machine:false,admin:true,token:${DRONE_RPC_SECRET}" - DRONE_SERVER_PROTO=https networks: @@ -107,4 +107,4 @@ volumes: networks: gitea: - name: gitea \ No newline at end of file + name: gitea