How to let passenger restart after deployment with capistrano

Posted Over 5 years ago by Kim Klotz.
github.com

...restart-app /path/to/app You should not need to know which one to use. Instead, the capistrano-passenger gem will choose the appropriate restart mechanism automatically based on your installed the...

...passenger version. Installation Add to your Gemfile: gem 'capistrano-passenger', require: false Add to your Capfile: require 'capistrano/passenger' Declare which server role should be restarted (optional). Usually passenger tries to...

Capistrano: How to find out which version of your application is currently live

Posted Almost 12 years ago by Arne Hartherz.

When deploying, Capistrano puts a REVISION file into your application's release directory. It contains the hash of the commit which was deployed. If you want to know the currently...

...deployed release, simply SSH to a server and view that file. $ cat /var/www/my-project/current/REVISION cf8734ece3938fc67262ad5e0d4336f820689307 Capistrano task When your application is deployed to multiple servers, you probably want to see a...

Capistrano: creating a database dump if migrating

Posted 5 months ago by Dominik Schöler.

In Capistrano 3, your Capfile requires 'capistrano/rails/migrations', which brings two Capistrano tasks: deploy:migrate and deploy:migrating. The former checks whether migrations should be performed. If so, the latter is...

How to make sure that manual deploy tasks (scheduled in Pivotal Tracker) are executed on deploy (with Capistrano)

Posted 7 months ago by Dominik Schöler.

...deploy:after_deploy_tasks' # Keep this last Deploy with bundle exec. Now, when deploying, Capistrano will first check if there are any pending before deploy tasks. If so, it will...

Configuring Webpacker deployments with Capistrano

Posted Over 3 years ago by Dominik Schöler.

...using Webpacker and Capistrano, there are a few configuration tweaks that optimize the experience. Using capistrano-rails capistrano-rails is a Gem that adds Rails specifics to Capistrano, i.e. support...

...here, but add the Webpacker cache dir (see link below) set :linked_dirs, %w[… tmp/cache/webpacker] # capistrano-rails config set :assets_roles, %i[webpack] # Give the webpack role to a single...

whenever: Installing cron jobs only for a given Rails environment or Capistrano stage

Posted Almost 4 years ago by Henning Koch.

...to install some tasks only for a given Rails environment or for a given Capistrano stage ("deployment target"). Installing jobs only for a given Rails environment In your schedule.rb you...

...environment=staging bundle exec whenever --set environment=production Installing jobs only for a given Capistrano stage In some apps we have custom capistrano stages like this: customer1-staging customer1-production...

Capistrano: Speeding up asset compile during deploy

Posted Over 5 years ago by Dominik Schöler.

Remember How to skip Sprockets asset compile during Capistrano deployment and Automatically skipping asset compilation when assets have not changed? Turns out there is an even better way to speed...

...up Capistrano deployments with asset compilation – and it's even simpler. Adding the asset cache directory to symlinked directories Popular asset managers for Rails are Sprockets and Webpacker. Both keep...

Capistrano 3: Running a command on all servers

Posted 4 months ago by Dominik Schöler.

This Capistrano task runs a command on all servers. bundle exec cap production app:run cmd='zgrep -P "..." RAILS_ROOT/log/production.log' Code # lib/capistrano/tasks/app.rake namespace :app do # Use e.g. to grep logs...

end else puts 'x Canceled.' end end Make sure you require custom Capistrano task files: # Capfile Dir.glob('lib/capistrano/tasks/*.rake').each do |r| # `import r` calls Rake.application.add_import(r...

Whenever requires you to set the application attribute in the Capistrano config

Posted Over 3 years ago by Emanuel.

Whenever requires you to set the application attribute in your Capistrano configuration. Otherwise your cronjobs are created multiple times. Example entry in config/deploy.rb: set :application, 'some-app' # allows "set :whenever...

Fix: esbuild assets are missing after capistrano deploy

Posted Almost 2 years ago by Tobias Kraze.

Issue: You have an app using jsbundling-rails and esbuild. After deploy, the assets built by esbuild are missing in...

