Skip to content

Commit

Permalink
Merge pull request #2716 from cenit-io/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sanchojaf committed Sep 21, 2019
2 parents bb56559 + 882ba66 commit 52c6682
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ RUN set -x; \
nginx

# Set an environment variable where the Rails app is installed to inside of Docker image

RUN git clone https://github.com/cenit-io/cenit.git /var/www/cenit
ENV RAILS_ROOT /var/www/cenit
RUN mkdir -p $RAILS_ROOT

RUN mkdir -p /var/www/shared/log
RUN mkdir -p /var/www/shared/pids
Expand All @@ -33,30 +34,26 @@ RUN mkdir -p /var/www/shared/sockets
# Set working directory
WORKDIR $RAILS_ROOT

RUN git checkout docker-branch

# Setting env up
ENV RAILS_ENV='production'
ENV RACK_ENV='production'

# Adding gems
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock

RUN bundle install --jobs 20 --retry 5 --without development test

RUN gem install foreman

# Adding project files
COPY . .

ENV SKIP_MONGO_CLIENT='true'
COPY config/mongoid.yml config/mongoid.yml

RUN set -x; \
bundle exec rake assets:precompile

RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx

COPY server_config/cenit.conf /etc/nginx/sites-enabled/cenit.conf
RUN cp server_config/cenit.conf /etc/nginx/sites-enabled/cenit.conf
RUN rm /etc/nginx/sites-enabled/default

EXPOSE 80 3000
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: '3.7'
volumes:
# We'll define a volume that will store the data from the mongo databases:
mongodb-data: {}
redis-data: {}

services:
cenit:
Expand All @@ -13,12 +14,14 @@ services:
- UNICORN_WORKERS=5
- MAXIMUM_UNICORN_CONSUMERS=3
- DB_PROD='cenit_prod'
- REDIS_HOST=redis
build: .
ports:
- "3000:3000"
depends_on:
- mongodb
- rabbitmq
- redis
command: ["foreman", "start", "-f", "Procfile"]

rabbitmq:
Expand All @@ -38,3 +41,9 @@ services:
volumes:
# We'll mount the 'mongodb-data' volume into the location mongodb stores it's data:
- mongodb-data:/data/db

redis:
image: redis
volumes:
- redis-data:/data
command: ["redis-server", "--appendonly", "yes"]
2 changes: 1 addition & 1 deletion lib/cenit/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def client?

def client
unless instance_variable_defined?(:@redis_client)
client = ::Redis.new
client = ::Redis.new(host: ENV["REDIS_HOST"], port: 6379, db: 15)
client =
begin
client.ping
Expand Down

0 comments on commit 52c6682

Please sign in to comment.