From 09b9008d785eeb194b82a44f2cbdd40e8e773139 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Fri, 6 Dec 2024 13:56:27 +0100 Subject: [PATCH 01/11] add capistrano deployment to ncbo cron to test locally --- Capfile | 41 ++++++++++++ Gemfile | 4 ++ config/deploy.rb | 123 ++++++++++++++++++++++++++++++++++++ config/deploy/production.rb | 61 ++++++++++++++++++ config/deploy/staging.rb | 61 ++++++++++++++++++ 5 files changed, 290 insertions(+) create mode 100644 Capfile create mode 100644 config/deploy.rb create mode 100644 config/deploy/production.rb create mode 100644 config/deploy/staging.rb diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..86f6468f --- /dev/null +++ b/Capfile @@ -0,0 +1,41 @@ +require 'bundler/setup' +# 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" +require 'capistrano/locally' +#require 'new_relic/recipes' # announce deployments in NewRelic + +# 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 dcaf2c45..16013056 100644 --- a/Gemfile +++ b/Gemfile @@ -40,4 +40,8 @@ group :test do gem 'test-unit-minitest' end +gem 'capistrano-bundler', require: false +gem 'capistrano-locally', require: false +gem 'capistrano-rbenv', require: false + gem "binding_of_caller", "~> 1.0" diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 00000000..3a93d0f9 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,123 @@ +# config valid for current version and patch releases of Capistrano +lock "~> 3.19.2" + +set :author, "imadbourouche" +set :application, "ncbo_cron" +set :repo_url, "https://github.com/#{fetch(:author)}/#{fetch(:application)}.git" + +set :deploy_via, :remote_cache + +# 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, "/home/bourouch/capistrano_deploy_test/#{fetch(:application)}" + +# Default value for :log_level is :debug +set :log_level, :error + +# Default value for :linked_files is [] +# append :linked_files, "config/database.yml", 'config/master.key' + +# Default value for linked_dirs is [] +# set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} +set :linked_dirs, %w{log vendor/bundle tmp/pids tmp/sockets public/system} + + +# Default value for keep_releases is 5 +set :keep_releases, 5 +set :config_folder_path, "#{fetch(:application)}/#{fetch(:stage)}" + + +# If you want to restart using `touch tmp/restart.txt`, add this to your config/deploy.rb: + +SSH_JUMPHOST = ENV.include?('SSH_JUMPHOST') ? ENV['SSH_JUMPHOST'] : 'jumpbox.hostname.com' +SSH_JUMPHOST_USER = ENV.include?('SSH_JUMPHOST_USER') ? ENV['SSH_JUMPHOST_USER'] : 'username' + +# JUMPBOX_PROXY = "#{SSH_JUMPHOST_USER}@#{SSH_JUMPHOST}" +# set :ssh_options, { +# user: 'ontoportal', +# forward_agent: 'true', +# # keys: %w(config/deploy_id_rsa), +# auth_methods: %w(publickey), +# # use ssh proxy if API servers are on a private network +# proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p") +# } + +# private git repo for configuraiton +#PRIVATE_CONFIG_REPO = ENV.include?('PRIVATE_CONFIG_REPO') ? ENV['PRIVATE_CONFIG_REPO'] : 'https://your_github_pat_token@github.com/your_organization/ontoportal-configs.git' +desc "Check if agent forwarding is working" +task :forwarding do + on roles(:all) do |h| + if test("env | grep SSH_AUTH_SOCK") + info "Agent forwarding is up to #{h}" + else + error "Agent forwarding is NOT up to #{h}" + end + end +end + +# inspired by http://nathaniel.talbott.ws/blog/2013/03/14/post-deploy-smoke-tests/ +desc 'Run smoke test' +task :smoke_test do + on roles(:app) do + curl_opts = '--max-time 240 --connect-timeout 15 --retry 2' + failed_tests = [] + curl_result = `ls #{fetch(:deploy_to)}` + failed_tests << 'smoke test FAILURE.' unless (curl_result != '') + + if failed_tests.empty? + puts "smoke test passed on #{host}" + else + puts "\n\n****************************\n\n" + puts "SMOKE TEST FAILED on #{host}\n\n" + failed_tests.each do |failure| + puts failure + end + puts "\n\n****************************\n\n" + end + end +end + +namespace :deploy do + +# desc 'Incorporate the private repository content' +# # Get cofiguration from repo if PRIVATE_CONFIG_REPO env var is set +# # or get config from local directory if LOCAL_CONFIG_PATH env var is set +# task :get_config do +# if defined?(PRIVATE_CONFIG_REPO) +# TMP_CONFIG_PATH = "/tmp/#{SecureRandom.hex(15)}".freeze +# on roles(:app) do +# execute "git clone -q #{PRIVATE_CONFIG_REPO} #{TMP_CONFIG_PATH}" +# execute "rsync -av #{TMP_CONFIG_PATH}/#{fetch(:config_folder_path)}/ #{release_path}/" +# execute "rm -rf #{TMP_CONFIG_PATH}" +# end +# elsif defined?(LOCAL_CONFIG_PATH) +# on roles(:app) do +# execute "rsync -av #{LOCAL_CONFIG_PATH}/#{fetch(:application)}/ #{release_path}/" +# end +# end +# end + + desc 'Restart application' + task :restart do + on roles(:app), in: :sequence, wait: 5 do + # Your restart mechanism here, for example: + # execute :touch, release_path.join('tmp/restart.txt') + execute 'ls /home/bourouch/capistrano_deploy_test' + execute 'sleep 5' + end + end + + #after :updating, :get_config + after :publishing, :restart + +# after :restart, :clear_cache do +# on roles(:web), in: :groups, limit: 3, wait: 10 do +# # Here we can do anything such as: +# # within release_path do +# # execute :rake, 'cache:clear' +# # end +# end +# end +end diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 00000000..e892522a --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,61 @@ +# server-based syntax +# ====================== +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value +# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value +# server "db.example.com", user: "deploy", roles: %w{db} + + + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. +role :app, %w{127.0.0.1} +#role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system +set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'master' + + + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. + + + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start +# +# Global options +# -------------- +# set :ssh_options, { +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# server "example.com", +# user: "user_name", +# roles: %w{web app}, +# ssh_options: { +# user: "user_name", # overrides user setting above +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(publickey password) +# # password: "please use keys" +# } +set :log_level, :error \ No newline at end of file diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb new file mode 100644 index 00000000..eed0ebdb --- /dev/null +++ b/config/deploy/staging.rb @@ -0,0 +1,61 @@ +# server-based syntax +# ====================== +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value +# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value +# server "db.example.com", user: "deploy", roles: %w{db} + + + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. +role :app, %w{127.0.0.1} +#role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system +set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'development' + + + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. + + + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start +# +# Global options +# -------------- +# set :ssh_options, { +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# server "example.com", +# user: "user_name", +# roles: %w{web app}, +# ssh_options: { +# user: "user_name", # overrides user setting above +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(publickey password) +# # password: "please use keys" +# } +set :log_level, :error \ No newline at end of file From 60f711cc23539034736df8bba039d608d7714689 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Tue, 10 Dec 2024 10:25:37 +0100 Subject: [PATCH 02/11] add deployment group in Gemfile --- .gitignore | 2 ++ Capfile | 1 - Gemfile | 12 +++++++++--- config/deploy.rb | 3 --- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 3fdd0c6d..4c1af01d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ repo* .DS_Store tmp +vendor/bundle/* + # Code coverage reports coverage* diff --git a/Capfile b/Capfile index 86f6468f..ea67e952 100644 --- a/Capfile +++ b/Capfile @@ -1,4 +1,3 @@ -require 'bundler/setup' # Load DSL and set up stages require "capistrano/setup" diff --git a/Gemfile b/Gemfile index 16013056..4410dcf8 100644 --- a/Gemfile +++ b/Gemfile @@ -40,8 +40,14 @@ group :test do gem 'test-unit-minitest' end -gem 'capistrano-bundler', require: false -gem 'capistrano-locally', require: false -gem 'capistrano-rbenv', require: false +group :deployment 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/config/deploy.rb b/config/deploy.rb index 3a93d0f9..adb672ea 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,6 +1,3 @@ -# config valid for current version and patch releases of Capistrano -lock "~> 3.19.2" - set :author, "imadbourouche" set :application, "ncbo_cron" set :repo_url, "https://github.com/#{fetch(:author)}/#{fetch(:application)}.git" From 26d64671e278062b0165ab213b3b08fadfd18e8e Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Tue, 10 Dec 2024 10:25:47 +0100 Subject: [PATCH 03/11] update Gemfile.lock --- Gemfile.lock | 80 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 22 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8007b8cd..143ba800 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ GIT GIT remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git - revision: c0f8697529ebfca2c3fe90d46d9482ac72f13362 + revision: aff7843c7f2d8b2334a21e0f05599494ffde1427 branch: development specs: ontologies_linked_data (0.0.1) @@ -74,17 +74,35 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (3.2.22.5) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) 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.2) + 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 +112,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) @@ -105,7 +124,7 @@ GEM faraday-net_http (3.0.2) faraday-retry (2.2.1) faraday (~> 2.0) - ffi (1.17.0) + ffi (1.16.3) gapic-common (0.21.1) faraday (>= 1.9, < 3.a) faraday-retry (>= 1.0, < 3.a) @@ -114,10 +133,10 @@ GEM googleapis-common-protos-types (>= 1.11.0, < 2.a) googleauth (~> 1.9) grpc (~> 1.59) - google-analytics-data (0.6.1) + google-analytics-data (0.6.0) google-analytics-data-v1beta (>= 0.11, < 2.a) google-cloud-core (~> 1.6) - google-analytics-data-v1beta (0.13.1) + google-analytics-data-v1beta (0.14.0) gapic-common (>= 0.21.1, < 2.a) google-cloud-errors (~> 1.0) google-apis-analytics_v3 (0.16.0) @@ -136,7 +155,7 @@ GEM google-cloud-env (2.1.1) faraday (>= 1.0, < 3.a) google-cloud-errors (1.4.0) - google-protobuf (3.25.5-x86_64-linux) + google-protobuf (3.25.3) googleapis-common-protos (1.6.0) google-protobuf (>= 3.18, < 5.a) googleapis-common-protos-types (~> 1.7) @@ -150,17 +169,17 @@ GEM multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - grpc (1.65.2-x86_64-linux) + grpc (1.65.2) google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) htmlentities (4.3.4) http-accept (1.7.0) - http-cookie (1.0.7) + http-cookie (1.0.8) domain_name (~> 0.5) httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.7.4) + json (2.9.0) json-canonicalization (0.4.0) json-ld (3.2.5) htmlentities (~> 4.3) @@ -175,7 +194,7 @@ GEM addressable (~> 2.8) libxml-ruby (5.0.3) link_header (0.0.8) - logger (1.6.1) + logger (1.6.2) macaddr (1.7.2) systemu (~> 2.6.5) mail (2.6.6) @@ -184,28 +203,33 @@ GEM mime-types (3.6.0) logger mime-types-data (~> 3.2015) - mime-types-data (3.2024.1001) + mime-types-data (3.2024.1203) mini_mime (1.1.5) minitest (4.7.5) mlanett-redis-lock (0.2.7) redis multi_json (1.15.0) - mutex_m (0.2.0) - net-http-persistent (4.0.4) + mutex_m (0.3.0) + net-http-persistent (4.0.5) 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.6) + oj (3.16.7) bigdecimal (>= 3.0) ostruct (>= 0.2) omni_logger (0.1.4) logger os (1.1.4) - ostruct (0.6.0) + ostruct (0.6.1) parallel (1.26.3) parseconfig (1.1.2) pony (1.13.1) mail (>= 2.0) - pry (0.14.2) + pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) public_suffix (5.1.1) @@ -267,24 +291,36 @@ 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) test-unit-minitest (0.9.1) minitest (~> 4.7) + thread_safe (0.3.6) trailblazer-option (0.1.2) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) + tzinfo (0.3.62) uber (0.1.0) uuid (2.3.9) macaddr (~> 1.0) PLATFORMS - x86_64-linux + ruby 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! @@ -314,4 +350,4 @@ DEPENDENCIES test-unit-minitest BUNDLED WITH - 2.3.15 + 2.1.4 From cea7830377259b6e268baaf197ff141a19e0cdfc Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Wed, 11 Dec 2024 09:54:55 +0100 Subject: [PATCH 04/11] changing configurations --- config/deploy.rb | 96 ++++++++++++++++--------------------- config/deploy/agroportal.rb | 19 ++++++++ config/deploy/production.rb | 61 ----------------------- config/deploy/staging.rb | 72 ++++++---------------------- config/deploy/test.rb | 19 ++++++++ 5 files changed, 94 insertions(+), 173 deletions(-) create mode 100644 config/deploy/agroportal.rb delete mode 100644 config/deploy/production.rb create mode 100644 config/deploy/test.rb diff --git a/config/deploy.rb b/config/deploy.rb index adb672ea..9e2c0e92 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,17 +8,17 @@ # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp # Default deploy_to directory is /var/www/my_app_name -set :deploy_to, "/home/bourouch/capistrano_deploy_test/#{fetch(:application)}" +set :deploy_to, "/srv/ontoportal/#{fetch(:application)}" # Default value for :log_level is :debug -set :log_level, :error +set :log_level, :debug # Default value for :linked_files is [] # append :linked_files, "config/database.yml", 'config/master.key' # Default value for linked_dirs is [] # set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} -set :linked_dirs, %w{log vendor/bundle tmp/pids tmp/sockets public/system} +set :linked_dirs, %w{log logs vendor/bundle tmp/pids tmp/sockets public/system} # Default value for keep_releases is 5 @@ -31,15 +31,15 @@ SSH_JUMPHOST = ENV.include?('SSH_JUMPHOST') ? ENV['SSH_JUMPHOST'] : 'jumpbox.hostname.com' SSH_JUMPHOST_USER = ENV.include?('SSH_JUMPHOST_USER') ? ENV['SSH_JUMPHOST_USER'] : 'username' -# JUMPBOX_PROXY = "#{SSH_JUMPHOST_USER}@#{SSH_JUMPHOST}" -# set :ssh_options, { -# user: 'ontoportal', -# forward_agent: 'true', -# # keys: %w(config/deploy_id_rsa), -# auth_methods: %w(publickey), -# # use ssh proxy if API servers are on a private network -# proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p") -# } +JUMPBOX_PROXY = "#{SSH_JUMPHOST_USER}@#{SSH_JUMPHOST}" +set :ssh_options, { + user: 'bourouch', + forward_agent: 'true', + keys: %w(config/deploy_id_rsa), + auth_methods: %w(publickey), + # use ssh proxy if API servers are on a private network + #proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p") +} # private git repo for configuraiton #PRIVATE_CONFIG_REPO = ENV.include?('PRIVATE_CONFIG_REPO') ? ENV['PRIVATE_CONFIG_REPO'] : 'https://your_github_pat_token@github.com/your_organization/ontoportal-configs.git' @@ -54,67 +54,53 @@ end end -# inspired by http://nathaniel.talbott.ws/blog/2013/03/14/post-deploy-smoke-tests/ -desc 'Run smoke test' +# Smoke test for checking if the service is up +desc 'Smoke test: Check if ncbo_cron service is running' task :smoke_test do - on roles(:app) do - curl_opts = '--max-time 240 --connect-timeout 15 --retry 2' - failed_tests = [] - curl_result = `ls #{fetch(:deploy_to)}` - failed_tests << 'smoke test FAILURE.' unless (curl_result != '') - - if failed_tests.empty? - puts "smoke test passed on #{host}" + on roles(:app), in: :sequence, wait: 5 do + # Check if the service is running using systemctl + result = `systemctl is-active ncbo_cron` + if result.strip == 'active' + info "ncbo_cron service is up and running!" else - puts "\n\n****************************\n\n" - puts "SMOKE TEST FAILED on #{host}\n\n" - failed_tests.each do |failure| - puts failure - end - puts "\n\n****************************\n\n" + error "ncbo_cron service failed to start." end end end namespace :deploy do -# desc 'Incorporate the private repository content' -# # Get cofiguration from repo if PRIVATE_CONFIG_REPO env var is set -# # or get config from local directory if LOCAL_CONFIG_PATH env var is set -# task :get_config do -# if defined?(PRIVATE_CONFIG_REPO) -# TMP_CONFIG_PATH = "/tmp/#{SecureRandom.hex(15)}".freeze -# on roles(:app) do -# execute "git clone -q #{PRIVATE_CONFIG_REPO} #{TMP_CONFIG_PATH}" -# execute "rsync -av #{TMP_CONFIG_PATH}/#{fetch(:config_folder_path)}/ #{release_path}/" -# execute "rm -rf #{TMP_CONFIG_PATH}" -# end -# elsif defined?(LOCAL_CONFIG_PATH) -# on roles(:app) do -# execute "rsync -av #{LOCAL_CONFIG_PATH}/#{fetch(:application)}/ #{release_path}/" -# end -# end -# end + desc 'Incorporate the private repository content' + # Get cofiguration from repo if PRIVATE_CONFIG_REPO env var is set + # or get config from local directory if LOCAL_CONFIG_PATH env var is set + task :get_config do + if defined?(PRIVATE_CONFIG_REPO) + TMP_CONFIG_PATH = "/tmp/#{SecureRandom.hex(15)}".freeze + on roles(:app) do + execute "git clone -q #{PRIVATE_CONFIG_REPO} #{TMP_CONFIG_PATH}" + execute "rsync -av #{TMP_CONFIG_PATH}/#{fetch(:config_folder_path)}/ #{release_path}/" + execute "rm -rf #{TMP_CONFIG_PATH}" + end + elsif defined?(LOCAL_CONFIG_PATH) + on roles(:app) do + execute "rsync -av #{LOCAL_CONFIG_PATH}/#{fetch(:application)}/ #{release_path}/" + end + end + end desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do # Your restart mechanism here, for example: # execute :touch, release_path.join('tmp/restart.txt') - execute 'ls /home/bourouch/capistrano_deploy_test' + #execute 'sudo systemctl restart ncbo_cron' + execute 'ls /srv/ontoportal/ncbo_cron' execute 'sleep 5' end end - #after :updating, :get_config + after :updating, :get_config after :publishing, :restart + after :restart, :smoke_test -# after :restart, :clear_cache do -# on roles(:web), in: :groups, limit: 3, wait: 10 do -# # Here we can do anything such as: -# # within release_path do -# # execute :rake, 'cache:clear' -# # end -# end -# end end diff --git a/config/deploy/agroportal.rb b/config/deploy/agroportal.rb new file mode 100644 index 00000000..47d337e9 --- /dev/null +++ b/config/deploy/agroportal.rb @@ -0,0 +1,19 @@ +# Simple Role Syntax +# ================== +# Supports bulk-adding hosts to roles, the primary +# server in each group is considered to be the first +# unless any hosts have the primary property set. +# Don't declare `role :all`, it's a meta role +#role :app, %w[agroportal.lirmm.fr] +#role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system +role :app, %w{127.0.0.1} +role :db, %w{127.0.0.1} +set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'master' +# Extended Server Syntax +# ====================== +# This can be used to drop a more detailed server +# definition into the server list. The second argument +# something that quacks like a hash can be used to set +# extended properties on the server. +# server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value +set :log_level, :error diff --git a/config/deploy/production.rb b/config/deploy/production.rb deleted file mode 100644 index e892522a..00000000 --- a/config/deploy/production.rb +++ /dev/null @@ -1,61 +0,0 @@ -# server-based syntax -# ====================== -# Defines a single server with a list of roles and multiple properties. -# You can define all roles on a single server, or split them: - -# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value -# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value -# server "db.example.com", user: "deploy", roles: %w{db} - - - -# role-based syntax -# ================== - -# Defines a role with one or multiple servers. The primary server in each -# group is considered to be the first unless any hosts have the primary -# property set. Specify the username and a domain or IP for the server. -# Don't use `:all`, it's a meta role. -role :app, %w{127.0.0.1} -#role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system -set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'master' - - - -# Configuration -# ============= -# You can set any configuration variable like in config/deploy.rb -# These variables are then only loaded and set in this stage. -# For available Capistrano configuration variables see the documentation page. -# http://capistranorb.com/documentation/getting-started/configuration/ -# Feel free to add new variables to customise your setup. - - - -# Custom SSH Options -# ================== -# You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult the Net::SSH documentation. -# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start -# -# Global options -# -------------- -# set :ssh_options, { -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(password) -# } -# -# The server-based syntax can be used to override options: -# ------------------------------------ -# server "example.com", -# user: "user_name", -# roles: %w{web app}, -# ssh_options: { -# user: "user_name", # overrides user setting above -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(publickey password) -# # password: "please use keys" -# } -set :log_level, :error \ No newline at end of file diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index eed0ebdb..5feb8c7c 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,61 +1,19 @@ -# server-based syntax -# ====================== -# Defines a single server with a list of roles and multiple properties. -# You can define all roles on a single server, or split them: - -# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value -# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value -# server "db.example.com", user: "deploy", roles: %w{db} - - - -# role-based syntax +# Simple Role Syntax # ================== - -# Defines a role with one or multiple servers. The primary server in each -# group is considered to be the first unless any hosts have the primary -# property set. Specify the username and a domain or IP for the server. -# Don't use `:all`, it's a meta role. +# Supports bulk-adding hosts to roles, the primary +# server in each group is considered to be the first +# unless any hosts have the primary property set. +# Don't declare `role :all`, it's a meta role +# role :app, %w{stageportal.lirmm.fr} +# role :db, %w{stageportal.lirmm.fr} # sufficient to run db:migrate only on one system role :app, %w{127.0.0.1} -#role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system +role :db, %w{127.0.0.1} set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'development' - - - -# Configuration -# ============= -# You can set any configuration variable like in config/deploy.rb -# These variables are then only loaded and set in this stage. -# For available Capistrano configuration variables see the documentation page. -# http://capistranorb.com/documentation/getting-started/configuration/ -# Feel free to add new variables to customise your setup. - - - -# Custom SSH Options -# ================== -# You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult the Net::SSH documentation. -# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start -# -# Global options -# -------------- -# set :ssh_options, { -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(password) -# } -# -# The server-based syntax can be used to override options: -# ------------------------------------ -# server "example.com", -# user: "user_name", -# roles: %w{web app}, -# ssh_options: { -# user: "user_name", # overrides user setting above -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(publickey password) -# # password: "please use keys" -# } +# Extended Server Syntax +# ====================== +# This can be used to drop a more detailed server +# definition into the server list. The second argument +# something that quacks like a hash can be used to set +# extended properties on the server. +#server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value set :log_level, :error \ No newline at end of file diff --git a/config/deploy/test.rb b/config/deploy/test.rb new file mode 100644 index 00000000..650fa7cd --- /dev/null +++ b/config/deploy/test.rb @@ -0,0 +1,19 @@ +# Simple Role Syntax +# ================== +# Supports bulk-adding hosts to roles, the primary +# server in each group is considered to be the first +# unless any hosts have the primary property set. +# Don't declare `role :all`, it's a meta role +# role :app, %w{testportal.lirmm.fr} +# role :db, %w{testportal.lirmm.fr} # sufficient to run db:migrate only on one system +role :app, %w{127.0.0.1} +role :db, %w{127.0.0.1} +set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'feature/add-capistrano-deployment' +# Extended Server Syntax +# ====================== +# This can be used to drop a more detailed server +# definition into the server list. The second argument +# something that quacks like a hash can be used to set +# extended properties on the server. +#server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value +set :log_level, :error \ No newline at end of file From d9f8135a9adf6142e118c802b13a60d5d4fa8d06 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Wed, 11 Dec 2024 09:55:06 +0100 Subject: [PATCH 05/11] update Gemfile.lock --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 143ba800..da234d90 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ GIT GIT remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git - revision: aff7843c7f2d8b2334a21e0f05599494ffde1427 + revision: 6fd6960a1f134ec8c8aff07a5897bb0da12bcc8d branch: development specs: ontologies_linked_data (0.0.1) @@ -254,7 +254,7 @@ GEM rexml (~> 3.2) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.22.2) + redis-client (0.23.0) connection_pool representable (3.2.0) declarative (< 0.1.0) From e45cf9b4d3e6e32ebb11ff7760e038f8f024acf6 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Wed, 11 Dec 2024 11:43:42 +0100 Subject: [PATCH 06/11] add deploy workflow --- .github/workflows/deploy.yml | 93 ++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..a35bf88e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,93 @@ +# Workflow to deploy NCBO Cron to stage/prod systems +# +# Required github secrets: +# +# CONFIG_REPO - github repo containing config and customizations for NCBO_CRON. Format 'author/private_config_repo' +# it is used for getting capistrano deployment configuration for stages on the github actions runner and +# PRIVATE_CONFIG_REPO env var is constructed from it which is used by capistrano on the API hosts for pulling configs. +# +# GH_PAT - github Personal Access Token for accessing private config repo +# +# SSH_JUMPHOST - ssh jump/proxy host though which deployments have to though if API nodes live on private network. +# SSH_JUMPHOST_USER - username to use to connect to the ssh jump/proxy. +# +# DEPLOY_ENC_KEY - key for decrypting deploymnet ssh key residing in config/ +# this SSH key is used for accessing jump host, API nodes, and private github repo. + +name: Capistrano Deployment +# Controls when the action will run. +on: + push: + branches: + - stage + - test + # Allows running this workflow manually from the Actions tab + workflow_dispatch: + inputs: + BRANCH: + description: "Branch/tag to deploy" + type: choice + options: + - stage + - test + - master + default: stage + required: true + environment: + description: "target environment to deploy to" + type: choice + options: + - staging + - test + - agroportal + default: stage +jobs: + deploy: + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: default #install gems required primarely for deployment in order to speed up workflow + PRIVATE_CONFIG_REPO: ${{ format('git@github.com:{0}.git', secrets.CONFIG_REPO) }} + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: set branch/tag and environment to deploy from inputs + run: | + # workflow_dispatch default input doesn't get set on push so we need to set defaults + # via shell parameter expansion + + USER_INPUT_BRANCH="${{ inputs.branch || github.head_ref || 'master' }}" + echo "BRANCH=${USER_INPUT_BRANCH}" >> $GITHUB_ENV + + USER_INPUT_ENVIRONMENT=${{ inputs.environment }} + echo "TARGET=${USER_INPUT_ENVIRONMENT:-test}" >> $GITHUB_ENV + + CONFIG_REPO=${{ secrets.CONFIG_REPO }} + GH_PAT=${{ secrets.GH_PAT }} + echo "PRIVATE_CONFIG_REPO=https://${GH_PAT}@github.com/${CONFIG_REPO}" >> $GITHUB_ENV + + echo "SSH_JUMPHOST=${{ secrets.SSH_JUMPHOST }}" >> $GITHUB_ENV + echo "SSH_JUMPHOST_USER=${{ secrets.SSH_JUMPHOST_USER }}" >> $GITHUB_ENV + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.8 # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: get-deployment-config + uses: actions/checkout@v3 + with: + repository: ${{ secrets.CONFIG_REPO }} # repository containing deployment settings + token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT + path: deploy_config + - name: copy-deployment-config + run: cp -r deploy_config/ncbo_cron/${{ inputs.environment }}/* . + # add ssh hostkey so that capistrano doesn't complain + - name: Add jumphost's hostkey to Known Hosts + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_JUMPHOST }}" + ssh-keyscan -H ${{ secrets.SSH_JUMPHOST }} > ~/.ssh/known_hosts + shell: bash + - uses: miloserdow/capistrano-deploy@master + with: + target: ${{ env.TARGET }} # which environment to deploy + deploy_key: ${{ secrets.DEPLOY_ENC_KEY }} # Name of the variable configured in Settings/Secrets of your github project \ No newline at end of file From b14dd2c27017bbb9a950beb6cadaeef0b67a1180 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Wed, 11 Dec 2024 16:24:52 +0100 Subject: [PATCH 07/11] Update Gemfile.lock --- Gemfile.lock | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index da234d90..c0989308 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ GIT GIT remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git - revision: 6fd6960a1f134ec8c8aff07a5897bb0da12bcc8d + revision: c0f8697529ebfca2c3fe90d46d9482ac72f13362 branch: development specs: ontologies_linked_data (0.0.1) @@ -74,12 +74,9 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (4.0.13) - i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + activesupport (3.2.22.5) + i18n (~> 0.6, >= 0.6.4) + multi_json (~> 1.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) airbrussh (1.5.3) @@ -155,7 +152,7 @@ GEM google-cloud-env (2.1.1) faraday (>= 1.0, < 3.a) google-cloud-errors (1.4.0) - google-protobuf (3.25.3) + google-protobuf (3.25.3-x86_64-linux) googleapis-common-protos (1.6.0) google-protobuf (>= 3.18, < 5.a) googleapis-common-protos-types (~> 1.7) @@ -169,17 +166,17 @@ GEM multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - grpc (1.65.2) + grpc (1.65.2-x86_64-linux) google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) htmlentities (4.3.4) http-accept (1.7.0) - http-cookie (1.0.8) + http-cookie (1.0.7) domain_name (~> 0.5) httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.9.0) + json (2.7.4) json-canonicalization (0.4.0) json-ld (3.2.5) htmlentities (~> 4.3) @@ -194,7 +191,7 @@ GEM addressable (~> 2.8) libxml-ruby (5.0.3) link_header (0.0.8) - logger (1.6.2) + logger (1.6.1) macaddr (1.7.2) systemu (~> 2.6.5) mail (2.6.6) @@ -203,14 +200,14 @@ GEM mime-types (3.6.0) logger mime-types-data (~> 3.2015) - mime-types-data (3.2024.1203) + mime-types-data (3.2024.1001) mini_mime (1.1.5) minitest (4.7.5) mlanett-redis-lock (0.2.7) redis multi_json (1.15.0) - mutex_m (0.3.0) - net-http-persistent (4.0.5) + 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) @@ -218,18 +215,18 @@ GEM net-ssh (>= 5.0.0, < 8.0.0) net-ssh (7.3.0) netrc (0.11.0) - oj (3.16.7) + oj (3.16.6) bigdecimal (>= 3.0) ostruct (>= 0.2) omni_logger (0.1.4) logger os (1.1.4) - ostruct (0.6.1) + ostruct (0.6.0) parallel (1.26.3) parseconfig (1.1.2) pony (1.13.1) mail (>= 2.0) - pry (0.15.0) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) public_suffix (5.1.1) @@ -254,7 +251,7 @@ GEM rexml (~> 3.2) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.22.2) connection_pool representable (3.2.0) declarative (< 0.1.0) @@ -302,15 +299,15 @@ GEM systemu (2.6.5) test-unit-minitest (0.9.1) minitest (~> 4.7) - thread_safe (0.3.6) trailblazer-option (0.1.2) - tzinfo (0.3.62) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uber (0.1.0) uuid (2.3.9) macaddr (~> 1.0) PLATFORMS - ruby + x86_64-linux DEPENDENCIES bcrypt_pbkdf (>= 1.0, < 2.0) @@ -350,4 +347,4 @@ DEPENDENCIES test-unit-minitest BUNDLED WITH - 2.1.4 + 2.3.15 From c18e510a740fc04de0928d68aa3e9e864f929faf Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Fri, 13 Dec 2024 11:13:39 +0100 Subject: [PATCH 08/11] change configurations --- config/deploy.rb | 11 +++++------ config/deploy/agroportal.rb | 5 +---- config/deploy/staging.rb | 7 ++----- config/deploy/test.rb | 7 ++----- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 9e2c0e92..b7d255a2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,4 +1,4 @@ -set :author, "imadbourouche" +set :author, "ontoportal-lirmm" set :application, "ncbo_cron" set :repo_url, "https://github.com/#{fetch(:author)}/#{fetch(:application)}.git" @@ -18,7 +18,7 @@ # Default value for linked_dirs is [] # set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} -set :linked_dirs, %w{log logs vendor/bundle tmp/pids tmp/sockets public/system} +set :linked_dirs, %w{log vendor/bundle tmp/pids tmp/sockets public/system} # Default value for keep_releases is 5 @@ -33,12 +33,12 @@ JUMPBOX_PROXY = "#{SSH_JUMPHOST_USER}@#{SSH_JUMPHOST}" set :ssh_options, { - user: 'bourouch', + user: 'ontoportal', forward_agent: 'true', keys: %w(config/deploy_id_rsa), auth_methods: %w(publickey), # use ssh proxy if API servers are on a private network - #proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p") + proxy: Net::SSH::Proxy::Command.new("ssh #{JUMPBOX_PROXY} -W %h:%p") } # private git repo for configuraiton @@ -93,8 +93,7 @@ on roles(:app), in: :sequence, wait: 5 do # Your restart mechanism here, for example: # execute :touch, release_path.join('tmp/restart.txt') - #execute 'sudo systemctl restart ncbo_cron' - execute 'ls /srv/ontoportal/ncbo_cron' + execute 'sudo systemctl restart ncbo_cron' execute 'sleep 5' end end diff --git a/config/deploy/agroportal.rb b/config/deploy/agroportal.rb index 47d337e9..0ce7bb55 100644 --- a/config/deploy/agroportal.rb +++ b/config/deploy/agroportal.rb @@ -4,10 +4,7 @@ # server in each group is considered to be the first # unless any hosts have the primary property set. # Don't declare `role :all`, it's a meta role -#role :app, %w[agroportal.lirmm.fr] -#role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system -role :app, %w{127.0.0.1} -role :db, %w{127.0.0.1} +role :app, %w[agroportal.lirmm.fr] set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'master' # Extended Server Syntax # ====================== diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 5feb8c7c..8e2db320 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -4,11 +4,8 @@ # server in each group is considered to be the first # unless any hosts have the primary property set. # Don't declare `role :all`, it's a meta role -# role :app, %w{stageportal.lirmm.fr} -# role :db, %w{stageportal.lirmm.fr} # sufficient to run db:migrate only on one system -role :app, %w{127.0.0.1} -role :db, %w{127.0.0.1} -set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'development' +role :app, %w{stageportal.lirmm.fr} +set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'stage' # Extended Server Syntax # ====================== # This can be used to drop a more detailed server diff --git a/config/deploy/test.rb b/config/deploy/test.rb index 650fa7cd..8fc790cb 100644 --- a/config/deploy/test.rb +++ b/config/deploy/test.rb @@ -4,11 +4,8 @@ # server in each group is considered to be the first # unless any hosts have the primary property set. # Don't declare `role :all`, it's a meta role -# role :app, %w{testportal.lirmm.fr} -# role :db, %w{testportal.lirmm.fr} # sufficient to run db:migrate only on one system -role :app, %w{127.0.0.1} -role :db, %w{127.0.0.1} -set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'feature/add-capistrano-deployment' +role :app, %w{testportal.lirmm.fr} +set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'development' # Extended Server Syntax # ====================== # This can be used to drop a more detailed server From 48b2daf584d5b8292282a8ef0dabe22562e809f2 Mon Sep 17 00:00:00 2001 From: OntoPortal Bot Date: Mon, 16 Dec 2024 10:11:08 +0100 Subject: [PATCH 09/11] chagne test branch to development --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a35bf88e..5626e6c4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,7 +20,7 @@ on: push: branches: - stage - - test + - development # Allows running this workflow manually from the Actions tab workflow_dispatch: inputs: @@ -29,7 +29,7 @@ on: type: choice options: - stage - - test + - development - master default: stage required: true From 2b592551d5df8b871d26b18fe710c6eccd2cf727 Mon Sep 17 00:00:00 2001 From: OntoPortal Bot Date: Mon, 16 Dec 2024 11:47:41 +0100 Subject: [PATCH 10/11] update ontologies_linked_data in Gemfile.lock --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c0989308..4bcfba99 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ GIT GIT remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git - revision: c0f8697529ebfca2c3fe90d46d9482ac72f13362 + revision: e3cf9888c2113152aaa250ee0cfaae37c534a53a branch: development specs: ontologies_linked_data (0.0.1) From b762ebbcca080ebd733b96fcd86f0a5b50696c9c Mon Sep 17 00:00:00 2001 From: OntoPortal Bot Date: Mon, 16 Dec 2024 17:38:33 +0100 Subject: [PATCH 11/11] uncomment private_config_repo env variable --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index b7d255a2..59c11707 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -42,7 +42,7 @@ } # private git repo for configuraiton -#PRIVATE_CONFIG_REPO = ENV.include?('PRIVATE_CONFIG_REPO') ? ENV['PRIVATE_CONFIG_REPO'] : 'https://your_github_pat_token@github.com/your_organization/ontoportal-configs.git' +PRIVATE_CONFIG_REPO = ENV.include?('PRIVATE_CONFIG_REPO') ? ENV['PRIVATE_CONFIG_REPO'] : 'https://your_github_pat_token@github.com/your_organization/ontoportal-configs.git' desc "Check if agent forwarding is working" task :forwarding do on roles(:all) do |h|