Merge pull request #2588 from dunn/docker-compose-env

docker-compose: store default db passwords in .env.docker
This commit is contained in:
daniel 2021-04-06 21:38:14 -06:00 committed by GitHub
commit 56458c1f40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

View file

@ -56,11 +56,16 @@ MAIL_ENCRYPTION=null
## Databases (MySQL) ## Databases (MySQL)
DB_CONNECTION=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_PORT=3306
DB_DATABASE=pixelfed
DB_USERNAME=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) ## Databases (Postgres)
#DB_CONNECTION=pgsql #DB_CONNECTION=pgsql
@ -74,7 +79,7 @@ DB_PASSWORD=pixelfed
REDIS_CLIENT=phpredis REDIS_CLIENT=phpredis
REDIS_SCHEME=tcp REDIS_SCHEME=tcp
REDIS_HOST=redis REDIS_HOST=redis
REDIS_PASSWORD=null REDIS_PASSWORD=redis_password
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_DATABASE=0 REDIS_DATABASE=0

View file

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