add redis password and increase version. does not work yet
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
stevensting 2025-02-16 11:49:16 +01:00
parent f65e5eec94
commit 112a1f6d3a
4 changed files with 30 additions and 2 deletions

View File

@ -41,6 +41,7 @@ USE_RACK_ATTACK=1
SECRET_DEVISE_SECRET_VERSION=v1 #length=64
SECRET_SECRET_COOKIE_TOKEN_VERSION=v1 #length=64
SECRET_DB_PASSWORD_VERSION=v1
SECRET_REDIS_PASSWORD_VERSION=v1
# Send catch up email (missed yesterday) weekly
# EMAIL_CATCH_UP_WEEKLY=1

View File

@ -1,4 +1,5 @@
export LOOMIO_ENTRYPOINT_VERSION=v5
export REDIS_ENTRYPOINT_VERSION=v1
# cannot be integrated into entrypoint.sh as it requires the operator to create a user first
function make_last_user_admin()

View File

@ -7,7 +7,8 @@ x-db-env: &db-env
POSTGRES_USER: postgres
x-redis-env: &redis-env
REDIS_URL: redis://redis:6379
REDIS_PASSWORD_FILE: /run/secrets/redis_password
REDIS_URL: redis://:{REDIS_PASSWORD}@redis:6379
x-environment: &default-env
<<: *db-env
@ -43,6 +44,7 @@ services:
- devise_secret
- secret_cookie_token
- db_password
- redis_password
volumes:
- loomio_uploads:/loomio/public/system
- loomio_storage:/loomio/storage
@ -84,6 +86,7 @@ services:
- devise_secret
- secret_cookie_token
- db_password
- redis_password
networks:
- backend
environment:
@ -116,11 +119,19 @@ services:
backupbot.restore: "true"
backupbot.restore.post-hook: sh -c 'gzip -d /postgres.dump.gz && pg_restore --clean -U "$$POSTGRES_USER" --dbname="$$POSTGRES_DB" < /postgres.dump && rm -f /postgres.dump'
redis:
image: redis:5.0
image: redis:7.4
networks:
- backend
command: /bin/sh -c "redis-server redis.conf --loglevel debug"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
secrets:
- redis_password
configs:
- source: entrypoint_redis
target: /entrypoint.sh
mode: 0555
entrypoint: /entrypoint.sh
#mailin:
# image: loomio/mailin-docker:latest
# networks:
@ -135,6 +146,8 @@ services:
- backend
depends_on:
- redis
secrets:
- redis_password
environment:
<<: *redis-env
cron:
@ -149,6 +162,7 @@ services:
- devise_secret
- secret_cookie_token
- db_password
- redis_password
volumes:
- loomio_uploads:/loomio/public/system
- loomio_storage:/loomio/storage
@ -184,6 +198,9 @@ configs:
entrypoint:
name: ${STACK_NAME}_entrypoint_${LOOMIO_ENTRYPOINT_VERSION}
file: entrypoint.sh
entrypoint_redis:
name: ${STACK_NAME}_entrypoint_redis_${REDIS_ENTRYPOINT_VERSION}
file: entrypoint.redis.sh
secrets:
devise_secret:
@ -195,3 +212,6 @@ secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
redis_password:
external: true
name: ${STACK_NAME}_redis_password_${SECRET_REDIS_PASSWORD_VERSION}

6
entrypoint.redis.sh Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
echo "creating redis.conf..."
echo "requirepass $(cat /run/secrets/redis_password)" > redis.conf
echo "redis.conf created"