Skip to content

Commit

Permalink
Deployment with capistrano
Browse files Browse the repository at this point in the history
  • Loading branch information
christinach committed Sep 29, 2023
1 parent 7f680e0 commit d0d53bd
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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

#set :dist, 'dist'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

group :development do
gem "capistrano", require: false
end
30 changes: 30 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
GEM
remote: https://rubygems.org/
specs:
airbrussh (1.5.0)
sshkit (>= 1.6.1, != 1.7.0)
capistrano (3.11.2)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
concurrent-ruby (1.2.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-ssh (7.2.0)
rake (13.0.6)
sshkit (1.21.5)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)

PLATFORMS
x86_64-darwin-21
x86_64-darwin-22

DEPENDENCIES
capistrano

BUNDLED WITH
2.4.10
33 changes: 33 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# config valid for current version and patch releases of Capistrano
lock "~> 3.17.1"

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

set :application, "allsearch_frontend"
set :repo_url, "https://github.com/pulibrary/allsearch_frontend.git"

# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp

# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/opt/allsearch_frontend"

namespace :deploy do
desc "Run yarn install"
task :yarn_install do
on roles(:web) do
within release_path do
execute("cd #{release_path} && yarn install")
end
end
end
desc "Create dist"
task :yarn_build do
on roles(:web) do
within release_path do
execute("cd #{release_path} && yarn build")
end
end
end
end

5 changes: 5 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set :stage, :production
set :node_env, 'production'

server "allsearch-prod1", user: "deploy", roles: %w{app web}
server "allsearch-prod2", user: "deploy", roles: %w{app web}
5 changes: 5 additions & 0 deletions config/deploy/staging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set :stage, :staging
set :node_env, 'staging'

server "allsearch-staging1", user: "deploy", roles: %w{app web}
server "allsearch-staging2", user: "deploy", roles: %w{app web}

0 comments on commit d0d53bd

Please sign in to comment.