Search code examples
ruby-on-railsruby-on-rails-3capistranosprocketsrvm-capistrano

Capistrano / Rails 3.2.14 / Sprockets - not finalizing deploy in production


I am migrating a Rails application I created a few years ago and did not deploy it for a long time to a new server. At the time, I used capistrano with no problems and now, when I run cap deploy I get the following step failed:

  * executing "ls -1 /home/deploy/mywebsite.com/shared/assets/.sprockets-manifest* | wc -l"
    servers: ["45.79.142.32"]
    [45.79.142.32] executing command
    command finished in 727ms
  * executing "ls /home/deploy/mywebsite.com/shared/assets/.sprockets-manifest*"
    servers: ["45.79.142.32"]
    [45.79.142.32] executing command
    command finished in 783ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deploy/mywebsite.com/releases/20150812101128; true"
    servers: ["45.79.142.32"]
    [45.79.142.32] executing command
    command finished in 944ms
failed: "rvm_path=/home/deploy/.rvm /home/deploy/.rvm/bin/rvm-shell 'ruby-2.2.2' -c 'ls /home/deploy/mywebsite.com/shared/assets/.sprockets-manifest*'" on 45.79.142.32

I read in a few places about sprockets changing the manifest file name or type (from .sprockets-manifest to .manifest or something), but I have no idea of how to solve it in a way that it isn't a hack. I am not sure if this is due to using old Rails version or something. This are the versions I am using:

  • Ruby 2.2.2
  • Rails 3.2.14
  • Capistrano 2.15.6 (with Rvm/capistrano)
  • Sprockets 2.2.1

Solution

  • The solution was ridiculous. Searching the web, I found out that sprockets was looking for the .sprockets-manifest.json file. Which didn't exist (and this I don't know why). So I just created it manually in the shared/assets folder:

    touch shared/assets/.sprockets-manifest.json
    

    It worked like a charm. Hope this helps others.