Skip to content

Commit

Permalink
Install capistrano for imagecat (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Bess Sadler <bess@users.noreply.github.com>
  • Loading branch information
leefaisonr and bess committed Mar 6, 2023
1 parent d383ef5 commit 8790174
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 1 deletion.
41 changes: 41 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rails'

# 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 }
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ gem 'bootsnap', require: false
group :development, :test do
gem 'coveralls_reborn', '~> 0.27.0', require: false
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'capistrano', require: false
gem 'capistrano-passenger', require: false
gem 'capistrano-rails', '~> 1.4', require: false
gem 'debug', platforms: %i[mri mingw x64_mingw]
gem 'pry'
gem 'pry-byebug'
Expand Down
24 changes: 24 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,26 @@ GEM
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
airbrussh (1.4.1)
sshkit (>= 1.6.1, != 1.7.0)
ast (2.4.2)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
builder (3.2.4)
byebug (11.1.3)
capistrano (3.17.2)
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)
capistrano-rails (1.6.2)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
coderay (1.1.3)
concurrent-ruby (1.2.0)
coveralls_reborn (0.27.0)
Expand Down Expand Up @@ -121,8 +135,11 @@ GEM
net-protocol
net-protocol (0.2.1)
timeout
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.3.3)
net-protocol
net-ssh (7.0.1)
nio4r (2.5.8)
nokogiri (1.14.1-arm64-darwin)
racc (~> 1.4)
Expand Down Expand Up @@ -224,6 +241,9 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sshkit (1.21.4)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stimulus-rails (1.2.1)
railties (>= 6.0.0)
sync (0.5.0)
Expand Down Expand Up @@ -253,9 +273,13 @@ GEM
PLATFORMS
arm64-darwin-21
x86_64-darwin-20
x86_64-darwin-22

DEPENDENCIES
bootsnap
capistrano
capistrano-passenger
capistrano-rails (~> 1.4)
coveralls_reborn (~> 0.27.0)
debug
importmap-rails
Expand Down
13 changes: 13 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# config valid for current version and patch releases of Capistrano
lock '~> 3.17.2'

set :application, 'imagecat_rails'
set :repo_url, 'https://github.com/pulibrary/imagecat-rails'

set :linked_dirs, %w[log public/system public/assets]

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

set :deploy_to, '/opt/imagecat_rails'
3 changes: 3 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

server 'imagecat-prod1.princeton.edu', user: 'deploy', roles: %w[app db web]
3 changes: 3 additions & 0 deletions config/deploy/staging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

server 'imagecat-staging1.princeton.edu', user: 'deploy', roles: %w[app db web]
95 changes: 95 additions & 0 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# 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
config.action_controller.perform_caching = true

# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true

# 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?

# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"

# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local

# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# 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]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "imagecat_rails_production"

config.action_mailer.perform_caching = false

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false

# 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

# Use a different logger for distributed setups.
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")

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

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Defines the root path route ("/")
# root "articles#index"
# root static("placeholder.html")
get '/', to: redirect('placeholder.html')
end
6 changes: 6 additions & 0 deletions public/placeholder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<body>
placeholder
</body>

</html>

0 comments on commit 8790174

Please sign in to comment.