Env:
Ruby 2.6.3 / Rails 6.0 / Capistrano 3.14.1
Problem:
cap production deploy is very slow, almost 10 minutes. The log shows $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile takes about 8 minutes. I use the same comand and run it locally, it's very quick. So what is the problem and how to reslove it.
The problem is the server performance limit & the solution is https://github.com/stve/capistrano-local-precompile if anyone is interested. It works well for me, which reduce the time to ~20 seconds.
Related
I am having a problem with Heroku CI on a rails application. I just upgraded to Rails 7.0.1
Previous version was Rails 6.1.4.4
# Ferrum::TimeoutError:
# Timed out waiting for response. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the :timeout option to a higher value might help.
This is how my Procfile looks like
web: bundle exec puma -C config/puma.rb
release: bundle exec rails db:migrate
Probably you're receiving this error because the :timeout parameter is missing in the Dynos. Try to create a Procfile and pas a :timeout var.
You can find some more useful help right here: https://devcenter.heroku.com/articles/request-timeout
I have been working on a rails app for months and then, all of a sudden the pumas server does not work on my laptop. I've tried different older branches (in case I changed something) I've uninstalled and reinstalled ruby. Nope. It DOES work if I do a fresh pull and load it on my desktop, so it seems to be something on my laptop? I am really lost.
Here's what I've done already:
Restarted the computer
reinstalled ruby
Tried puma
Tried rails s
Tried different branches to see if something I did yesterday somehow broke it
reinstalled gems
The error is:
The localhost page isn’t working
localhost didn’t send any data.
However, right before it was running this error, it ran a Request time out error, if that matters.
What I really don't understand is why it's only happening on one computer.
I am running Ruby 2.3.0 and rails 4.2.6
UPDATE
It DOES running rails server and not puma.
The problem is, I'm using foreman to start sidekiq with my server, and that's how I debug sidekiq queues. Strangely, sidekiq still works, but I can't access the localhost page.
This is my procfile:
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -c 2 -q default -q mailers
Again, I haven't changed anything with puma and rails s works fine.
Sorry if this question sounds basic. But I haven't been able to find an answer anywhere on the web...
I'm currently running my Rails app on a Ubuntu server. Until now I've always shut down the production app before I pull the changes, run rake assets:clean assets:precompile, and only boot up the Rails app again once the process is finished.
I'm not sure whether the shutting down of app is necessary(i.e. if I don't do it, my app will behave erratically). It induces about 5 minutes of down time.
If that's a must, then maybe I should try to do local precompilation/more advanced deployment procedure, in order to reduce downtime? (Tried local compilation according to http://guides.rubyonrails.org/asset_pipeline.html#local-precompilation, but then after deleting original public/assets and pulling locally precompiled public/assets from the repo, the production server was having rack timeout all the time and won't render anything.)
YES you run rake assets:precompile Rails looks through your assets folder and copies over everything that is not Javascript or CSS into public/assets. It then creates application.js by reading app\assets\javascripts\application.js, and application.css by reading app\assets\stylesheets\application.css, loading up all the "require" files it finds in there.
So yes..you can do it ..but if you ran rake assets:clean..and then precompile...then public/assets will be updated with new compiled assets.
Dont forget to restart the server :)
I have deployed my app on Heroku but am running into issues that I don't have when running the app locally. Because of this, I'm making a lot of tweaks to my code, and I'm finding that my workflow for pushing new code to Heroku takes a long amount of time (about 5 min each time), so I'm wondering if I'm doing something wrong. Before I push my code, I precompile my assets using
rake assets:precompile
This takes a few minutes to do. Then I do a commit and push my code to Heroku using:
git push heroku master
This also takes a few minutes to do. Do I need to precompile every time I push code to Heroku? Is there any way of making this process faster?
No - The Heroku Ruby buildpack will run assets:precompile for you if you haven't already.
https://devcenter.heroku.com/articles/rails-asset-pipeline
I use Jenkins to test and deploy a Rails 3 application. It fetches the source from a SVN repo, then runs:
bundle install --deployment
bundle exec rake assets:precompile
rake spec
The process is very slow, it takes more than an hour (!), when locally bundle install --deployment takes 3 minutes. I run ps aux on the server during the bundling process and it doesn't seem to be overloaded. What could be the cause of such strange behaviour? How could I fix it?
This may have to do with running Jenkins in the background (and/or as a service). Try running it in the foreground with java -jar jenkins.war an see if it helps.