Skip to content

Deployment

Pietro edited this page Feb 7, 2019 · 20 revisions

NOTE: This is a sort of manual deployment. It may have a downtime due to build time when there are migrations.

Staging

  • Step 1: copy docker-compose.staging.yml and Dockerfile.staging to staging machine
  • Step 2: do the following on staging machine
$ git checkout staging
$ git pull origin staging
$ docker-compose -f docker-compose.staging.yml build
$ docker-compose -f docker-compose.staging.yml down # needed if there are migrations or changes to assets
$ docker-compose -f docker-compose.staging.yml run --rm app_staging rails db:migrate
$ docker-compose -f docker-compose.staging.yml up -d

For 'ruby-only' deployments, do not down, just pull and run

$ docker-compose -f docker-compose.staging.yml up --no-deps --build -d app_staging

Assets issues

In case assets are not updated, try a assets:precompile

$ docker-compose -f docker-compose.staging.yml exec app_staging rake assets:precompile

or a down, assets:precompile, and up -d

$ docker-compose -f docker-compose.staging.yml run --rm app_staging rake assets:precompile

Clean the Carrierwave cache

$ docker-compose -f docker-compose.staging.yml run --rm app_staging rake carrierwave:clean_cached_files

Production

  • Step 1: copy docker-compose.production.yml and Dockerfile.production to production machine
  • Step 2: do the following on production machine
$ git checkout master
$ git pull origin master
$ docker-compose -f docker-compose.production.yml build
$ docker-compose -f docker-compose.production.yml down # needed if there are migrations or changes to assets
$ docker-compose -f docker-compose.production.yml run --rm app_production rails db:migrate
$ docker-compose -f docker-compose.production.yml up -d

For 'ruby-only' deployments, do not down, just pull and run

$ docker-compose -f docker-compose.production.yml up --no-deps --build -d app_production

Assets issues

In case assets are not updated, try a assets:precompile

$ docker-compose -f docker-compose.production.yml exec app_production rake assets:precompile

or a down, assets:precompile, and up -d

$ docker-compose -f docker-compose.production.yml run --rm app_production rake assets:precompile

Clean the Carrierwave cache

$ docker-compose -f docker-compose.production.yml run --rm app_production rake carrierwave:clean_cached_files

Troubleshooting

Empty webpack manifest

Try to:

  • exec assets:precompile
  • down
  • up

After Gemfile update

Try to:

  • run --rm bundle install