# Rails Asset Pipeline Failures and Capistrano

DevFeed: [Rails Asset Pipeline Failures and Capistrano](<https://devfeed.tech/articles/rails-asset-pipeline-failures-and-capistrano-28270.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2020/04/14/rails-asset-pipeline-failures-and-capistrano.html>)

Author: Fuzzygroup

Published: 2020-04-14T00:00:00Z

Content type: article

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [ansible](<https://devfeed.tech/tags/ansible.md>), [asset-pipeline](<https://devfeed.tech/tags/asset-pipeline.md>), [aws](<https://devfeed.tech/tags/aws.md>), [capistrano](<https://devfeed.tech/tags/capistrano.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [jenkins](<https://devfeed.tech/tags/jenkins.md>), [rails](<https://devfeed.tech/tags/rails.md>)

## AI overview

A Rails asset pipeline can build successfully while its CSS remains unusable if Passenger is not restarted after deployment. The author's Capistrano deploy appeared to succeed, but CSS requests returned 500 errors and neither Rails nor NGINX logs showed a cause. The author resolved this by adding a post-deploy Capistrano task that uploads Passenger's expected `tmp/restart.txt` file to the app's `current/tmp` directory. The article notes that Capistrano extensions run outside Rails, so `Rails.root` is unavailable there; the example therefore uses an explicit local file path. The author suspects Rails 6 or a configuration mistake, but does not establish which caused the restart hook to fail. HatchBox had been unsuitable for the project's complex multi-repository, multi-language CI/CD needs; the planned setup combined Jenkins, Ansible, and Capistrano.

## Source excerpt

One of the single worst parts of being a one man show on an engineering effort is that when you hit a serious snag, well, you're fscked. I'm at the death march phase of a project, that wonderful stage, where you're so far into it that you can see the end but it seemingly never arrives - like the speed of light, it feels like you can never quite get there. Pro Tip: At this stage being asked by your manager, on a continuous basis, "anything that you can show me" is not helpful. It is actually an antipattern which simply slows the project by making the engineer feel even worse (yes I'm late and I can argue for scope creep, etc but I'll own it and I'm still late). Anyway I recently went through this with respect to getting a complex Rails code base deployed onto AWS. I started with my usual deploy tool of HatchBox but nothing worked and it was in the wee hours, and over a weekend, when I had no right to expect timely technical support so I figured "Ok I'll do a raw deploy with Capistrano" - and then the cluster fsck began in earnest. One of the general rules of technology is that everything is a two edged sword and where you get something, you give something. For example C gives outstanding performance and flexibility but it also can be a source of security issues, pointer bugs, buffer overflows, etc. Similarly Rails, even today, gives you: an unprecedentedly easy way to build web apps (provided you do it the Rails way) but deployment of modern Rails apps can be one of the most cursing laden experiences I've ever had The only easy way I've ever found to deploy Rails apps is HatchBox and HatchBox wasn't actually a good fit for this application due to particularly complex, multi language CI / CD requirements (4 different git repos spanning, today, two languages). The real deployment approach is going to be a combination of Jenkins + Ansible that drive Capistrano plus some other deployment tools. But I digress and have now devolved into a large number of words, more words