Skip to content

Commit a486496

Browse files
authored
Merge pull request #20 from rails/rm-capistrano
Deploy rails-master-hook using capistrano
2 parents fb338db + e5e3ce0 commit a486496

File tree

9 files changed

+164
-4
lines changed

9 files changed

+164
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
run-rails-master-hook
2+
/log

Capfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Load DSL and set up stages
2+
require "capistrano/setup"
3+
4+
# Include default deployment tasks
5+
require "capistrano/deploy"
6+
7+
# Load the SCM plugin appropriate to your project:
8+
#
9+
# require "capistrano/scm/hg"
10+
# install_plugin Capistrano::SCM::Hg
11+
# or
12+
# require "capistrano/scm/svn"
13+
# install_plugin Capistrano::SCM::Svn
14+
# or
15+
require "capistrano/scm/git"
16+
install_plugin Capistrano::SCM::Git
17+
18+
# Include tasks from other gems included in your Gemfile
19+
#
20+
# For documentation on these, see for example:
21+
#
22+
# https://github.com/capistrano/rvm
23+
# https://github.com/capistrano/rbenv
24+
# https://github.com/capistrano/chruby
25+
# https://github.com/capistrano/bundler
26+
# https://github.com/capistrano/rails
27+
# https://github.com/capistrano/passenger
28+
#
29+
require "capistrano/rvm"
30+
# require "capistrano/rbenv"
31+
# require "capistrano/chruby"
32+
# require "capistrano/bundler"
33+
# require "capistrano/rails/assets"
34+
# require "capistrano/rails/migrations"
35+
# require "capistrano/passenger"
36+
37+
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
38+
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
39+
40+
require 'capistrano/puma'
41+
install_plugin Capistrano::Puma
42+
install_plugin Capistrano::Puma::Systemd

Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
source 'https://rubygems.org'
22

33
gem "rack", "~> 2.2"
4-
gem "puma", "~> 4.3"
4+
gem "puma", "~> 6.0"
5+
6+
gem "capistrano3-puma"
7+
gem "capistrano-rvm"

Gemfile.lock

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,53 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
airbrussh (1.5.3)
5+
sshkit (>= 1.6.1, != 1.7.0)
6+
base64 (0.3.0)
7+
capistrano (3.19.2)
8+
airbrussh (>= 1.0.0)
9+
i18n
10+
rake (>= 10.0.0)
11+
sshkit (>= 1.9.0)
12+
capistrano-bundler (2.1.1)
13+
capistrano (~> 3.1)
14+
capistrano-rvm (0.1.2)
15+
capistrano (~> 3.0)
16+
sshkit (~> 1.2)
17+
capistrano3-puma (7.0.0)
18+
capistrano (~> 3.7)
19+
capistrano-bundler
20+
puma (>= 6.1, < 8.0)
21+
concurrent-ruby (1.3.5)
22+
i18n (1.14.7)
23+
concurrent-ruby (~> 1.0)
24+
logger (1.7.0)
25+
net-scp (4.1.0)
26+
net-ssh (>= 2.6.5, < 8.0.0)
27+
net-sftp (4.0.0)
28+
net-ssh (>= 5.0.0, < 8.0.0)
29+
net-ssh (7.3.0)
430
nio4r (2.7.4)
5-
puma (4.3.12)
31+
ostruct (0.6.3)
32+
puma (6.6.1)
633
nio4r (~> 2.0)
734
rack (2.2.20)
35+
rake (13.3.0)
36+
sshkit (1.24.0)
37+
base64
38+
logger
39+
net-scp (>= 1.1.2)
40+
net-sftp (>= 2.1.2)
41+
net-ssh (>= 2.8.0)
42+
ostruct
843

944
PLATFORMS
1045
ruby
1146

1247
DEPENDENCIES
13-
puma (~> 4.3)
48+
capistrano-rvm
49+
capistrano3-puma
50+
puma (~> 6.0)
1451
rack (~> 2.2)
1552

1653
BUNDLED WITH

bin/cap

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'cap' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
bundle_binstub = File.expand_path("bundle", __dir__)
14+
15+
if File.file?(bundle_binstub)
16+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17+
load(bundle_binstub)
18+
else
19+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21+
end
22+
end
23+
24+
require "rubygems"
25+
require "bundler/setup"
26+
27+
load Gem.bin_path("capistrano", "cap")

bin/capify

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'capify' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
bundle_binstub = File.expand_path("bundle", __dir__)
14+
15+
if File.file?(bundle_binstub)
16+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17+
load(bundle_binstub)
18+
else
19+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21+
end
22+
end
23+
24+
require "rubygems"
25+
require "bundler/setup"
26+
27+
load Gem.bin_path("capistrano", "capify")

config/deploy.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# config valid for current version and patch releases of Capistrano
2+
lock "~> 3.19.2"
3+
4+
set :application, "rails-master-hook"
5+
set :repo_url, "https://github.com/rails/rails-master-hook.git"
6+
7+
set :deploy_to, "/home/rails/rails-master-hook-deploy"
8+
9+
set :keep_releases, 5
10+
11+
set :puma_bind, "tcp://0.0.0.0:9292"
12+
set :puma_systemctl_user, :system

config/deploy/production.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DOCS_SERVER_IP = '138.197.6.175'
2+
3+
set :ssh_options, port: 987
4+
server DOCS_SERVER_IP, user: 'rails', roles: %w(web)
5+
6+
set :rvm_ruby_version, '3.3.4'
7+
set :rvm_custom_path, '/home/rails/.rvm'
8+
9+
set :puma_service_unit_env_vars, %w[
10+
RUN_FILE=/home/rails/rails-master-hook/run-rails-master-hook
11+
]

config/puma.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
daemonize true
21
pidfile "puma.pid"
32
threads 1, 1
3+
bind "tcp://0.0.0.0:9292"

0 commit comments

Comments
 (0)