From 3fdee67353f6b9190d85e92658ed37f6b23d0463 Mon Sep 17 00:00:00 2001 From: Torsten Date: Tue, 29 Mar 2022 12:41:48 +0300 Subject: [PATCH] fist cap (not working) --- Capfile | 38 ++++++++++++++++++++++++++++++++++ Gemfile | 7 +++---- Gemfile.lock | 26 ++++++++++++++++++++--- config/deploy.rb | 41 +++++++++++++++++++++++++++++++++++++ config/deploy/production.rb | 10 +++++++++ 5 files changed, 115 insertions(+), 7 deletions(-) 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..ac683a4 --- /dev/null +++ b/Capfile @@ -0,0 +1,38 @@ +# 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/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +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 67b4871..7f8f4c3 100644 --- a/Gemfile +++ b/Gemfile @@ -25,12 +25,11 @@ group :development, :test do end group :development do - # Use console on exceptions pages [https://github.com/rails/web-console] gem "web-console" - - # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] gem "rack-mini-profiler" - + gem "capistrano", "~> 3.17", require: false + gem 'capistrano-rbenv' + gem "capistrano-rails", require: false end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index a577fe5..6b32538 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,10 +68,25 @@ GEM tzinfo (~> 2.0) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) + sshkit (>= 1.6.1, != 1.7.0) bindex (0.8.1) bootsnap (1.11.1) msgpack (~> 1.2) builder (3.2.4) + capistrano (3.17.0) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (2.0.1) + capistrano (~> 3.1) + capistrano-rails (1.6.2) + capistrano (~> 3.1) + capistrano-bundler (>= 1.1, < 3) + capistrano-rbenv (2.2.0) + capistrano (~> 3.1) + sshkit (~> 1.3) capybara (3.36.0) addressable matrix @@ -138,6 +153,8 @@ GEM net-protocol (0.1.2) io-wait timeout + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) net-smtp (0.3.1) digest net-protocol @@ -150,8 +167,6 @@ GEM rack rake (>= 0.8.1) public_suffix (4.0.6) - puma (5.6.2) - nio4r (~> 2.0) racc (1.6.0) rack (2.2.3) rack-mini-profiler (3.0.0) @@ -213,6 +228,9 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.2) + sshkit (1.21.2) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) stimulus-rails (1.0.4) railties (>= 6.0.0) strscan (3.0.1) @@ -243,13 +261,15 @@ PLATFORMS DEPENDENCIES bootsnap + capistrano (~> 3.17) + capistrano-rails + capistrano-rbenv capybara debug haml-rails importmap-rails net-ssh passenger (>= 5.3.2) - puma (~> 5.0) rack-mini-profiler rails (~> 7.0) sassc-rails diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..5d4c307 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,41 @@ +# config valid for current version and patch releases of Capistrano +lock "~> 3.17.0" + +set :application, "gateway" +set :repo_url, "https://github.com/rubydesign/gateway.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, "/home/feenix/gateway" + +# 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/master.key' +#"config/database.yml", + +# Default value for linked_dirs is [] +append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage" + +# 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 +set :rbenv_ruby, '3.0.3' diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..4e1ef8d --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,10 @@ + +# The server-based syntax can be used to override options: +# ------------------------------------ + server "web-server.local", + user: "feenix", + roles: %w{web app db}, + ssh_options: { + auth_methods: %w(publickey) + # password: "please use keys" + }