Skip to content

Instantly share code, notes, and snippets.

@cupnoodle
Created September 15, 2020 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cupnoodle/b335361f00c34d893fb796600eea118b to your computer and use it in GitHub Desktop.
Save cupnoodle/b335361f00c34d893fb796600eea118b to your computer and use it in GitHub Desktop.
Capistrano deploy settings
# change this to your deploy user
set :user, 'deploy'
# change this to your rails app name
set :application, 'cool'
# change this to your rails app repository URL
set :repo_url, 'git@tea.littlefox.es:soulchild/capify_sample.git'
# Deploy to the user's home directory, no need to change this
set :deploy_to, "/home/#{fetch(:user)}/#{fetch(:application)}"
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads'
append :linked_files, "config/master.key"
# Only keep the last 5 releases to save disk space
set :keep_releases, 5
set :rbenv_type, :user
# change this to the ruby version you are using on the server
set :rbenv_ruby, '2.6.6'
set :sidekiq_roles, -> { :app }
# Default branch is :master
set :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# by default capistrano will run `bundle install` with `--deployment --quiet` flag,
# the `--quiet` flag will hide the current gem being installed
# uncomment below to show the current gem that is being installed in the bundle
# set :bundle_flags, '--deployment'
# use sudo to restart passenger, as passenger is started by root, we need sudo permission to restart it
set :passenger_restart_with_sudo, true
@matt17r
Copy link

matt17r commented Nov 5, 2020

Does line 13 need to be tweaked to include public/packs and node_modules (as per https://github.com/rails/webpacker/blob/master/docs/deployment.md#assets-compiling-on-every-deployment-even-if-javascript-and-css-files-are-not-changed)? If so, see also the additional rake task to add to deploy.rb to run yarn install when needed.

Comment on line 27 would be clearer if it explained that this is to override the default branch by using the currently checked out branch:
`# Capistrano will use branch 'master' by default. Use this to deploy the currently checked out branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment