From 6d118a54b83925025edf5ab6a688deba3d3c769a Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 28 Nov 2018 23:41:36 +0500 Subject: [PATCH] Configure Capistrano --- Capfile | 33 +++++++++++++++++++++++ Gemfile | 7 +++++ Gemfile.lock | 21 +++++++++++++++ config/credentials.yml.enc | 2 +- config/deploy.rb | 54 +++++++++++++++++++++++++++++++++++++ config/deploy/production.rb | 3 +++ 6 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 Capfile create mode 100644 config/deploy.rb create mode 100644 config/deploy/production.rb diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..ab4ba29 --- /dev/null +++ b/Capfile @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# Load DSL and set up stages. +require 'capistrano/setup' + +# Include default deployment tasks. +require 'capistrano/deploy' + +# Load the SCM plugin appropriate to your project. +require 'capistrano/scm/git' +install_plugin Capistrano::SCM::Git + +# Include tasks from other gems included in your Gemfile. +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# https://github.com/capistrano/chruby +# https://github.com/capistrano/bundler +# https://github.com/capistrano/rails +# https://github.com/capistrano/passenger +# +# require 'capistrano/rvm' +# require 'capistrano/rbenv' +# require 'capistrano/chruby' +require 'capistrano/bundler' +require 'capistrano/rails/assets' +require 'capistrano/rails/migrations' +# require 'capistrano/passenger' + +# Load custom tasks from `lib/capistrano/tasks` if you have any defined. +Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index e0d3d4d..fafc032 100644 --- a/Gemfile +++ b/Gemfile @@ -83,6 +83,13 @@ group :development, :test do end group :development do + # Capistrano is a utility and framework for executing commands in parallel + # on multiple remote machines, via SSH. + gem 'capistrano', '~> 3.11', require: false + + # Rails specific Capistrano tasks. + gem 'capistrano-rails', '~> 1.4', require: false + # Call 'byebug' anywhere in the code to stop execution # and get a debugger console. gem 'byebug', platforms: %i[mri mingw x64_mingw] diff --git a/Gemfile.lock b/Gemfile.lock index 485450e..315b26f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,6 +42,8 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + airbrussh (1.3.1) + sshkit (>= 1.6.1, != 1.7.0) arel (9.0.0) ast (2.4.0) autoprefixer-rails (9.3.1) @@ -55,6 +57,17 @@ GEM sass (>= 3.5.2) builder (3.2.3) byebug (10.0.2) + capistrano (3.11.0) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (1.4.0) + capistrano (~> 3.1) + sshkit (~> 1.2) + capistrano-rails (1.4.0) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) coderay (1.1.2) concurrent-ruby (1.1.3) coveralls (0.7.1) @@ -117,6 +130,9 @@ GEM minitest (5.11.3) msgpack (1.2.4) multi_json (1.13.1) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (5.0.2) netrc (0.11.0) nio4r (2.3.1) nokogiri (1.8.5) @@ -235,6 +251,9 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + sshkit (1.18.0) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) term-ansicolor (1.7.0) tins (~> 1.0) thor (0.20.3) @@ -268,6 +287,8 @@ DEPENDENCIES bootsnap (>= 1.1.0) bootstrap (~> 4.1.3) byebug + capistrano (~> 3.11) + capistrano-rails (~> 1.4) coveralls database_cleaner (~> 1.7) factory_bot_rails (~> 4.10) diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 8172d31..f90e8d4 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -a4Z5eQ1qE/XddT8ECHJnOYbuU+f2O4y98gHXhgEbLnU2Dnma8JInr4POPU3okJbL8qYnieezoSCqXyczIsONCVUx/aT/pq32kqFXwa+lN4QdtnWu8RdZxsIH8JlIFZpf/+a9JL5HGH41SSnGuu3J9MFB5pz8FEhcewePrDH49XMWL+U5E/fr2crATDD3iZFzLYv2EcVCdZHYT1cslVub47zm7mjeUBXSm//rw+A33bPXAipgAFBsuAdkw5ziyQ9IERr5R/lCt4BHRsdAqn+1htWjiJylC05uQQhYu9UESJI2WR3iuoQ03kSRVMXTGgixh3FXc70UWSQAVjAB4u8kidYE/8tA2L2AzpLHSvIP4VHcLtQbDRzn1SEcN2MRHc4np7s0Fqb8R4i7ieF9PAO1VwEHAIOQEgy4as2l--Dq3Ae8mYiRzoK4la--ClffRyogBcj4ITVJ4vu4Pg== \ No newline at end of file +QtBlpQuGa0BjUXzdXxBXqXTp1qUF9xc4ULh4fJgAjWsShLAU62TwOmjiLw6gKeIGIZd9n1/hV6LcQRi8lPzq6kOHeLoBbKXub8+9lAZ/zsi+2LMvlgvlacZWw02BEpQMIoZuXrEojpzFSj+2b6Gx6ucC8ArSg6u64i+B7vl8i+MReQ7aKYn48J9TQ1NM4wwnpsSLC4VLlQ==--FuMPDqLpq9qRARv0--m/DxSG1WI+CMj/K3rtJAFw== \ No newline at end of file diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..5341df0 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Config valid for current version and patch releases of Capistrano. +lock '~> 3.11.0' + +set :application, 'partynest' +set :repo_url, 'git@github.com:lpr-perm/partynest.git' + +# Default branch is :master. +# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp + +# Default deploy_to directory is /var/www/my_app_name. +# set :deploy_to, '/var/www/my_app_name' + +# Default value for :format is :airbrussh. +# set :format, :airbrussh + +# You can configure the Airbrussh format using :format_options. +# These are the defaults. +# set :format_options, +# command_output: true, +# log_file: 'log/capistrano.log', +# color: :auto, +# truncate: :auto + +# Default value for :pty is false. +# set :pty, true + +# Default value for :linked_files is []. +# append :linked_files, +# 'config/database.yml' +append :linked_files, + 'config/master.key' + +# Default value for linked_dirs is []. +# append :linked_dirs, +# 'log', +# 'tmp/pids', +# 'tmp/cache', +# 'tmp/sockets', +# 'public/system' + +# Default value for default_env is {}. +# set :default_env, path: '/opt/ruby/bin:$PATH' + +# Default value for local_user is ENV['USER']. +# set :local_user, -> { `git config user.name`.chomp } + +# Default value for keep_releases is 5. +# set :keep_releases, 5 + +# Uncomment the following to require manually verifying the host key +# before first deploy. +# set :ssh_options, verify_host_key: :secure diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..5f20cfc --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +server '159.65.200.239', roles: %w[web app db]