diff --git a/.gitignore b/.gitignore index cbd7075..d6d09a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ run-rails-master-hook +/log diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..22adb18 --- /dev/null +++ b/Capfile @@ -0,0 +1,42 @@ +# 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 } + +require 'capistrano/puma' +install_plugin Capistrano::Puma +install_plugin Capistrano::Puma::Systemd diff --git a/Gemfile b/Gemfile index 8c6ad87..ed7deba 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,7 @@ source 'https://rubygems.org' gem "rack", "~> 2.2" -gem "puma", "~> 4.3" +gem "puma", "~> 6.0" + +gem "capistrano3-puma" +gem "capistrano-rvm" diff --git a/Gemfile.lock b/Gemfile.lock index 56451b3..7f37cf7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,53 @@ GEM remote: https://rubygems.org/ specs: + airbrussh (1.5.3) + sshkit (>= 1.6.1, != 1.7.0) + base64 (0.3.0) + capistrano (3.19.2) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (2.1.1) + capistrano (~> 3.1) + capistrano-rvm (0.1.2) + capistrano (~> 3.0) + sshkit (~> 1.2) + capistrano3-puma (7.0.0) + capistrano (~> 3.7) + capistrano-bundler + puma (>= 6.1, < 8.0) + concurrent-ruby (1.3.5) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + logger (1.7.0) + net-scp (4.1.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-sftp (4.0.0) + net-ssh (>= 5.0.0, < 8.0.0) + net-ssh (7.3.0) nio4r (2.7.4) - puma (4.3.12) + ostruct (0.6.3) + puma (6.6.1) nio4r (~> 2.0) rack (2.2.20) + rake (13.3.0) + sshkit (1.24.0) + base64 + logger + net-scp (>= 1.1.2) + net-sftp (>= 2.1.2) + net-ssh (>= 2.8.0) + ostruct PLATFORMS ruby DEPENDENCIES - puma (~> 4.3) + capistrano-rvm + capistrano3-puma + puma (~> 6.0) rack (~> 2.2) BUNDLED WITH diff --git a/bin/cap b/bin/cap new file mode 100755 index 0000000..6dfe3fd --- /dev/null +++ b/bin/cap @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'cap' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +bundle_binstub = File.expand_path("bundle", __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("capistrano", "cap") diff --git a/bin/capify b/bin/capify new file mode 100755 index 0000000..86d25e1 --- /dev/null +++ b/bin/capify @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'capify' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +bundle_binstub = File.expand_path("bundle", __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("capistrano", "capify") diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..e949a81 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,12 @@ +# config valid for current version and patch releases of Capistrano +lock "~> 3.19.2" + +set :application, "rails-master-hook" +set :repo_url, "https://github.com/rails/rails-master-hook.git" + +set :deploy_to, "/home/rails/rails-master-hook-deploy" + +set :keep_releases, 5 + +set :puma_bind, "tcp://0.0.0.0:9292" +set :puma_systemctl_user, :system diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..9dcb52d --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,11 @@ +DOCS_SERVER_IP = '138.197.6.175' + +set :ssh_options, port: 987 +server DOCS_SERVER_IP, user: 'rails', roles: %w(web) + +set :rvm_ruby_version, '3.3.4' +set :rvm_custom_path, '/home/rails/.rvm' + +set :puma_service_unit_env_vars, %w[ + RUN_FILE=/home/rails/rails-master-hook/run-rails-master-hook +] diff --git a/config/puma.rb b/config/puma.rb index 660ee2d..7dab7ac 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,3 @@ -daemonize true pidfile "puma.pid" threads 1, 1 +bind "tcp://0.0.0.0:9292"