Code Monkey home page Code Monkey logo

Comments (5)

cberkom avatar cberkom commented on July 4, 2024

FWIW, the approach I'm using is to have a separate postgres container for the database.

You can link the containers together, then expose the host and port environment variables to your app, and put these environment variables in your database.yml file.

My basic configuration looks like:

# /etc/nginx/main.d/app_name.conf
env POSTGRES_PORT_5432_TCP_ADDR;
env POSTGRES_PORT_5432_TCP_PORT;
# /home/app/app_name/config/database.yml (for a rails app)
development:
  adapter: postgresql
  encoding: unicode
  database: name_this_database
  username: postgres
  password:
  host: <%= ENV['POSTGRES_PORT_5432_TCP_ADDR'] %>
  port: <%= ENV['POSTGRES_PORT_5432_TCP_PORT'] %>
  pool: 5
  timeout: 5000
  template: template0
# Start a database container
docker run --name $DATABASE_CONTAINER_NAME -d postgres

# Start the app container
docker run --name $APP_CONTAINER_NAME -v /local_src_directory:/home/app/app_name --link $DATABASE_CONTAINER_NAME:postgres -d $APP_IMAGE_NAME

This gives you a database connection, but you'll still need to run rake db:setup or similar during startup to create and seed your DB.

from passenger-docker.

danielkummer avatar danielkummer commented on July 4, 2024

Thanks for your answer, I'm also using a separate container for the Postgres Database.
Your answer contains several useful hints to get me further.
But i was able to find the root of the problem by now.

The following should find its way into the Readme:

You have to do an apt-get update when using the images; e.g:

FROM phusion/passenger-full:0.9.11
ENV HOME /root
CMD ["/sbin/my_init"]

RUN apt-get update
...continue here

from passenger-docker.

skord avatar skord commented on July 4, 2024

@danielkummer I don't believe the full image includes dev headers, and yeah, you're right, you need to run apt-get update first or you'll try to pull old packages that don't exist anymore.

RUN apt-get update -qq
RUN /build/devheaders.sh

from passenger-docker.

danielkummer avatar danielkummer commented on July 4, 2024

@skord it works with the passenger-full image (even the devheaders) but it doesn't seem to work with passenger-customizable (which it should in my opinion)

from passenger-docker.

FooBarWidget avatar FooBarWidget commented on July 4, 2024

Probably a bug in passenger-customizable. I'll have a look once I have time.

from passenger-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.