From e906638173c9f159b7814167fcd15cdfc6413217 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Thu, 28 Dec 2023 14:09:16 -0500 Subject: [PATCH] Initial commit --- .gitignore | 1 + .gitmodules | 6 +++ README.md | 64 +++++++++++++++++++++++++++ bottin | 1 + bottin-agenda | 1 + docker-compose.yaml | 77 +++++++++++++++++++++++++++++++++ examples/bottin-agenda-api.yaml | 5 +++ examples/bottin-agenda-web.yaml | 3 ++ examples/bottin-api.yaml | 2 + examples/bottin-web.yaml | 3 ++ examples/test.env | 6 +++ 11 files changed, 169 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 README.md create mode 160000 bottin create mode 160000 bottin-agenda create mode 100644 docker-compose.yaml create mode 100644 examples/bottin-agenda-api.yaml create mode 100644 examples/bottin-agenda-web.yaml create mode 100644 examples/bottin-api.yaml create mode 100644 examples/bottin-web.yaml create mode 100644 examples/test.env diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f10862a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.env diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0e4bbc7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "bottin-agenda"] + path = bottin-agenda + url = https://git.agecem.com/agecem/bottin-agenda +[submodule "bottin"] + path = bottin + url = https://git.agecem.com/agecem/bottin diff --git a/README.md b/README.md new file mode 100644 index 0000000..f38928d --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# agecem/agenda + +Déploiement monolithique de [bottin](https://git.agecem.com/agecem/bottin) et [bottin-agenda](https://git.agecem.com/agecem/bottin-agenda) par docker-compose + +Pour cloner le repo avec les submodules: + +```sh +git clone https://git.agecem.com/agecem/agenda --recurse-submodules +``` + +Si le repo a été cloné sans `--recurse-submodules`: + +```sh +git submodule update --remote --recursive +``` + +## quickstart + +Instructions pour déployer un environnement avec les fichiers de config d'exemples. + +En production, ne pas oublier de changer les clés API et les credentials de Basic Authentication et de database. + +### Configurer les containers postgresql par variables d'environnement + +En production, modifier le contenu de `.env` et ajuster les fichiers de config en conséquent. + +```sh +umask 077 +cp examples/test.env .env +``` + +### Démarrer les containers + +*À noter que les containers risquent de restart continuellement tant que l'étape de déploiement de configurations n'est pas accomplie* + +```sh +docker-compose up -d --build +``` + +### Déployer configurations +Sur une installation `docker` par défaut, remplir les named volumes: + +*requiert permissions d'écriture, `sudo` peut être nécessaire* + +```sh +cp examples/bottin-api.yaml /var/lib/docker/volumes/agenda_bottin_api-config/_data/api.yaml +cp examples/bottin-web.yaml /var/lib/docker/volumes/agenda_bottin_web-config/_data/web.yaml +cp examples/bottin-agenda-api.yaml /var/lib/docker/volumes/agenda_bottin-agenda_api-config/_data/api.yaml +cp examples/bottin-agenda-web.yaml /var/lib/docker/volumes/agenda_bottin-agenda_web-config/_data/web.yaml +``` + +### Valider le déploiement + +Tous les containers doivent être `Up` lors d'un appel de: + +```sh +docker-compose ps +``` + +Si ce n'est pas le cas, vérifier les logs par: + +```sh +docker-compose logs -f +``` diff --git a/bottin b/bottin new file mode 160000 index 0000000..357c871 --- /dev/null +++ b/bottin @@ -0,0 +1 @@ +Subproject commit 357c871720568c8eafa5c50365d9505c131b7476 diff --git a/bottin-agenda b/bottin-agenda new file mode 160000 index 0000000..44e936c --- /dev/null +++ b/bottin-agenda @@ -0,0 +1 @@ +Subproject commit 44e936cd33004fb45f453c6a541514f31e4a1fb0 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..3676346 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,77 @@ +services: + + bottin_db: + image: 'docker.io/library/postgres:14.8' + environment: + POSTGRES_DATABASE: "${BOTTIN_POSTGRES_DATABASE}" + POSTGRES_PASSWORD: "${BOTTIN_POSTGRES_PASSWORD}" + POSTGRES_USER: "${BOTTIN_POSTGRES_USER}" + volumes: + - 'bottin_db-data:/var/lib/postgresql/data' + restart: 'unless-stopped' + + bottin_api: + depends_on: + - 'bottin_db' + build: './bottin' + image: 'git.agecem.com/agecem/bottin:latest' + ports: + - '1312:1312' + volumes: + - 'bottin_api-config:/etc/bottin' + restart: 'unless-stopped' + command: ['bottin', '--config', '/etc/bottin/api.yaml', 'api'] + + bottin_web: + depends_on: + - 'bottin_api' + build: './bottin' + image: 'git.agecem.com/agecem/bottin:latest' + ports: + - '2312:2312' + volumes: + - 'bottin_web-config:/etc/bottin' + restart: 'unless-stopped' + command: ['bottin', '--config', '/etc/bottin/web.yaml', 'web'] + + bottin_agenda_db: + image: 'docker.io/library/postgres:15.4' + environment: + POSTGRES_DATABASE: "${BOTTINAGENDA_POSTGRES_DATABASE}" + POSTGRES_PASSWORD: "${BOTTINAGENDA_POSTGRES_PASSWORD}" + POSTGRES_USER: "${BOTTINAGENDA_POSTGRES_USER}" + volumes: + - 'bottin-agenda_db-data:/var/lib/postgresql/data' + restart: 'unless-stopped' + + bottin_agenda_api: + depends_on: + - 'bottin_agenda_db' + build: './bottin-agenda' + image: 'git.agecem.com/agecem/bottin-agenda:latest' + ports: + - '1313:1313' + volumes: + - 'bottin-agenda_api-config:/etc/bottin-agenda' + restart: 'unless-stopped' + command: ['bottin-agenda', '--config', '/etc/bottin-agenda/api.yaml', 'api'] + + bottin_agenda_web: + depends_on: + - 'bottin_agenda_api' + build: './bottin-agenda' + image: 'git.agecem.com/agecem/bottin-agenda:latest' + ports: + - '2313:2313' + volumes: + - 'bottin-agenda_web-config:/etc/bottin-agenda' + restart: 'unless-stopped' + command: ['bottin-agenda', '--config', '/etc/bottin-agenda/web.yaml', 'web'] + +volumes: + bottin_db-data: + bottin_api-config: + bottin_web-config: + bottin-agenda_db-data: + bottin-agenda_api-config: + bottin-agenda_web-config: diff --git a/examples/bottin-agenda-api.yaml b/examples/bottin-agenda-api.yaml new file mode 100644 index 0000000..20fe3e8 --- /dev/null +++ b/examples/bottin-agenda-api.yaml @@ -0,0 +1,5 @@ +bottin: + api: + host: 'bottin_api' +db: + host: 'bottin_agenda_db' diff --git a/examples/bottin-agenda-web.yaml b/examples/bottin-agenda-web.yaml new file mode 100644 index 0000000..d2a463e --- /dev/null +++ b/examples/bottin-agenda-web.yaml @@ -0,0 +1,3 @@ +web: + api: + host: 'bottin_agenda_api' diff --git a/examples/bottin-api.yaml b/examples/bottin-api.yaml new file mode 100644 index 0000000..9031801 --- /dev/null +++ b/examples/bottin-api.yaml @@ -0,0 +1,2 @@ +db: + host: 'bottin_db' diff --git a/examples/bottin-web.yaml b/examples/bottin-web.yaml new file mode 100644 index 0000000..833a817 --- /dev/null +++ b/examples/bottin-web.yaml @@ -0,0 +1,3 @@ +web: + api: + host: 'bottin_api' diff --git a/examples/test.env b/examples/test.env new file mode 100644 index 0000000..fd48e46 --- /dev/null +++ b/examples/test.env @@ -0,0 +1,6 @@ +BOTTINAGENDA_POSTGRES_DATABASE=bottin-agenda +BOTTINAGENDA_POSTGRES_PASSWORD=bottin-agenda +BOTTINAGENDA_POSTGRES_USER=bottin-agenda +BOTTIN_POSTGRES_PASSWORD=bottin +BOTTIN_POSTGRES_USER=bottin +BOTTIN_POSTGRES_DATABASE=bottin