Skip to content

Commit

Permalink
Merge pull request #396 from kikkomep/feat/docker-maintenance
Browse files Browse the repository at this point in the history
feat: maintenance mode on compose deployment
  • Loading branch information
kikkomep authored Sep 2, 2024
2 parents 90d4c39 + 022e332 commit 247c538
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ permissions: certs
prometheus.dev.yml \
settings.conf \
tests/config/registries/seek/nginx.conf \
tests/config/registries/seek/doorkeeper.rb
tests/config/registries/seek/doorkeeper.rb \
&& mkdir -p /tmp/lifemonitor-logs


aux_images: tests/config/registries/seek/seek.Dockerfile certs
Expand Down Expand Up @@ -223,7 +224,8 @@ start-dev: images compose-files dev reset_compose permissions ## Start LifeMonit
start-testing: compose-files aux_images ro_crates images reset_compose permissions ## Start LifeMonitor in a Testing environment
@printf "\n$(bold)Starting testing services...$(reset)\n" ; \
base=$$(if [[ -f "docker-compose.yml" ]]; then echo "-f docker-compose.yml"; fi) ; \
echo "$$($(docker_compose) $${base} \
echo "$$(USER_UID=$$(id -u) USER_GID=$$(id -g) \
$(docker_compose) $${base} \
-f docker-compose.extra.yml \
-f docker-compose.base.yml \
-f docker-compose.monitoring.yml \
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.5"

services:
db:
# Docker image docs: https://github.com/bitnami/bitnami-docker-postgresql
Expand Down Expand Up @@ -65,6 +63,7 @@ services:
- "./instance:/lm/instance:ro"
- "./settings.conf:/lm/settings.conf:ro" # default settings
- "data_workflows:/var/data/lm"
- "/tmp/lifemonitor-logs:/var/log/lm"
networks:
- life_monitor

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.5"

services:
db:
environment:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.extra.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.5"

services:
seek:
image: crs4/lifemonitor-tests:seek
Expand Down
61 changes: 61 additions & 0 deletions docker-compose.maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
services:
db:
environment:
- "ALLOW_EMPTY_PASSWORD=yes"

console:
image: crs4/lifemonitor
restart: "unless-stopped"
depends_on:
- "db"
- "init"
- "redis"
entrypoint: /bin/bash
command: |
-c "sleep infinity"
user: "${USER_UID}:${USER_GID}"
env_file:
- settings.conf
environment:
- "FLASK_ENV=development"
- "TEMPLATES_AUTO_RELOAD=True"
- "HOME=/lm"
# Normally, OAuthLib will raise an InsecureTransportError if you attempt to use OAuth2 over HTTP,
# rather than HTTPS. Setting this environment variable will prevent this error from being raised.
# This is mostly useful for local testing, or automated tests. Never set this variable in production.
- "AUTHLIB_INSECURE_TRANSPORT=1"
# - "SERVER_NAME=lm:8000"
volumes:
- "./certs:/certs:ro"
- "./instance:/lm/instance:ro"
- "./settings.conf:/lm/settings.conf:ro" # default settings
- "./:/lm"
- "data_workflows:/var/data/lm"
ports:
- "8000"
networks:
- life_monitor

init:
user: "${USER_UID}:${USER_GID}"
environment:
- "FLASK_ENV=development"
# Normally, OAuthLib will raise an InsecureTransportError if you attempt to use OAuth2 over HTTP,
# rather than HTTPS. Setting this environment variable will prevent this error from being raised.
# This is mostly useful for local testing, or automated tests. Never set this variable in production.
- "AUTHLIB_INSECURE_TRANSPORT=1"
- "HOME=/lm"
volumes:
- "./:/lm"

lm:
environment:
- "FLASK_ENV=maintenance"

ws_server:
environment:
- "FLASK_ENV=maintenance"

worker:
environment:
- "FLASK_ENV=maintenance"
2 changes: 0 additions & 2 deletions docker-compose.monitoring.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.5"

services:
prometheus:
image: prom/prometheus:v2.48.0
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.5"

services:
lmtests:
image: crs4/lifemonitor
Expand Down Expand Up @@ -34,6 +32,7 @@ services:
- "./certs:/certs:ro"
- "./instance:/lm/instance:ro"
- "./settings.conf:/lm/settings.conf:ro" # default settings
- "/tmp/lifemonitor-logs:/var/log/lm"
ports:
- "8000"
networks:
Expand Down

0 comments on commit 247c538

Please sign in to comment.