Skip to content

Commit

Permalink
Add capistrano
Browse files Browse the repository at this point in the history
  • Loading branch information
sandbergja committed Sep 14, 2023
1 parent a3b5b0b commit 5ec4e11
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# 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

require 'capistrano/bundler'
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 }
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ gem 'railties'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development do
gem 'bcrypt_pbkdf'
gem 'capistrano', require: false
gem 'capistrano-bundler'
gem 'capistrano-passenger'
gem 'ed25519'
end

group :development, :test do
gem 'pry-byebug'
gem 'reek'
Expand Down
24 changes: 24 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,24 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
airbrussh (1.4.2)
sshkit (>= 1.6.1, != 1.7.0)
ast (2.4.2)
base64 (0.1.1)
bcrypt_pbkdf (1.1.0)
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
byebug (11.1.3)
capistrano (3.17.3)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-passenger (0.2.1)
capistrano (~> 3.0)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crack (0.4.5)
Expand All @@ -45,6 +57,7 @@ GEM
debase-ruby_core_source (3.2.1)
diff-lcs (1.5.0)
dogstatsd-ruby (5.6.1)
ed25519 (1.3.0)
erubi (1.12.0)
ffi (1.15.5)
hashdiff (1.0.1)
Expand All @@ -67,6 +80,9 @@ GEM
method_source (1.0.0)
minitest (5.19.0)
msgpack (1.7.2)
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-ssh (7.2.0)
nio4r (2.5.9)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
Expand Down Expand Up @@ -160,6 +176,9 @@ GEM
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
sshkit (1.21.5)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (1.2.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand All @@ -181,9 +200,14 @@ DEPENDENCIES
activemodel
activerecord
activesupport
bcrypt_pbkdf
bootsnap
capistrano
capistrano-bundler
capistrano-passenger
ddtrace
dogstatsd-ruby
ed25519
pg
pry-byebug
puma (~> 5.0)
Expand Down
18 changes: 18 additions & 0 deletions config/allsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,24 @@ development:

staging:
<<: *default
catalog:
solr:
host: "lib-solr8-staging.princeton.edu"
port: 8983
collection: "catalog-alma-staging"
ssl: true
dpul:
solr:
host: "lib-solr8-staging.princeton.edu"
port: 8983
collection: "dpul-staging"
ssl: true
findingaids:
solr:
host: "lib-solr8-staging.princeton.edu"
port: 8983
collection: "pulfalight-staging"
ssl: true

test:
<<: *default
Expand Down
15 changes: 15 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

set :repo_url, 'https://github.com/pulibrary/allsearch_rails_api.git'
set :application, 'allsearch_rails_api'

set :branch, ENV['BRANCH'] || 'main'

set :deploy_to, -> { "/opt/#{fetch(:application)}" }
set :repo_path, -> { "/opt/#{fetch(:application)}/repo" }

set :log_level, :debug

set :ssh_options, { forward_agent: true }

set :passenger_restart_with_touch, true
5 changes: 5 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

set :stage, :production
set :rails_env, 'production'
server 'allsearch-api-prod1', user: 'deploy'
5 changes: 5 additions & 0 deletions config/deploy/staging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

set :stage, :staging
set :rails_env, 'staging'
server 'allsearch-api-staging1', user: 'deploy'
46 changes: 46 additions & 0 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

require 'active_support/core_ext/integer/time'

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
config.cache_classes = true

# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info

# Prepend all log lines with the following tags.
config.log_tags = [:request_id]

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true

# Don't log any deprecations.
config.active_support.report_deprecations = false

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = Logger::Formatter.new

if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
end

0 comments on commit 5ec4e11

Please sign in to comment.