First capistrano deploy does't make any effect - ruby-on-rails

how is it going? I have a Rails 4 app and I'm trying to deploy it with capistrano 3 on my server.
I already installed with bundle install and cap install, generating the files. I already added my info com deploy.rb file and when I run the command for the first deploy, it doesn't print the log on my console and do any effect.
usuario$ cap production deploy
usuario$
I ran this command with the --trace to see more details:
usuario$ cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rvm:hook (first_time)
** Invoke passenger:rvm:hook (first_time)
** Invoke passenger:test_which_passenger (first_time)
** Execute passenger:test_which_passenger
** Execute passenger:rvm:hook
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
** Invoke bundler:map_bins (first_time)
** Invoke passenger:bundler:hook (first_time)
** Execute passenger:bundler:hook
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
** Execute git:check
** Invoke deploy:check:directories (first_time)
** Execute deploy:check:directories
** Invoke deploy:check:linked_dirs (first_time)
** Execute deploy:check:linked_dirs
** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
** Invoke deploy:check:linked_files (first_time)
** Execute deploy:check:linked_files
** Invoke deploy:set_previous_revision (first_time)
** Execute deploy:set_previous_revision
** Invoke deploy:started (first_time)
** Execute deploy:started
** Invoke deploy:updating (first_time)
** Invoke deploy:new_release_path (first_time)
** Execute deploy:new_release_path
** Execute deploy:updating
** Invoke git:create_release (first_time)
** Invoke git:update (first_time)
** Invoke git:clone (first_time)
** Invoke git:wrapper
** Execute git:clone
** Execute git:update
** Execute git:create_release
** Invoke deploy:set_current_revision (first_time)
** Execute deploy:set_current_revision
** Invoke git:set_current_revision (first_time)
** Execute git:set_current_revision
** Invoke deploy:symlink:shared (first_time)
** Execute deploy:symlink:shared
** Invoke deploy:symlink:linked_files (first_time)
** Execute deploy:symlink:linked_files
** Invoke deploy:symlink:linked_dirs (first_time)
** Execute deploy:symlink:linked_dirs
** Invoke deploy:updated (first_time)
** Invoke bundler:install (first_time)
** Execute bundler:install
** Execute deploy:updated
** Invoke deploy:compile_assets (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:compile_assets
** Invoke deploy:assets:precompile (first_time)
** Execute deploy:assets:precompile
** Invoke deploy:assets:backup_manifest (first_time)
** Execute deploy:assets:backup_manifest
** Invoke deploy:cleanup_assets (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:cleanup_assets
** Invoke deploy:normalize_assets (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:normalize_assets
** Invoke deploy:migrate (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:migrate
** Invoke deploy:publishing (first_time)
** Execute deploy:publishing
** Invoke deploy:symlink:release (first_time)
** Execute deploy:symlink:release
** Invoke deploy:restart (first_time)
** Execute deploy:restart
** Invoke passenger:restart (first_time)
** Execute passenger:restart
** Invoke deploy:published (first_time)
** Execute deploy:published
** Invoke deploy:finishing (first_time)
** Execute deploy:finishing
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup
** Invoke deploy:finished (first_time)
** Execute deploy:finished
** Invoke deploy:log_revision (first_time)
** Execute deploy:log_revision
usuario$
...and anything was created on the server (current and release folder).
Any ideas what I'm doing wrong? I appreciate any clue.
EDIT
That is my deploy.rb
# config valid only for current version of Capistrano
lock '3.5.0'
set :application, 'my_app_name'
set :repo_url, 'my_user#my_server_ip:/my_path_to/app_repo.git'
set :deploy_to, "/var/www/my_app_name"
set :default_stage, "production"
set :linked_files, fetch(:linked_files, []).push('config/database.yml')
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')
set :keep_releases, 3
set :default_env, { rvm_bin_path: '~/.rvm/bin' }

Related

Assets compile failed with out of memory

I try to compile assets on the production server, but when I run rake task with compile - process goes too long and I get error with memory out.There is trace
RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke bower:before_precompile (first_time)
** Execute bower:before_precompile
** Execute assets:precompile
rake aborted!
ExecJS::RuntimeError: FATAL ERROR: Evacuation Allocation failed - process out of memory
(execjs):1
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:219:in `exec_runtime'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:39:in `exec'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:21:in `eval'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:46:in `call'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:212:in `run_uglifyjs'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:179:in `compile'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/sprockets-3.3.2/lib/sprockets/uglifier_compressor.rb:52:in `call'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/sprockets-3.3.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/sprockets-3.3.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/ubuntu/staging/releases/21/vendor/bundle/ruby/2.2.0/gems/sprockets-3.3.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
I also try run this with config.assets.compile = false but I get same error, how I can fix it?
sorry for my bad English

Rails 3.2.13 - application.css isn't precompiled

The error I am getting on the main page is:
We're sorry, but something went wrong.
The error I am getting in the log file (log/production.log):
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>Reach</title>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= requirejs_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___2601724748379559821_29475380'
I have looked at this:
rails 3.1.0 ActionView::Template::Error (application.css isn't precompiled)
bundle exec rake assets:precompile
In console it shows:
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
I get the same error
Any suggestions?
UPDATE
I traced the precompile, this is the results:
** Invoke assets:precompile (first_time)
** Invoke requirejs:precompile:external (first_time)
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:external
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/bin/rake requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke requirejs:precompile:all (first_time)
** Invoke requirejs:precompile:prepare_source (first_time)
** Invoke requirejs:setup (first_time)
** Invoke assets:environment (first_time)
** Invoke requirejs:precompile:disable_js_compressor (first_time)
** Execute requirejs:precompile:disable_js_compressor
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute requirejs:setup
** Invoke requirejs:clean (first_time)
** Invoke requirejs:setup
** Execute requirejs:clean
** Execute requirejs:precompile:prepare_source
** Invoke requirejs:precompile:generate_rjs_driver (first_time)
** Invoke requirejs:setup
** Execute requirejs:precompile:generate_rjs_driver
** Invoke requirejs:precompile:run_rjs (first_time)
** Invoke requirejs:setup
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:run_rjs
** Invoke requirejs:precompile:digestify_and_compress (first_time)
** Invoke requirejs:setup
** Execute requirejs:precompile:digestify_and_compress
** Execute requirejs:precompile:all
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p429/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
UPDATE 2
Everything was working, I needed to touch tmp/restart.txt to restart Rails after my precompiling.
Try RAILS_ENV=production bundle exec rake assets:precompile
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
Okay, I realized I didn't mention above, but I am new to RoR. I am adding this here in case anyone runs into the same easy mistake I did.
I had to
touch tmp/restart.txt
After precompiling.

Rails: how to debug assets:precompile failure on cap deploy

I'm getting a cryptic error on cap deploy
$ cap deploy
. . .
* executing "cd -- /rails/myapp/releases/20130919002235 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["persephone"]
[persephone] executing command
. . .
** [out :: persephone] rake aborted!
** [out :: persephone] Caught Encoding::CompatibilityError at '["ok","(function() {': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
** [out :: persephone] (in /rails/myapp/releases/20130919002235/app/assets/javascripts/disk_files.js.coffee)
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:242:in `rescue in parse_string'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:213:in `parse_string'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:257:in `parse_value'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:121:in `parse'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
. . .
In trying to debug the problem I've tried completely removing disk_files.js.coffee and then the same error occurs for application.js.
I've then changed my application.js manifest so that it doesn't require anything and then I get a similar error for application.css
I've commented out my custom css and now I get:
** [out :: persephone] rake aborted!
** [out :: persephone] undefined method `[]' for nil:NilClass
** [out :: persephone] (in /rails/myapp/releases/20130919200133/app/assets/stylesheets/application.css)
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/sass_functions.rb:63:in `sprockets_context'
Each of these steps requires a git commit to origin and then a cap deploy.
FWIW- adding #encoding: UTF-8 as per SO#9857443 doesn't help.
Anyone know what's going on? How can I debug this?

Getting "stack level too deep" error when deploying with Capistrano, Rails 3.1 ruby 1.9.2

Here is the log for the cap deploy script output around where the error occurs. Anny suggestions why this might be happening? Thanks!
[yup.la] executing command
[yup.la] sh -c 'cd /srv/www/portrait/releases/20120406051647 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'
** [out :: yup.la] rake aborted!
** [out :: yup.la]
** [out :: yup.la] stack level too deep
** [out :: yup.la] (in /srv/www/portrait/releases/20120406051647/app/assets/stylesheets/mobile.css.scss)
** [out :: yup.la]
** [out :: yup.la] Tasks: TOP => assets:precompile:primary
** [out :: yup.la] (See full trace by running task with --trace)
** [out :: yup.la]
command finished in 30868ms
*** [deploy:update_code] rolling back
* executing "rm -rf /srv/www/portrait/releases/20120406051647; true"
servers: ["yup.la"]
[yup.la] executing command
[yup.la] sh -c 'rm -rf /srv/www/portrait/releases/20120406051647; true'
command finished in 288ms
failed: "sh -c 'cd /srv/www/portrait/releases/20120406051647 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on yup.la
/Users/victorstan/Sites/portrait ∴
Try to change your sass-rails version from 3.1.5 to 3.1.4 in your Gemfile.

Rakefile not getting deployed with capistrano

I am getting this error when deploying with capistrano:
executing "cd /opt/my_app/dev/releases/20100103021722; rake RAILS_ENV=staging db:migrate"
servers: ["96.30.33.84"]
[96.30.33.84] executing command
** [out :: 96.30.33.84] rake aborted!
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in `raw_load_rakefile'
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] (See full trace by running task with --trace)
** [out :: 96.30.33.84]
It randomly just started occurring. I found out the problem was that my new deploys are missing my rake file...however I am deploying from my staging branch and I can confirm that my staging branch has the Rakefile. Somehow it's not getting deployed. Does anyone know how to troubleshoot this?
I assume that you are using some sort of vcs (svn/git/etc.), have the files been ignored by the repo, ie. they aren't getting deployed with the app, thus not showing up on staging?

Resources