Skip to content
Matthew edited this page Nov 15, 2015 · 5 revisions

Introduction

This is an expansion of what's on the Production wiki page.

Running locally

Build the container

docker build -t jolly_advisor .

Pull the postgres container

docker pull postgres:latest

Create the env files alhost:8080/

jolly_env.env

THE_JOLLY_ADVISOR_DATABASE_USERNAME=user
THE_JOLLY_ADVISOR_DATABASE_PASSWORD=password
THE_JOLLY_ADVISOR_DATABASE_HOST=jollypostgres
THE_JOLLY_ADVISOR_DATABASE_PORT=5432
RAILS_ENV=production
SECRET_KEY_BASE=LOLSECRET
RAILS_SERVE_STATIC_FILES=true

jolly_postgres_env.env

POSTGRES_PASSWORD=password
POSTGRES_USER=user

Create a directory for the postgres datasets

Run the database (in the foreground)

docker run --rm --name jollypostgres --env-file=/full/path/to/jolly_postgres_env.env -v /full/path/to/postgres/save/location:/var/lib/postgresql/data/ postgres

Create the database

docker exec jollypostgres su postgres sh -c "createdb the_jolly_advisor_production"

Migrate the database

docker run --rm --link jollypostgres:jollypostgres --env-file=/full/path/to/jolly_env.env jolly_advisor rake db:migrate

Precompile assests

docker run --rm --link jollypostgres:jollypostgres --env-file=/full/path/to/jolly_env.env jolly_advisor rake assets:precompile

Add the info from sis

docker run --link jollypostgres:jollypostgres --rm ---env-file=/full/path/to/jolly_env.env jolly_advisor rake import:data_dump

And run the actual app (again, in the foreground)

docker run --rm --name jolly --link jollypostgres:jollypostgres -p 3000:3000 --env-file=/full/path/to/jolly_env.env jolly_advisor

If docker --version >= 1.3.0, you can enter a running container with docker exec $container_name.