docker-compose: store default db passwords in .env.docker

and have redis use a password as well
This commit is contained in:
Alexandra Dunn 2021-01-27 11:44:14 -08:00
parent 10ca7ac052
commit 927ef3b057
2 changed files with 20 additions and 18 deletions

View file

@ -56,11 +56,16 @@ MAIL_ENCRYPTION=null
## Databases (MySQL)
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=pixelfed_prod
DB_HOST=db
DB_PASSWORD=pixelfed_db_pass
DB_PORT=3306
DB_DATABASE=pixelfed
DB_USERNAME=pixelfed
DB_PASSWORD=pixelfed
# pass the same values to the db itself
MYSQL_DATABASE=pixelfed_prod
MYSQL_PASSWORD=pixelfed_db_pass
MYSQL_RANDOM_ROOT_PASSWORD=true
MYSQL_USER=pixelfed
## Databases (Postgres)
#DB_CONNECTION=pgsql
@ -74,7 +79,7 @@ DB_PASSWORD=pixelfed
REDIS_CLIENT=phpredis
REDIS_SCHEME=tcp
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PASSWORD=redis_password
REDIS_PORT=6379
REDIS_DATABASE=0

View file

@ -11,7 +11,6 @@ version: '3'
# if the volumes are properly shared between cluster members.
services:
## App and Worker
app:
# Comment to use dockerhub image
@ -21,16 +20,15 @@ services:
image: pixelfed
restart: unless-stopped
env_file:
- ./.env.docker
- .env.docker
volumes:
- "app-storage:/var/www/storage"
- "app-bootstrap:/var/www/bootstrap"
- "./.env.docker:/var/www/.env"
- app-storage:/var/www/storage
- app-bootstrap:/var/www/bootstrap
networks:
- external
- internal
ports:
- "8080:80"
- "8080:80"
depends_on:
- db
- redis
@ -42,10 +40,10 @@ services:
image: pixelfed
restart: unless-stopped
env_file:
- ./.env.docker
- .env.docker
volumes:
- "app-storage:/var/www/storage"
- "app-bootstrap:/var/www/bootstrap"
- app-storage:/var/www/storage
- app-bootstrap:/var/www/bootstrap
networks:
- external
- internal
@ -61,17 +59,16 @@ services:
networks:
- internal
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_DATABASE=pixelfed
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASSWORD=${DB_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=true
env_file:
- .env.docker
volumes:
- "db-data:/var/lib/mysql"
redis:
image: redis:5-alpine
restart: unless-stopped
env_file:
- .env.docker
volumes:
- "redis-data:/data"
networks: