diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..42dd3a47 --- /dev/null +++ b/Capfile @@ -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 } diff --git a/Gemfile b/Gemfile index a347346f..c3f484ac 100644 --- a/Gemfile +++ b/Gemfile @@ -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) @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index 515f26fd..731a60b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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! diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 00000000..0c95ee8a --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,26 @@ +set :repo_url, "git@github.com: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 + + diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 00000000..40c7047f --- /dev/null +++ b/config/deploy/production.rb @@ -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 deployer@sshproxy.ontoportal.org -W %h:%p') +} diff --git a/config/deploy/test.rb b/config/deploy/test.rb new file mode 100644 index 00000000..2bdc1ebb --- /dev/null +++ b/config/deploy/test.rb @@ -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 deployer@sshproxy.ontoportal.org -W %h:%p') +}