# capistrano

Published articles for capistrano.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## 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: opinion

Language: en

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

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [Amazon Web Services](<https://devfeed.tech/topics/aws.md>), [Ansible](<https://devfeed.tech/topics/ansible.md>), [Jenkins](<https://devfeed.tech/topics/jenkins.md>), [CI/CD](<https://devfeed.tech/topics/cicd.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>), [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [jenkins](<https://devfeed.tech/tags/jenkins.md>), [rails](<https://devfeed.tech/tags/rails.md>)

### AI overview

The author describes troubleshooting a Rails application deployment on AWS after HatchBox failed and a Capistrano deployment appeared successful but produced a CSS-related 500 error. The article discusses a planned deployment approach involving Jenkins, Ansible, Capistrano, and other tools, but the supplied text does not include the final diagnosis or resolution.

### 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

## Writing a one-time script in Rails

DevFeed: [Writing a one-time script in Rails](<https://devfeed.tech/articles/writing-a-one-time-script-in-rails-26280.md>)

Original publisher: [Read original article](<https://www.justinweiss.com/articles/writing-a-one-time-script-in-rails/>)

Author: Justin Weiss

Published: 2017-02-14T06:08:51Z

Content type: tutorial

Language: en

Sources: [Justin Weiss](<https://devfeed.tech/sources/justin-weiss.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Script](<https://devfeed.tech/topics/script.md>), [data](<https://devfeed.tech/topics/data.md>), [migration](<https://devfeed.tech/topics/migration.md>), [import](<https://devfeed.tech/topics/import.md>), [CSV](<https://devfeed.tech/topics/csv.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [capistrano](<https://devfeed.tech/tags/capistrano.md>), [csv](<https://devfeed.tech/tags/csv.md>), [data](<https://devfeed.tech/tags/data.md>), [database](<https://devfeed.tech/tags/database.md>), [heroku](<https://devfeed.tech/tags/heroku.md>), [import](<https://devfeed.tech/tags/import.md>), [job](<https://devfeed.tech/tags/job.md>), [migration](<https://devfeed.tech/tags/migration.md>), [other](<https://devfeed.tech/tags/other.md>), [rails](<https://devfeed.tech/tags/rails.md>), [rake](<https://devfeed.tech/tags/rake.md>), [scheduler](<https://devfeed.tech/tags/scheduler.md>), [script](<https://devfeed.tech/tags/script.md>), [sidekiq](<https://devfeed.tech/tags/sidekiq.md>), [structure](<https://devfeed.tech/tags/structure.md>)

### AI overview

This Rails tutorial explains how to handle one-time data tasks, comparing database migrations with rake tasks and scheduled background jobs. It recommends rake tasks for code that must be tested locally and run in production, while noting when migrations are appropriate and what risks model changes can create.

### Source excerpt

Have you ever wanted to import a bunch of data into your app from a CSV file? Or maybe you need to fix badly encoded characters in some of your customer reviews. Or you changed your mind about how you wanted to store data in Redis, and had to move everything from the old format to the new one. At Avvo, we called these "ad-hoc tasks." As in, you probably only need to run them once. So what's the best way to handle an ad-hoc task in Rails? Write a database migration A migration works well if you need to change the structure of the data in your database. It tracks whether the task was run, it carries over changes to other environments - it's what migrations were built for. It's also what you're probably already using them for. If you're changing data at the same time, a migration might work well. But there are some things to watch out for. Calling something like Permissions.create(...) in your migration can cause you trouble. If the model has changed, your migration might break, because your model might not be available when the migration runs. Or your model might have changed between the time you wrote the migration and when it ran. There are ways to get around this, but they're error-prone and can fail in weird ways. Migrations are also less useful if your task doesn't involve ActiveRecord. These aren't deal-breakers. But I tend not to import or change much data in migrations. There are better options. Write a rake task You have a task. You probably only want to run it once. And you want to be able to test it on your machine and run it in production. Rake tasks work really well for this. Rails can even generate rake tasks for you: $ be rails g task locations import create lib/tasks/locations.rake This creates a file for you to stash your code into: lib/tasks/locations.rakenamespace :locations do desc "TODO" task import: :environment do end end Inside that task block, you can use all your models and the rest of the code in your Rails app. It's easy to import and chang