Capistrano: Deployment issue undefined method `[]' for nil:NilClass

Posted About 3 years ago by Julian.

In newer passenger versions the output of passenger -v has changed. capistrano-passenger tries to parse the version and now causes the error undefined method '[]' for nil:NilClass. To fix...

...this you only need to upgrade the capistrano-passenger gem. Therefore run bundle update capistrano-passenger --conservative. The version change of passenger from 6.0.7 to 6.0.8 has triggered this problem...

Slack integration for deployments via Capistrano

Posted About 9 years ago by Arne Hartherz.
github.com

You can hook into Slack when using Capistrano for deployment. The slackistrano gem does most of the heavy lifting for you. Its default messages are unobtrusive and can be adjusted...

...it posts to a Slack channel like this: How to integrate Integrating Slackistrano with Capistrano 3 is fairly simple. In your Slack, open menu → Administration → Manage apps, and add an...

Capistrano 3 has slightly changed its symlink implementation

Posted Over 8 years ago by Dominik Schöler.

In Capistrano 2, directories in shared_children used to be symlinked to the shared directory during the finalize_update task. # /lib/capistrano/recipes/deploy.rb _cset :shared_children, %w(public/system log tmp/pids) # ... task :finalize...

...symlinks only the last segment here end # ... end This would symlink current/public/system to shared/system. Capistrano 3 (which is almost a complete rewrite of the project) now properly expands paths to...

Make Capistrano use SSH Key Forwarding

Posted About 12 years ago by Thomas Eisenbarth.

When deploying code with Capistrano (depending on your configuration) at some point Capistrano tries to check out code from your repository. In order to do so, Capistrano connects to your...

Fix for "Rails assets manifest file not found" in Capistrano deploy

Posted Over 4 years ago by Tobias Kraze.

...not found. This happens inside the deploy:assets:backup_manifest task. This task comes from capistrano-rails. It is build for Sprockets and does not work with Webpacker out of...

Solution Configure capistrano-rails to work with Webpacker Alternative If you are using capistrano-rails, but don't want to configure it for Webpacker, you can as well...

Capistrano: Delete old releases automatically

Posted Over 12 years ago by Thomas Eisenbarth.

Whenever you deploy using Capistrano, a new folder is created within the releases directory on the remote server containing the application code. By default Capistrano 3 keeps the last...

Fix Capistrano with RubyGems 1.6

Posted About 13 years ago by Tobias Kraze.

After updating your RubyGems, you will probably not be able to run Capistrano any more, but receive an error similar to this: can't activate net-ssh (= 2.0.22) for [], already...

...other sensible place), that only contains these 2 lines: source 'http://rubygems.org' gem 'capistrano' gem 'capistrano-ext' # You need this for multistage deployments gem 'hoptoad_notifier' # Add this for projects...

Get color in the Capistrano output

Posted Over 12 years ago by Kim Klotz.
github.com

Note: capistrano_colors was merged into Capistrano starting from v2.13.5. However, this requires Ruby 1.9+. If you cannot upgrade Capistrano to 2.13.5+ (e.g. because you're still running on Ruby...

...simply put capistrano_colors into your Gemfile and require 'capistrano_colors' in your config/deploy.rb file...

SSHKit 1.9.0 failure for Capistrano deploy

Posted Over 3 years ago by Emanuel.

SSHKit 1.9.0 might fail with the following error, when trying to deploy a Rail application. Upgrading the gem to version...

Upgrading from Capistrano 2 to 3

Posted Almost 9 years ago by Dominik Schöler.
semaphoreci.com

Capistrano 3 is a major rework of the framework and requires several adjustments to your deploy configuration files. The biggest change is that they moved away from their custom DSL...

Step 1: Upgrade guide For migration from 2 to 3, follow this tutorial: Capistrano 3 Upgrade Guide. Step 2: More changes Task syntax has changed. desc 'Run script'

Bundle capistrano

Posted Almost 12 years ago by Tobias Kraze.

Capistrano recently had some API changes that can results in deploys not working when running with old deploy.rb files. So let's bundle it. Put capistrano into your Gemfile, like...

# Gemfile group :deploy do gem 'capistrano' gem 'capistrano_colors' end It's possible you need to do a bundle update net-ssh to get things running. Now double check...

Capistrano cowboy deploys

Posted Over 13 years ago by Lexy.
opensoul.org

Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet...

Dynamically skip Capistrano hooks

Posted Almost 13 years ago by Dominik Schöler.

When you have a hook in your Capistrano file that dumps your remote database, you might not want it to dump each time you deploy (say, you're experimenting with...

...staging and don't want ten dumps an hour). How to skip dump creation: Capistrano 2 In your Capistrano file: before 'deploy:update_code', 'db:dump' unless fetch(:skip_dump...

lib/bundler/capistrano.rb at master from carlhuda's bundler - GitHub

Posted Over 13 years ago by Lexy.
github.com

Capistrano task for Bundler...