Skip to content

Instantly share code, notes, and snippets.

@CucumisSativus
Last active April 26, 2020 14:09
Show Gist options
  • Save CucumisSativus/1d2f1dd455ec33f57154 to your computer and use it in GitHub Desktop.
Save CucumisSativus/1d2f1dd455ec33f57154 to your computer and use it in GitHub Desktop.
Mydevil capistrano
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/passenger'
require "whenever/capistrano"
# Load custom tasks from `lib/capistrano/tasks' if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
lock '3.3.5'
set :application, 'APP-NAME'
set :repo_url, 'git@github.com:GITHUB_ACCOUNT/APPLICATION_NAME.git'
set :rvm_type, :user
set :rvm_ruby_version, '2.2.0@my-app'
set :linked_files, fetch(:linked_files, []).push('config/database.yml', '.env')
set :bundle_binstubs, nil
set :linked_dirs, ['log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system']
set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets public/assets}
set :assets_roles, [:web, :app]
namespace :deploy do
after :published, :symlink_to_public_ruby do
on roles(:web), in: :groups, limit: 3, wait: 10 do
execute "rm #{fetch(:deploy_to)}/public_ruby"
execute "ln -s #{fetch(:release_path)} #{fetch(:deploy_to)}/public_ruby"
end
end
# add this to gemfile
gem 'capistrano', '~> 3.3.0'
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-bundler', '~> 1.1.3'
gem 'capistrano-rvm'
gem 'capistrano-passenger'
role :app, %w{webX.mydevil.net}
role :web, %w{webX.mydevil.net}
role :db, %w{webX.mydevil.net}
server 'webX.mydevil.net', user: 'USERNAME', roles: %w{web app db}
set :rails_env, :production
set :deploy_to, '/home/USERNAME/domains/DOMENA'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment