Update docker-compose to work with DB out of box

This commit is contained in:
Ari Timonen 2020-03-31 05:31:42 +03:00
parent dc332a8062
commit 79533b19a3
7 changed files with 17 additions and 4 deletions

View file

@ -1,5 +1,6 @@
Dockerfile Dockerfile
db_data db_data
db/data/
dkim dkim
log/* log/*
public/* public/*

View file

@ -6,6 +6,7 @@ RAILS_ENV=development
APP_SECRET=fe837ea72667ec3d8ecb94cfba1a1bba APP_SECRET=fe837ea72667ec3d8ecb94cfba1a1bba
DEPLOY_PATH=/var/www DEPLOY_PATH=/var/www
FILES_PATH=/var/www/files
PUMA_WORKERS=0 PUMA_WORKERS=0
PUMA_MIN_THREADS=1 PUMA_MIN_THREADS=1

View file

@ -22,7 +22,10 @@ PUMA_PORT=4000
# Use higher timeout if debug fails # Use higher timeout if debug fails
PUMA_TIMEOUT=30 PUMA_TIMEOUT=30
# Docker adds mysql name to /etc/hosts # Path to files
FILES_PATH=/var/www/files
# Docker adds mysql to hosts
MYSQL_HOST=db MYSQL_HOST=db
# This is used by both rails + mysql # This is used by both rails + mysql

4
.gitignore vendored
View file

@ -18,6 +18,10 @@
# Database and files # Database and files
db_data/* db_data/*
!db_data/.placeholder !db_data/.placeholder
db/data/
!db/data/.placeholder
db/initdb.d/*
!db/initdb.d/.placeholder
*.sql* *.sql*
# ignore dkim keys # ignore dkim keys

View file

@ -33,6 +33,8 @@ First build the ENSL docker containers.
docker-compose build docker-compose build
Put any database dumps to `db/initdb.d`.
a) Then start for **production**: a) Then start for **production**:
docker-compose up docker-compose up

0
db/initdb.d/.placeholder Normal file
View file

View file

@ -13,7 +13,7 @@ services:
context: ./ context: ./
dockerfile: Dockerfile.dev dockerfile: Dockerfile.dev
# args: # args:
# buildno: 1 # buildno: 1
volumes: volumes:
- ".:/var/www/" - ".:/var/www/"
ports: ports:
@ -87,11 +87,13 @@ services:
# Debug # Debug
#command: bash #command: bash
#tty: true #tty: true
command: mysqld_safe --skip-grant-tables # command: mysqld_safe --skip-grant-tables
image: mariadb:latest image: mariadb:latest
container_name: ensl_dev_db container_name: ensl_dev_db
user: "mysql:mysql"
volumes: volumes:
- "./db_data:/var/lib/mysql" - "./db/data:/var/lib/mysql"
- "./db/initdb.d:/docker-entrypoint-initdb.d"
- "./ext/mysql.conf.d:/etc/mysql/conf.d" - "./ext/mysql.conf.d:/etc/mysql/conf.d"
environment: environment:
- MYSQL_DATABASE=ensl - MYSQL_DATABASE=ensl