Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Find a happy home for rake assets:precompile #185

Closed
vbrown608 opened this issue Sep 14, 2016 · 1 comment
Closed

Find a happy home for rake assets:precompile #185

vbrown608 opened this issue Sep 14, 2016 · 1 comment
Assignees

Comments

@vbrown608
Copy link
Collaborator

It used to be added to "command" in the production Dockerfile, ex command: bash -c unicorn && rake assets:precompile

That caused about 15 seconds of downtime on deploy as the assets compiled.

I moved it to the Dockerfile a few weeks, since it seems to fit with building the application image. That started causing problems because .js.erb files relied on environment variables that were not set at the time the container was being built.

I moved it (and rake webshims:update_public) to docker/entrypoint.sh for now, but that will still cause downtime when we deploy. Need to find a better solution.

@vbrown608
Copy link
Collaborator Author

vbrown608 commented Sep 21, 2016

@wioux and I discussed two approaches to solving this problem:

  1. Remove references to environment variables from all files with /assets and precompile assets on build. Two drawbacks to this solution:
    • Future contributors might not know this will create problems
    • It mixes the dev and production setups by always requiring assets to be precompiled
  2. Precompile assets in entrypoint.sh and use the load balancer to avoid downtime. Example described here: Deploying updates to production with zero downtime docker/compose#734 (comment) - I think this is a better solution as long as it works with out setup.

We'd like to discuss with @actualben when he gets back.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant