-
Notifications
You must be signed in to change notification settings - Fork 21
Production
Using docker on docker.case.edu. If you can login to the server, it means I trust you enough to not break things. Please don't break things.
Everything needed for production is now merged into master. If you break production, Bentley will yell at you.
ssh [email protected]
, cd the_jolly_advisor
, git pull
, and docker build -t jolly_advisor .
. This will take a few minutes.
There really is no release step. The environment has already been set up. For the future we should add some way to version the environment as well.
If you want to test before deploying for some reason, use docker run --rm -i -t --link jollypostgres:jollypostgres --env-file /home/acm/case-acm-docker/jolly_env.env -p 3000:3000 jolly_advisor rails s -b 0.0.0.0 -p 3000
. The test server will be available at docker.case.edu:3000. Hit ctrl+c when you're done, and the container will destroy itself. Note that this will use the production database, so try not to break anything or somebody will yell at you.
cd ~/case-acm-docker/
, sudo ./hosting.sh restart jolly
. That's it. It may take up to 5 minutes for the interface to become reachable again.
If the app requires a database migration, run the following (while logged in as acm):
docker run -it --rm --link jollypostgres:jollypostgres --env-file=/home/acm/case-acm-docker/jolly_env.env jolly_advisor rake db:migrate
docker run -it --rm --link jollypostgres:jollypostgres --env-file=/home/acm/case-acm-docker/jolly_env.env -p 3000:3000 jolly_advisor /bin/bash
This will open a bash shell in an environment identical to what the app runs in. You can now do rails c
, rake db:migrate
(although see above for a better way to do that), etc. If you run a rails server, run it on 0.0.0.0:3000, so you can access it at docker.case.edu:3000.
You probably won't need to do this. If you do, you can run docker run -it --rm jollypostgres:postgres postgres /bin/bash
and access a psql shell with su postgres sh -c "psql -h postgres -U $jolly_user"
, where $jolly_user
is the user, and then enter the password. Finding the user and password is left as an exercise to the reader.
Postgres is running in a docker container. You probably shouldn't touch it. This is linked into the jolly_advisor container via the --link
option, which uses the hosts file to point jollypostgres
to the IP address of the postgres container.