Remove Capistrano.
No longer used now that we use Kubernetes to deploy the site instead of Capistrano. If you run your own installation of Danbooru, and you used Capistrano to deploy your site, it is recommended that you switch to either the Docker Compose file (for personal installs), the Procfile (for non-Dockerized, development environments), or Kubernetes (for production environments; see https://github.com/danbooru/danbooru-infrastructure/tree/master/k8s for Danbooru's production configuration).
This commit is contained in:
21
Capfile
21
Capfile
@@ -1,21 +0,0 @@
|
||||
# Load DSL and set up stages
|
||||
require 'capistrano/setup'
|
||||
|
||||
# Include default deployment tasks
|
||||
require 'capistrano/deploy'
|
||||
|
||||
require "capistrano/scm/git"
|
||||
install_plugin Capistrano::SCM::Git
|
||||
|
||||
# Include tasks from other gems included in your Gemfile
|
||||
require 'capistrano/rbenv'
|
||||
require 'capistrano/rails'
|
||||
require 'capistrano3/unicorn'
|
||||
require 'capistrano/deploytags'
|
||||
require 'new_relic/recipes'
|
||||
|
||||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
||||
|
||||
# workaround for https://github.com/capistrano/rails/issues/235
|
||||
Rake::Task["deploy:assets:backup_manifest"].clear_actions
|
||||
5
Gemfile
5
Gemfile
@@ -12,9 +12,6 @@ gem 'ruby-vips'
|
||||
gem 'net-sftp'
|
||||
gem 'diff-lcs', :require => "diff/lcs/array"
|
||||
gem 'bcrypt', :require => "bcrypt"
|
||||
gem 'capistrano', '~> 3.10'
|
||||
gem 'capistrano-rails'
|
||||
gem 'capistrano-rbenv'
|
||||
gem 'rubyzip', :require => "zip"
|
||||
gem 'stripe'
|
||||
gem 'aws-sdk-sqs', '~> 1'
|
||||
@@ -59,12 +56,10 @@ gem "parallel"
|
||||
|
||||
group :production do
|
||||
gem 'unicorn', :platforms => :ruby
|
||||
gem 'capistrano3-unicorn'
|
||||
end
|
||||
|
||||
group :production do
|
||||
gem 'unicorn-worker-killer'
|
||||
gem 'capistrano-deploytags', '~> 1.0.0', require: false
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
||||
29
Gemfile.lock
29
Gemfile.lock
@@ -83,8 +83,6 @@ GEM
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
airbrussh (1.4.0)
|
||||
sshkit (>= 1.6.1, != 1.7.0)
|
||||
ansi (1.5.0)
|
||||
ast (2.4.2)
|
||||
aws-eventstream (1.2.0)
|
||||
@@ -114,23 +112,6 @@ GEM
|
||||
msgpack (~> 1.0)
|
||||
builder (3.2.4)
|
||||
byebug (11.1.3)
|
||||
capistrano (3.16.0)
|
||||
airbrussh (>= 1.0.0)
|
||||
i18n
|
||||
rake (>= 10.0.0)
|
||||
sshkit (>= 1.9.0)
|
||||
capistrano-bundler (2.0.1)
|
||||
capistrano (~> 3.1)
|
||||
capistrano-deploytags (1.0.7)
|
||||
capistrano (>= 3.7.0)
|
||||
capistrano-rails (1.6.1)
|
||||
capistrano (~> 3.1)
|
||||
capistrano-bundler (>= 1.1, < 3)
|
||||
capistrano-rbenv (2.2.0)
|
||||
capistrano (~> 3.1)
|
||||
sshkit (~> 1.3)
|
||||
capistrano3-unicorn (0.2.1)
|
||||
capistrano (~> 3.1, >= 3.1.0)
|
||||
capybara (3.35.3)
|
||||
addressable
|
||||
mini_mime (>= 0.1.3)
|
||||
@@ -294,8 +275,6 @@ GEM
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
net-scp (3.0.0)
|
||||
net-ssh (>= 2.6.5, < 7.0.0)
|
||||
net-sftp (3.0.0)
|
||||
net-ssh (>= 5.0.0, < 7.0.0)
|
||||
net-ssh (6.1.0)
|
||||
@@ -461,9 +440,6 @@ GEM
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sshkit (1.21.2)
|
||||
net-scp (>= 1.1.2)
|
||||
net-ssh (>= 2.8.0)
|
||||
stackprof (0.2.17)
|
||||
stripe (5.38.0)
|
||||
stripe-ruby-mock (3.0.1)
|
||||
@@ -522,11 +498,6 @@ DEPENDENCIES
|
||||
binding_of_caller
|
||||
bootsnap
|
||||
builder
|
||||
capistrano (~> 3.10)
|
||||
capistrano-deploytags (~> 1.0.0)
|
||||
capistrano-rails
|
||||
capistrano-rbenv
|
||||
capistrano3-unicorn
|
||||
capybara
|
||||
clockwork
|
||||
codecov
|
||||
|
||||
29
bin/cap
29
bin/cap
@@ -1,29 +0,0 @@
|
||||
#!/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.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 300) =~ /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")
|
||||
@@ -1,27 +0,0 @@
|
||||
# This file contains configuration settings for deploying Danbooru to the
|
||||
# production servers using Capistrano. This is only used by production and
|
||||
# shouldn't be edited by end users.
|
||||
#
|
||||
# @see Capfile
|
||||
# @see config/deploy
|
||||
# @see lib/capistrano/tasks
|
||||
# @see https://capistranorb.com
|
||||
|
||||
set :stages, %w(production test)
|
||||
set :default_stage, "test"
|
||||
set :application, "danbooru"
|
||||
set :repo_url, "git://github.com/danbooru/danbooru.git"
|
||||
set :deploy_to, "/var/www/danbooru2"
|
||||
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle"
|
||||
set :branch, ENV.fetch("branch", "master")
|
||||
|
||||
# skip migrations if files in db/migrate weren't modified
|
||||
set :conditionally_migrate, true
|
||||
|
||||
# run migrations on the primary app server
|
||||
set :migration_role, :app
|
||||
|
||||
set :whenever_roles, :cron
|
||||
|
||||
# how long unicorn:legacy_restart (used by deploy:rolling) waits until killing the old unicorn.
|
||||
set :unicorn_restart_sleep_time, 10
|
||||
@@ -1,14 +0,0 @@
|
||||
# Deploy
|
||||
|
||||
This directory contains configuration settings for deploying Danbooru to the production servers
|
||||
using Capistrano. This is only used by production and shouldn't be edited by end users.
|
||||
|
||||
# See also
|
||||
|
||||
* [Capfile](../../Capfile)
|
||||
* [config/deploy.rb](../deploy.rb)
|
||||
* [lib/capistrano/tasks](../../lib/capistrano/tasks)
|
||||
|
||||
# External links
|
||||
|
||||
* https://capistranorb.com
|
||||
@@ -1,3 +0,0 @@
|
||||
set :user, "danbooru"
|
||||
set :rails_env, "development"
|
||||
server "localhost", :roles => %w(web app db), :primary => true, :user => "danbooru"
|
||||
@@ -1,12 +0,0 @@
|
||||
set :user, "danbooru"
|
||||
set :rails_env, "production"
|
||||
set :delayed_job_workers, 8
|
||||
append :linked_files, ".env.production"
|
||||
|
||||
server "kagamihara", :roles => %w(web app cron), :primary => true
|
||||
server "shima", :roles => %w(web app)
|
||||
server "saitou", :roles => %w(web app)
|
||||
server "oogaki", :roles => %w(worker)
|
||||
|
||||
set :newrelic_appname, "Danbooru"
|
||||
after "deploy:finished", "newrelic:notice_deployment"
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace :app do
|
||||
set :rolling_deploy, false
|
||||
|
||||
task :disable do
|
||||
if fetch(:rolling_deploy)
|
||||
# do nothing
|
||||
else
|
||||
invoke "web:disable"
|
||||
invoke "unicorn:stop"
|
||||
end
|
||||
end
|
||||
|
||||
task :enable do
|
||||
if fetch(:rolling_deploy)
|
||||
invoke "unicorn:legacy_restart"
|
||||
else
|
||||
invoke "unicorn:start"
|
||||
invoke "web:enable"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :deploy do
|
||||
desc "Deploy a rolling update without taking the site down for maintenance"
|
||||
task :rolling do
|
||||
set :rolling_deploy, true
|
||||
invoke "deploy"
|
||||
end
|
||||
end
|
||||
|
||||
before "deploy:migrate", "app:disable"
|
||||
after "deploy:published", "app:enable"
|
||||
|
||||
before "app:disable", "delayed_job:stop"
|
||||
after "app:enable", "delayed_job:start"
|
||||
@@ -1,39 +0,0 @@
|
||||
namespace :delayed_job do
|
||||
desc "Start delayed_job process"
|
||||
task :start do
|
||||
on roles(:worker) do
|
||||
within current_path do
|
||||
with rails_env: fetch(:rails_env) do
|
||||
bundle = SSHKit.config.command_map[:bundle]
|
||||
|
||||
execute :"systemd-run", "--user --collect --slice delayed_job --unit delayed_job.bulk_update -E RAILS_ENV=$RAILS_ENV -p WorkingDirectory=$PWD -p Restart=always #{bundle} exec bin/delayed_job --queues=bulk_update run"
|
||||
fetch(:delayed_job_workers, 16).times do |n|
|
||||
execute :"systemd-run", "--user --collect --slice delayed_job --unit delayed_job.#{n} -E RAILS_ENV=$RAILS_ENV -p WorkingDirectory=$PWD -p Restart=always #{bundle} exec bin/delayed_job --queues=default run"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Stop delayed_job process"
|
||||
task :stop do
|
||||
on roles(:worker) do
|
||||
execute :systemctl, "--user stop delayed_job.slice"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Restart delayed_job process"
|
||||
task :restart do
|
||||
on roles(:worker) do
|
||||
execute :systemctl, "--user restart delayed_job.slice"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Show status of delayed_job process"
|
||||
task :status do
|
||||
on roles(:worker) do
|
||||
# systemctl exits with status 3 if the service isn't running.
|
||||
execute :systemctl, "--user status delayed_job.slice", raise_on_non_zero_exit: false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace :nginx do
|
||||
desc "Shut down Nginx"
|
||||
task :stop do
|
||||
on roles(:web) do
|
||||
as :user => "root" do
|
||||
execute "/etc/init.d/nginx", "stop"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Start Nginx"
|
||||
task :start do
|
||||
on roles(:web) do
|
||||
as :user => "root" do
|
||||
execute "/etc/init.d/nginx", "start"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Reload Nginx"
|
||||
task :reload do
|
||||
on roles(:web) do
|
||||
as :user => "root" do
|
||||
execute "/etc/init.d/nginx", "reload"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace :symlink do
|
||||
desc "Link the local config files"
|
||||
task :local_files do
|
||||
on roles(:app, :worker) do
|
||||
execute :ln, "-s", "#{deploy_to}/shared/config/danbooru_local_config.rb", "#{release_path}/config/danbooru_local_config.rb"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Link the local directories"
|
||||
task :directories do
|
||||
on roles(:app, :worker) do
|
||||
execute :rm, "-f", "#{release_path}/public/data"
|
||||
execute :ln, "-s", "#{deploy_to}/shared/data", "#{release_path}/public/data"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
after "deploy:symlink:shared", "symlink:local_files"
|
||||
after "deploy:symlink:shared", "symlink:directories"
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace :web do
|
||||
desc "Present a maintenance page to visitors."
|
||||
task :disable do
|
||||
on roles(:app) do
|
||||
maintenance_html_path = "#{current_path}/public/maintenance.html.bak"
|
||||
if test("[ -e #{maintenance_html_path} ]")
|
||||
execute :mv, maintenance_html_path, "#{current_path}/public/maintenance.html"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Makes the application web-accessible again."
|
||||
task :enable do
|
||||
on roles(:app) do
|
||||
maintenance_html_path = "#{current_path}/public/maintenance.html"
|
||||
if test("[ -e #{maintenance_html_path} ]")
|
||||
execute :mv, maintenance_html_path, "#{current_path}/public/maintenance.html.bak"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user