Skip to content

Commit

Permalink
add capistrano deploy for biodiv
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 7, 2024
1 parent 37a9573 commit a8c39f9
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 5 deletions.
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 }
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,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"
42 changes: 37 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,31 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
activesupport (3.1.12)
multi_json (~> 1.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.3)
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 +108,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 @@ -158,9 +173,9 @@ GEM
http-cookie (1.0.7)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (0.9.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.7.6)
json (2.8.1)
json-canonicalization (0.4.0)
json-ld (3.2.5)
htmlentities (~> 4.3)
Expand All @@ -184,7 +199,7 @@ GEM
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1001)
mime-types-data (3.2024.1105)
mini_mime (1.1.5)
minitest (4.7.5)
mlanett-redis-lock (0.2.7)
Expand All @@ -193,6 +208,11 @@ GEM
mutex_m (0.2.0)
net-http-persistent (4.0.4)
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.3.0)
netrc (0.11.0)
oj (3.16.7)
bigdecimal (>= 3.0)
Expand Down Expand Up @@ -267,6 +287,12 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
sshkit (1.23.2)
base64
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
ostruct
sys-proctable (1.3.0)
ffi (~> 1.1)
systemu (2.6.5)
Expand All @@ -283,8 +309,14 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
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 (~> 1.16.3)
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, '192.168.0.22'

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 a8c39f9

Please sign in to comment.