Update docker version

With docker-compose and mariadb
This commit is contained in:
Ari Timonen 2018-04-23 15:29:07 +00:00
parent 3989846235
commit 6b2f644352
10 changed files with 80 additions and 27 deletions

View file

@ -1 +1,2 @@
Dockerfile
db_data

4
.gitignore vendored
View file

@ -14,6 +14,10 @@
*.rbc
*.sassc
# Database and files
db_data/*
!db_data/.placeholder
# OS X
.DS_Store

View file

@ -24,11 +24,12 @@ ADD . /var/www
RUN chown -R web:web /var/www
# Precompile assets
#WORKDIR /var/www
#RUN bundle exec rake assets:precompile
WORKDIR /var/www
USER web
RUN bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4
RUN bundle exec rake assets:precompile && mv /var/www/public/assets /var/www/assets_tmp
# for debug
# USER root
USER web
CMD ["/var/www/entry.sh"]

View file

@ -1,5 +1,6 @@
PROJECT ?= ensl/ensl.org
TAG ?= latest
REGISTRY ?= ensl
PROJECT ?= ensl.org
TAG ?= latest
ifdef REGISTRY
IMAGE=$(REGISTRY)/$(PROJECT):$(TAG)

29
docker-compose.yml Normal file
View file

@ -0,0 +1,29 @@
version: "3"
services:
web:
image: ensl/ensl.org:latest
# volumes:
# - "/srv/ensl/ensl.org/public:/var/www/public"
ports:
- "4000:4000"
depends_on:
- db
- memcached
# - redis
db:
image: mariadb:latest
volumes:
- "/srv/ensl/ensl.org/db_data:/var/lib/mysql"
# - "/srv/ensl/ensl.org/ext/mysql.conf.d:/etc/mysql/conf.d"
environment:
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_USERNAME
- MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD
# - MYSQL_ROOT_HOST
memcached:
image: memcached:latest
#redis:
# image: redis

View file

@ -1,7 +0,0 @@
#!/bin/bash
env
cd /var/www
source .env
bundle exec rake assets:precompile
bundle exec puma -C config/puma.rb

31
ext/mysql.conf.d/opt.cnf Normal file
View file

@ -0,0 +1,31 @@
[mysqld]
skip-host-cache
skip-name-resolve
key_buffer = 150M
max_allowed_packet = 20M
thread_stack = 196K
thread_cache_size = 16
max_connections = 96
table_cache = 2000
table_definition_cache = 800
thread_concurrency = 128
query_cache_limit = 30M
query_cache_size = 150M
open_files_limit = 1800
join_buffer_size = 1M
sort_buffer_size = 1M
read_buffer_size = 128K
tmp_table_size = 500M
max_heap_table_size = 500M
innodb_buffer_pool_size = 1280M
innodb_flush_log_at_trx_commit = 1
innodb_thread_concurrency = 16
innodb_flush_method = O_DIRECT
innodb_additional_mem_pool_size = 20M
innodb_file_per_table = 1
transaction-isolation = READ-COMMITTED

15
fig.yml
View file

@ -1,15 +0,0 @@
web:
image: ensl
volumes:
- "/srv/ensl/public:/var/www/public"
ports:
- "4000:4000"
links:
- mysql
# - redis
mysql:
image: mysql/mysql-server:5.7
volumes:
- "/srv/ensl/mysql:/var/lib/mysql"
#redis:
# image: redis

8
script/entry.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
env
cd /var/www
source /var/www/.env
rm -rf /var/www/public/assets
mv /var/www/assets_tmp /var/www/public/
bundle exec puma -C config/puma.rb