Skip to content

Commit

Permalink
add deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Aug 19, 2024
1 parent f932e9f commit 2c23300
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 1 deletion.
38 changes: 38 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# 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 }
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
gemspec

gem 'ffi'
gem 'activesupport', '~> 3.2'

# This is needed temporarily to pull the Google Universal Analytics (UA)
# data and store it in a file. See (bin/import_google_ua_analytics_data)
Expand Down Expand Up @@ -40,4 +41,14 @@ group :test do
gem 'test-unit-minitest'
end

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0', require: false
gem 'capistrano', '~> 3', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano-locally', require: false
gem 'capistrano-rbenv', require: false
gem 'ed25519', '>= 1.2', '< 2.0', require: false
end

gem "binding_of_caller", "~> 1.0"
35 changes: 34 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,27 @@ GEM
multi_json (~> 1.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.2)
sshkit (>= 1.6.1, != 1.7.0)
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bigdecimal (3.1.8)
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
builder (3.3.0)
capistrano (3.19.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.1.1)
capistrano (~> 3.1)
capistrano-locally (0.3.0)
capistrano (~> 3.0)
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
Expand All @@ -94,6 +109,7 @@ GEM
declarative (0.0.20)
docile (1.4.1)
domain_name (0.6.20240107)
ed25519 (1.3.0)
email_spec (2.1.1)
htmlentities (~> 4.3.3)
launchy (~> 2.1)
Expand Down Expand Up @@ -155,7 +171,7 @@ GEM
googleapis-common-protos-types (~> 1.0)
htmlentities (4.3.4)
http-accept (1.7.0)
http-cookie (1.0.6)
http-cookie (1.0.7)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (0.9.5)
Expand Down Expand Up @@ -192,6 +208,11 @@ GEM
mutex_m (0.2.0)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-sftp (4.0.0)
net-ssh (>= 5.0.0, < 8.0.0)
net-ssh (7.2.3)
netrc (0.11.0)
oj (3.16.5)
bigdecimal (>= 3.0)
Expand Down Expand Up @@ -267,6 +288,11 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sshkit (1.23.0)
base64
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
strscan (3.1.0)
sys-proctable (1.3.0)
ffi (~> 1.1)
Expand All @@ -284,8 +310,15 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
activesupport (~> 3.2)
bcrypt_pbkdf (>= 1.0, < 2.0)
binding_of_caller (~> 1.0)
capistrano (~> 3)
capistrano-bundler
capistrano-locally
capistrano-rbenv
cube-ruby
ed25519 (>= 1.2, < 2.0)
email_spec
ffi
goo!
Expand Down
26 changes: 26 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
set :repo_url, "[email protected]:biodivportal/ncbo_cron.git"
set :user, 'ontoportal'

set :deploy_to, '/srv/ontoportal/ncbo_cron_deployments'


set :stages, %w[appliance]
set :default_stage, 'appliance'
set :stage, 'appliance'
set :application, 'cron'

# SSH parameters
set :ssh_port, 22
set :pty, true

# Source code
set :repository_cache, "git_cache"
set :deploy_via, :remote_cache
set :ssh_options, { :forward_agent => true }

# Linked files and directories
append :linked_files, "config/config.rb"
append :linked_dirs, 'logs', '.bundle'
set :keep_releases, 2


13 changes: 13 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set :branch, 'master'
set :server, 'biodivportal.gfbio.org'

server fetch(:server), user: fetch(:user), roles: %w{web app}

set :ssh_options, {
user: 'ontoportal',
forward_agent: 'true',
#keys: %w(config/deploy_id_rsa),
#auth_methods: %w(publickey),
# use ssh proxy if UI servers are on a private network
#proxy: Net::SSH::Proxy::Command.new('ssh [email protected] -W %h:%p')
}
14 changes: 14 additions & 0 deletions config/deploy/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set :branch, 'master'
set :server, 'biodivportal.gfbio.dev'

server fetch(:server), user: fetch(:user), roles: %w{web app}

set :ssh_options, {
user: 'ontoportal',
forward_agent: 'true',
port: 30082
#keys: %w(config/deploy_id_rsa),
#auth_methods: %w(publickey),
# use ssh proxy if UI servers are on a private network
#proxy: Net::SSH::Proxy::Command.new('ssh [email protected] -W %h:%p')
}

0 comments on commit 2c23300

Please sign in to comment.