Skip to content

Deployment con docker #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM phusion/passenger-ruby22:latest
MAINTAINER "Miguel Angel Gordian [email protected]"

ENV HOME /root

CMD ["/sbin/my_init"]
RUN ruby-switch --set ruby2.2

USER app
WORKDIR /home/app/api_cdmx

ADD . /home/app/api_cdmx
ADD docker/api_cdmx.conf /etc/nginx/sites-enabled/
ADD docker/00_app_env.conf /etc/nginx/conf.d/
ADD docker/api_cdmx-env.conf /etc/nginx/main.d/
ADD docker/database.yml /home/app/api_cdmx/config/database.yml

USER root
RUN bundle install
RUN rm -f /etc/service/nginx/down
RUN rm /etc/nginx/sites-enabled/default
RUN chown -R app:app /home/app/api_cdmx

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
postgres:
image: postgres:9.4
env_file: keys.env

apilabcdmx:
build: .
ports:
- "8080:80"
links:
- postgres
env_file: keys.env
environment:
PASSENGER_APP_ENV: production

backup:
image: civicadigital/backup
links:
- postgres
# env_file: backup.env
3 changes: 3 additions & 0 deletions docker/00_app_env.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# /etc/nginx/conf.d/00_app_env.conf
# File will be overwritten if user runs the container with `-e PASSENGER_APP_ENV=...`!
passenger_app_env development;
21 changes: 21 additions & 0 deletions docker/api_cdmx-env.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
env ECOBICI_CLIENT_ID;
env ECOBICI_CLIENT_SECRET;

env SEMOVI_TAXIS_PASSWORD;

env FINANZAS_USUARIO;
env FINANZAS_PASSWORD;

env SSP_CORRALONES;

env SECRET_KEY_BASE;

env PASSENGER_APP_ENV;

env NEW_RELIC_APP_NAME;
env NEW_RELIC_LICENSE_KEY;

env POSTGRES_PORT_5432_TCP_ADDR;
env POSTGRES_PORT_5432_TCP_PORT;
env POSTGRES_USERNAME;
env POSTGRES_PASSWORD;
10 changes: 10 additions & 0 deletions docker/api_cdmx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 80;
server_name api.labcd.mx;
root /home/app/api_cdmx/public;

passenger_enabled on;
passenger_user app;

passenger_ruby /usr/bin/ruby2.2;
}
24 changes: 24 additions & 0 deletions docker/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
default: &default
adapter: postgresql
pool: 5
timeout: 5000
encoding: unicode

development:
<<: *default
database: labcdmx_development
username:
password:

test:
<<: *default
database: labcdmx_test
username:
password:

production:
<<: *default
database: labcdmx_production
username: postgres
password: <%= ENV["POSTGRES_PASSWORD"] %>
host: <%= ENV["POSTGRES_PORT_5432_TCP_ADDR"] %>