During deploy, I get the following output:
[xx.xxx.xxx.xx] executing command
** [out :: xx.xxx.xxx.xx] ** Invoke assets:precompile (first_time)
** [out :: xx.xxx.xxx.xx] ** Execute assets:precompile
** [out :: xx.xxx.xxx.xx]
** [out :: xx.xxx.xxx.xx] ** Invoke assets:precompile:all (first_time)
** [out :: xx.xxx.xxx.xx] ** Execute assets:precompile:all
** [out :: xx.xxx.xxx.xx] ** Invoke assets:precompile:primary (first_time)
** [out :: xx.xxx.xxx.xx] ** Invoke assets:environment (first_time)
** [out :: xx.xxx.xxx.xx] ** Execute assets:environment
** [out :: xx.xxx.xxx.xx] ** Invoke environment (first_time)
** [out :: xx.xxx.xxx.xx] ** Execute environment
** [out :: xx.xxx.xxx.xx] ** Invoke tmp:cache:clear (first_time)
** [out :: xx.xxx.xxx.xx] ** Execute tmp:cache:clear
** [out :: xx.xxx.xxx.xx] ** Execute assets:precompile:primary
** [out :: xx.xxx.xxx.xx] Killed
bundle -v output is 1.1.5
The solution I've found is to reboot the server and deploy immediately after. Otherwise, I'm unable to deploy to production and I'm not sure how to debug this issue as there is no output other than it dying on deploy.
Edit: server is running Ubuntu 12.04 x64
I have similar issue today, try the solution for this following question
https://stackoverflow.com/a/11893146
Related
None of my assets, such as images, javascripts, and styling features are showing up when I run the following command:
RAILS_ENV=production rails s
Then I go to http://localhost:3000 and the application comes up, but has no styling at all.
I did precompile the assets:
➜ myapp git:(master) ✗ bundle exec rake assets:precompile --trace
Invoke assets:precompile (first_time)
Execute assets:precompile
/Users/me/.rvm/rubies/ruby-1.9.3-p545/bin/ruby /Users/me/.rvm/gems/ruby-1.9.3-p545#myapp/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
Invoke assets:precompile:all (first_time)
Execute assets:precompile:all
Invoke assets:precompile:primary (first_time)
Invoke assets:environment (first_time)
Execute assets:environment
Invoke environment (first_time)
Execute environment
Invoke tmp:cache:clear (first_time)
Execute tmp:cache:clear
Execute assets:precompile:primary
Invoke assets:precompile:nondigest (first_time)
Invoke assets:environment (first_time)
Execute assets:environment
Invoke environment (first_time)
Execute environment
Invoke tmp:cache:clear (first_time)
Execute tmp:cache:clear
Execute assets:precompile:nondigest
This works just fine in Safari, can't figure out why Chrome won't load the stuff. I cleared out the browser cache also.
In config/environments/production.rb, make sure your application is configured to serve static assets:
config.serve_static_assets = true
By default, Rails assumes that your static assets will be served elsewhere (e.g. Apache, Nginx, etc.)
As can be seen from the following excerpt of the output of a cap deploy ** [out :: 178.79.170.199] Using bcrypt-ruby (3.0.1) the bcrypt-ruby gem is installed on my server but unicorn is unable to start up properly and is complaining that bcrypt-ruby gem is not part of the bundle.
UPDATE - Exact error message is
/home/myuser/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem': bcrypt-ruby is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
I have restarted both my nginx server and unicorn.
How can I fix this?
An excerpt of console output from cap deploy
** [out :: 178.79.170.199] Using bcrypt-ruby (3.0.1)
** [out :: 178.79.170.199] Using highline (1.6.15)
** [out :: 178.79.170.199] Using net-ssh (2.6.3)
** [out :: 178.79.170.199] Using net-scp (1.0.4)
** [out :: 178.79.170.199] Using net-sftp (2.0.5)
** [out :: 178.79.170.199] Using net-ssh-gateway (1.1.0)
** [out :: 178.79.170.199] Using capistrano (2.14.1)
** [out :: 178.79.170.199] Using coffee-script-source (1.4.0)
** [out :: 178.79.170.199] Using execjs (1.4.0)
** [out :: 178.79.170.199] Using coffee-script (2.2.0)
** [out :: 178.79.170.199] Using rack-ssl (1.3.3)
** [out :: 178.79.170.199] Using json (1.7.6)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using rdoc (3.12)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using thor (0.17.0)
** [out :: 178.79.170.199] Using railties (3.2.11)
** [out :: 178.79.170.199] Using coffee-rails (3.2.2)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using jquery-rails (2.2.0)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using kgio (2.8.0)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using mysql2 (0.3.11)
** [out :: 178.79.170.199] Using bundler (1.2.3)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using rails (3.2.11)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using raindrops (0.10.0)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using rvm-capistrano (1.2.7)
** [out :: 178.79.170.199]
** [out :: 178.79.170.199] Using sass (3.2.5)
** [out :: 178.79.170.199] Using sass-rails (3.2.6)
** [out :: 178.79.170.199] Using uglifier (1.3.0)
** [out :: 178.79.170.199] Using unicorn (4.5.0)
** [out :: 178.79.170.199] Your bundle is complete! It was installed into /home/myuser/myapp/shared/bundle
I am having no issues with other gems I have installed.
This issue was caused by ensuring that th nginx server was re booted properly. I actually had to re-boot the actual OS for this issue to clear itself up as nginx restarts and unicorn restarts just seemed to have no effect.
I added add_column :microposts, :type, :string to one of my db migrations (not the most recent one if that matters). and also ran rake db:reset. So I have definitely made changes. But now if I run rake db:migrate or bundle exec rake db:migrate, it doesn't output anything. If I run trace...
alex#alex-ThinkPad-T410:~/rails_projects/final2$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
You wrote:
I added add_column :microposts, :type, :string to one of my db
migrations (not the most recent one if that matters).
This suspiciously sounds, as if you just added the text into the migration file. That won't work. The migration state machine doesnt notice changes in the actual text files. Please check
rake db:migrate:status
You should instead create a new migration
rails g migration AddTypeToMicropost type:string
and then run rake again
I'm using Capistrano for the first time and ran into the following problem. My rails app is running on a VPS with CentOS Linux 6.0.
* executing `bundle:install'
* executing "ls -x ~/my_rails_app/releases"
servers: ["example.com"]
[example.com] executing command
command finished in 1225ms
* executing "cd ~/my_rails_app/releases/20120513095446 && bundle install --gemfile ~/my_rails_app/releases/2012051309
5446/Gemfile --path ~/my_rails_app/shared/bundle --deployment --quiet --without development test"
servers: ["example.com"]
[example.com] executing command
** [out :: example.com] /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native
extension. (Gem::Installer::ExtensionBuildError)
** [out :: example.com]
** [out :: example.com] /usr/bin/ruby extconf.rb
** [out :: example.com] checking for sqlite3.h... no
** [out :: example.com] sqlite3.h is missing. Try 'port install sqlite3 +universal'
** [out :: example.com] or 'yum install sqlite-devel' and check your shared library search path (the
** [out :: example.com] location where your sqlite3 shared library is located).
** [out :: example.com] *** extconf.rb failed ***
** [out :: example.com] Could not create Makefile due to some reason, probably lack of
** [out :: example.com] necessary libraries and/or headers. Check the mkmf.log file for more
** [out :: example.com] details. You may need configuration options.
** [out :: example.com]
** [out :: example.com] Provided configuration options:
** [out :: example.com] --with-opt-dir
** [out :: example.com] --without-opt-dir
** [out :: example.com] --with-opt-include
** [out :: example.com] --without-opt-include=${opt-dir}/include
** [out :: example.com] --with-opt-lib
** [out :: example.com] --without-opt-lib=${opt-dir}/lib
** [out :: example.com] --with-make-prog
** [out :: example.com] --without-make-prog
** [out :: example.com] --srcdir=.
** [out :: example.com] --curdir
** [out :: example.com] --ruby=/usr/bin/ruby
** [out :: example.com] --with-sqlite3-dir
** [out :: example.com] --without-sqlite3-dir
** [out :: example.com] --with-sqlite3-include
** [out :: example.com] --without-sqlite3-include=${sqlite3-dir}/include
** [out :: example.com] --with-sqlite3-lib
** [out :: example.com] --without-sqlite3-lib=${sqlite3-dir}/lib
** [out :: example.com] --enable-local
** [out :: example.com] --disable-local
** [out :: example.com]
** [out :: example.com]
** [out :: example.com] Gem files will remain installed in /home/example.com/my_rails_app/shared/bundle/ruby/1.8/gems/sqlite3-1.
3.6 for inspection.
** [out :: example.com] Results logged to /home/example.com/my_rails_app/shared/bundle/ruby/1.8/gems/sqlite3-1.3.6/ext/sqlite3/g
em_make.out
Any ideas?
Thanks in advance!
On Red-hat derivitives, you need to install the development package for sqlite so that the sqlite gem, which uses native extension, builds.
Try:
sudo yum install sqlite-devel
And then do
bundle install
When I run rake db:migrate, I don't get a response.
Doing a trace, I get the following but I am not sure how to interpret it:
$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
I am running rails 3.0.10.
As coreyword suggested, perhaps there are no new migrations to run.
The rake db:migrate command will exit silently when there's nothing (new) to do.