Skip to content
Snippets Groups Projects
Commit 24e27470 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding docker for development environment porpouses.

if you want to use it, see README file.
parent 0931e1e0
No related branches found
No related tags found
No related merge requests found
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential nodejs
RUN mkdir /app
WORKDIR /tmp
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN bundle install -j 3
WORKDIR /app
CMD ["rails", "server", "-b", "0.0.0.0"]
...@@ -18,6 +18,12 @@ After this setup, open the config files and update some vars: ...@@ -18,6 +18,12 @@ After this setup, open the config files and update some vars:
* config/initializers/gitlab.rb: change your gitlab host for bug reports and set env var with private token. ( $ export GITLAB_PORTALMEC_PRIVATE_TOKEN=131237128937128937 ) * config/initializers/gitlab.rb: change your gitlab host for bug reports and set env var with private token. ( $ export GITLAB_PORTALMEC_PRIVATE_TOKEN=131237128937128937 )
### Development environment ### Development environment
#### Using docker for development env
You can use docker for your development environment. For that, run:
``` ./bin/docker-setup ```
Now, redis, elasticsearch and postgres are running as services and linked to PortalMEC application. Database migrations were execute.
If all development and test vars are set, run: If all development and test vars are set, run:
``` ./bin/setup ``` ``` ./bin/setup ```
This command will install the rubygems, create/reset your database schema, seed some default data and import all dspace data. This command will install the rubygems, create/reset your database schema, seed some default data and import all dspace data.
...@@ -25,7 +31,7 @@ This command will install the rubygems, create/reset your database schema, seed ...@@ -25,7 +31,7 @@ This command will install the rubygems, create/reset your database schema, seed
After this, your application is ready to use and you can access it with: After this, your application is ready to use and you can access it with:
``` bundle exec rails s ``` ``` bundle exec rails s ```
### Test environment ### Running tests suite
For tests, TestUnit is used, and to run it: For tests, TestUnit is used, and to run it:
``` bundle exec rake test ``` ``` bundle exec rake test ```
......
# bin/docker-setup
#!/bin/bash
set -e
# overwrite default configs for docker
# cp -f config/docker/* config/
# build app image
docker-compose build
# start mysql and redis in background
# docker-compose start db
# docker-compose start redis
# docker-compose start elasticsearch
# setup database
docker-compose run web rake db:create db:migrate
# ensure all containers are up and running
docker-compose up
\ No newline at end of file
default: &defaults
adapter: postgresql
encoding: unicode
development: &default
adapter: postgresql
encoding: unicode
database: postgres
pool: 5
username: postgres
password:
host: db
test:
<<: *defaults
pool: 5
database: portalmec_test
username: portalmec
password: 123mudar
host: postgres
production:
<<: *defaults
host: <%= ENV['PORTALMEC_DB_HOST'] %>
pool: <%= ENV['PORTALMEC_DB_POOL'] %>
database: <%= ENV['PORTALMEC_DB_NAME'] %>
username: <%= ENV['PORTALMEC_DB_USERNAME'] %>
password: <%= ENV['PORTALMEC_DB_PASSWORD'] %>
#
# IMPORTANT:
# If you plan to run workers on different machines, use the full hostname,
# instead of just "localhost". And remember to use the exactly same configs
# on all of the machines, including database's configs and
# environment type (development, test, production).
#
:pidfile: ./shared/pids/sidekiq.pid
:logfile: ./shared/logs/sidekiq.log
:queues:
- default
- score
- convert_video
- searchkick
- [attachment_cache, 2]
- [high_priority, 5]
# :daemon: true
development: &development
:concurrency: 8
host: redis
port: 6379
test:
host: portalmecdev1.c3sl.ufpr.br
port: 6379
production:
host: portalmecdev1.c3sl.ufpr.br
port: 6379
web:
build: .
volumes:
- .:/app
ports:
- "3000:3000"
links:
- db
- redis
- elasticsearch
db:
image: postgres
redis:
image: redis
elasticsearch:
image: elasticsearch
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment