Skip to content

Commit

Permalink
Merge 08739cf into 8617ad2
Browse files Browse the repository at this point in the history
  • Loading branch information
icarito authored May 24, 2018
2 parents 8617ad2 + 08739cf commit f4b8452
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dockerfile # Plots2
# https://github.com/publiclab/plots2

FROM ruby:2.3
FROM ruby:2.3-jessie

LABEL maintainer="Sebastian Silva <sebastian@fuentelibre.org>"
LABEL description="This image deploys Plots2."
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
build:
cp config/database.yml.example config/database.yml
cp db/schema.rb.example db/schema.rb
docker-compose down --remove-orphans
docker-compose build

deploy-container:
docker-compose run web sleep 5
docker-compose run web rake db:migrate
docker-compose run web bower install --allow-root
docker-compose run web bower update --allow-root
docker-compose run web rake assets:precompile
test -e tmp/pids/server.pid && rm tmp/pids/server.pid
docker-compose up -d
docker-compose exec -T web bash -c "echo 172.19.0.1 smtp >> /etc/hosts"
docker-compose exec -T web bundle exec whenever --update-crontab
docker-compose exec -T web service start cron

install-dev:
echo "Installing RubyGems"
bundle install --without production mysql
Expand Down
32 changes: 32 additions & 0 deletions containers/docker-compose-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "2"
services:
db:
ports:
- "127.0.0.1:3307:3306"
image: mariadb:10.2
restart: unless-stopped
environment:
- MYSQL_DATABASE=plots_$RAILS_ENV
- MYSQL_USER=plots
- MYSQL_PASSWORD=plots
- MYSQL_RANDOM_ROOT_PASSWORD=true
volumes:
- ./config/my.cnf:/etc/mysql/my.cnf
# for configuration
- ../mysql:/var/lib/mysql
# for persistence
- ../dump:/docker-entrypoint-initdb.d
# for importing a dump
# if you want to re-import simply put away ../mysql/*
# web:
# build: .
# command: /bin/bash -c "sleep 5 && bundle exec rails s -p 4000 -b '0.0.0.0'"
# environment:
# - RAILS_ENV=${RAILS_ENV}
# volumes:
# - .:/app
# ports:
# - "127.0.0.1:4001:4000"
# links:
# - db
# restart: unless-stopped
30 changes: 30 additions & 0 deletions containers/docker-compose-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "2"
services:
db:
image: mariadb:10.2
environment:
- MYSQL_DATABASE=plots
- MYSQL_USER=plots
- MYSQL_PASSWORD=plots
- MYSQL_RANDOM_ROOT_PASSWORD=true
volumes:
- ../mysql:/var/lib/mysql
# for persistence
- ../dump:/docker-entrypoint-initdb.d
# for importing a dump
# if you want to re-import simply put away ../mysql/*
web:
build: .
command: /bin/bash -c "sleep 5 && passenger start -p 4000"
environment:
- RAILS_ENV=${RAILS_ENV}
- SOLR_URL=${SOLR_URL}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- DISABLE_SOLR_CHECK=1
volumes:
- .:/app
ports:
- "127.0.0.1:4000:4000"
links:
- db
# restart: unless-stopped
30 changes: 30 additions & 0 deletions containers/docker-compose-unstable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "2"
services:
db:
image: mariadb:10.2
environment:
- MYSQL_DATABASE=plots
- MYSQL_USER=plots
- MYSQL_PASSWORD=plots
- MYSQL_RANDOM_ROOT_PASSWORD=true
volumes:
- ./config/my.cnf:/etc/mysql/my.cnf
# for configuration
- ../mysql:/var/lib/mysql
# for persistence
- ../dump:/docker-entrypoint-initdb.d
# for importing a dump
# if you want to re-import simply put away ../mysql/*
web:
build: .
command: /bin/bash -c "sleep 5 && passenger start -p 5001"
environment:
- RAILS_ENV=${RAILS_ENV}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
volumes:
- .:/app
ports:
- "127.0.0.1:5001:5001"
links:
- db
# restart: unless-stopped

0 comments on commit f4b8452

Please sign in to comment.