From f5a408e05f8bcf0094e112ad525a6b0b5c3e531f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Roble=20Guti=C3=A9rrez?= Date: Fri, 26 Apr 2019 16:42:15 -0400 Subject: [PATCH 1/3] Update HOST in production configuration --- config/mongoid.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index 58e08201e..5eb5d520e 100755 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -79,4 +79,4 @@ production: default: database: <%= ENV['DB_PROD'] || 'cenit_prod' %> hosts: - - localhost:27017 + - <%= ENV['DB_PORT'] || 'localhost:27017' %> From ecc380e7bfc2480ae30dfe34530380acfb14c26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Roble=20Guti=C3=A9rrez?= Date: Fri, 26 Apr 2019 16:42:41 -0400 Subject: [PATCH 2/3] -Add new environment variable to define root directory -Add new environmnet variable to define skip conection to mongodb -Fix CMD sintaxis --- Dockerfile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e862ea98..deb5b989c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ FROM ruby:2.5.5 # - build-essential: To ensure certain gems can be compiled # - nodejs: Compile assets RUN set -x; \ - apt-get update \ - && apt-get install -y --no-install-recommends \ + apt update \ + && apt install -y --no-install-recommends \ openssh-server \ zlib1g-dev \ build-essential \ @@ -22,12 +22,13 @@ RUN set -x; \ libmagickwand-dev # Set an environment variable where the Rails app is installed to inside of Docker image -ENV RAILS_ROOT /var/www/cenit +ENV DIR_ROOT /var/www +ENV RAILS_ROOT $DIR_ROOT/cenit RUN mkdir -p $RAILS_ROOT -RUN mkdir -p /var/www/shared/log -RUN mkdir -p /var/www/shared/pids -RUN mkdir -p /var/www/shared/sockets +RUN mkdir -p $DIR_ROOT/shared/log +RUN mkdir -p $DIR_ROOT/shared/pids +RUN mkdir -p $DIR_ROOT/shared/sockets # Set working directory WORKDIR $RAILS_ROOT @@ -45,9 +46,11 @@ RUN bundle install --jobs 20 --retry 5 --without development test # Adding project files COPY . . +ENV SKIP_MONGO_CLIENT='true' + RUN set -x; \ - SKIP_MONGO_CLIENT='true' bundle exec rake assets:precompile + bundle exec rake assets:precompile EXPOSE 8080 -CMD bundle exec unicorn -c config/unicorn.rb +CMD ["bundle", "exec", "unicorn", "-c", "config/unicorn.rb"] From 7c63f4a6ba5e985a327d00c442869a3ab5c56be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Roble=20Guti=C3=A9rrez?= Date: Fri, 26 Apr 2019 16:49:16 -0400 Subject: [PATCH 3/3] -Define true in SKIP MONGO_CLIENT variable to connect with mongodb in docker-compose services -Remove unnecessary "command" feature in cenit service definition -Use rabbitmq:management image to be able manager interface of RabbitMQ service --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c6ab050f3..127cfb346 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,8 +12,8 @@ services: - RABBITMQ_BIGWIG_TX_URL=amqp://cenit_rabbit:cenit_rabbit@rabbitmq/cenit_rabbit_vhost - UNICORN_WORKERS=5 - MAXIMUM_UNICORN_CONSUMERS=3 + - SKIP_MONGO_CLIENT='false' build: . - command: bundle exec unicorn_rails -E production -c config/unicorn.rb ports: - "8080:8080" depends_on: @@ -21,7 +21,7 @@ services: - rabbitmq rabbitmq: - image: rabbitmq + image: rabbitmq:management ports: - "15672:15672" - "5672:5672"