- Setup Docker.
cd
into your workspace andgit clone
this repo.cd
into the newly copied repo and run the following commands.
docker-compose build
docker-compose run app rake db:create db:migrate db:seed
- Start the application with
docker-compose up
. - The app should now be running at localhost:3000
- No need for two windows here, just run
docker-compose run app bundle install
- In one window run
docker-compose up
. This will start up the app and the postgres database and run them in that window. Press Ctrl-C to stop these processes*. - In the second window run
docker-compose run app rails c
. This will connect to theapp
container, which is the one running the rails app, thepostgres
container is the one that is running postgres.
- Perform step 1 from above, and then run
docker-compose run app bash
, the parameter afterdocker-compose run app
is the first command that will be ran upon container boot. If you leave it blank it defaults to runningrails server
you can see that in the Dockerfile.
- Once again, no reason for two windows, just run
docker-compose run web rspec
, you can optionally specify the name of an individual file like you normally would. IEdocker-compose run app rspec spec/path/to/spec.rb
- Same instructions as starting a rails console session, just run
docker-compose run app tail -f log/development.log
instead.
-
docker-compose up -d
- Bring up services in the background -
docker-compose logs -f ${service}
- Tail logs for a service -
docker-compose exec ${service} ${command}
- execute a command in a service -
docker-compose ps
- list running services -
docker-compose up -d --scale
${service}=${n} - scale service to n instances. You can use this to scale down as well. -
docker-compose port ${service} ${port}
- list port mappings for service, for this to work ports in the compose yaml file must be automatically assigned, i.e. "8080" -
docker-compose restart ${service}
- restart a service -
docker-compose run ${service} ${command}
- execute a command in a new container of a service
Use lvh.me
locally might need to run ps aux | grep httpd
to see if apache is running and sudo apachectl stop
to kill it if it is.
Postgres container doc
pg_dump --format=c -h HOST -U USER DB_NAME > production.dump
docker-compose exec postgres su postgres && pg_restore -v -d fantasyfootballdata_development production.dump
bundle exec rake yahoo:add_weekly_stats RAILS_ENV=production