Open
Description
I'm running into an issue with the following passenger-docker setup (see below), the rails config/application.rb
file does pick up the right env vars passed to the docker run
command. However, in the stack trace, mysql2 still tries to connect using root
and local socket, ignoring the host, username and password env vars that are passed in
Dockerfile
FROM phusion/passenger-ruby21:0.9.15
ENV HOME /root
CMD ["/sbin/my_init"]
EXPOSE 80
RUN rm -f /etc/service/nginx/down
RUN rm /etc/nginx/sites-enabled/default
ADD nginx.conf /etc/nginx/sites-enabled/appname.conf
ADD rails-env.conf /etc/nginx/main.d/rails-env.conf
WORKDIR /tmp
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install
ADD . /home/app/appname
RUN chown -R app:app /home/app/appname
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
nginx.conf
server {
listen 80;
server_name appname.optimispt.local;
root /home/app/appname/public;
passenger_enabled on;
passenger_user app;
passenger_ruby /usr/bin/ruby2.1;
}
rails-env.conf
env PASSENGER_APP_ENV;
env RACK_ENV;
env RAILS_ENV;
env SECRET_KEY_BASE;
env DB;
env DB_USER;
env DB_PASS;
env DB_HOST;
The docker command is docker run -d -e PASSENGER_APP_ENV=development -e DB=appname_development -e DB_USER=user -e DB_PASS=pass -e DB_HOST=10.0.2.2 -p 80:80
Metadata
Metadata
Assignees
Labels
No labels