If you are hosting your sites with apache and passenger on ubuntu and things are not working as expected in production environment then you should try these three steps, which often works for me :
1. Precompile your assets : It would take time so be patient and let rails do it works.
cg@ubuntu:~/your_app$RAILS_ENV=production rake assets:precompile
2. Run Migration on production Server : Sometime we forget to migrate our data in production server. We know that rails have three different databases for development, production and testing, therefore running migration on production server is important.
cg@ubuntu:~/your_app$rake db:migrate RAILS_ENV="production"
3.Restart Apache : With passenger and apache, if you do slightest of change you need to restart apache again. There are other solutions to automate this but for now just do it.
cg@ubuntu:~/your_app$sudo service apache2 reload
Heroku Users:
Asset Pre compilation in heroku is somewhat different than local computer because we need to do it in production environment.
cg@ubuntu:~/your_app$RAILS_ENV=production bundle exec rake assets:precompile
After running above command use git and the upload that git to heroku.
cg@ubuntu:~/your_app$git add .
cg@ubuntu:~/your_app$git commit -m "assets precompile on heroku"
cg@ubuntu:~/your_app$git push heroku master
I hope that helped!
No comments:
Post a Comment