Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni authored Nov 6, 2024
2 parents 0eae7ed + a7402c1 commit 0d30fe7
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 178 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ bin/**
config/environments/*
!config/environments/development.rb.sample
!config/environments/config.rb.sample
!config/environments/biodiv-denbi-config.rb.sample

#ignore capistrano deployment
config/*.p12
Expand Down Expand Up @@ -69,4 +70,9 @@ create_permissions.log

ontologies_api.iml

# IDE files
.rubocop.yml
.solargraph.yml
.vscode

.env
9 changes: 8 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branc
gem 'ncbo_ontology_recommender', git: 'https://github.com/ontoportal-lirmm/ncbo_ontology_recommender.git', branch: 'development'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'development'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/BiodivPortal/ontologies_linked_data.git', branch: 'master'


group :development do
Expand All @@ -68,6 +68,13 @@ group :deployment do
gem 'capistrano-locally', require: false
gem 'capistrano-rbenv', require: false
gem 'ed25519', '>= 1.2', '< 2.0', require: false
gem 'pry'
gem 'shotgun', github: 'palexander/shotgun', branch: 'ncbo'

gem 'solargraph'
gem 'solargraph-rails'
gem 'rufo', require: false
gem 'reek', require: false
end


Expand Down
28 changes: 27 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ GEM
dante (0.2.0)
date (3.4.0)
declarative (0.0.20)
diff-lcs (1.5.1)
docile (1.4.1)
domain_name (0.6.20240107)
e2mmap (0.1.0)
ed25519 (1.3.0)
faraday (2.8.1)
base64
Expand Down Expand Up @@ -301,6 +303,7 @@ GEM
rainbow (3.1.1)
raindrops (0.20.1)
rake (10.5.0)
rbs (2.8.4)
rdf (3.2.11)
link_header (~> 0.0, >= 0.0.8)
rdf-raptor (3.2.0)
Expand Down Expand Up @@ -359,6 +362,7 @@ GEM
ruby-xxHash (0.4.0.2)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rufo (0.17.1)
rufus-scheduler (2.0.24)
tzinfo (>= 0.3.22)
signet (0.19.0)
Expand Down Expand Up @@ -388,7 +392,26 @@ GEM
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
sshkit (1.23.2)
solargraph (0.50.0)
backport (~> 1.2)
benchmark
bundler (~> 2.0)
diff-lcs (~> 1.4)
e2mmap
jaro_winkler (~> 1.5)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
parser (~> 3.0)
rbs (~> 2.0)
reverse_markdown (~> 2.0)
rubocop (~> 1.38)
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
solargraph-rails (1.1.0)
activesupport
solargraph
sshkit (1.23.0)
base64
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
Expand Down Expand Up @@ -464,6 +487,7 @@ DEPENDENCIES
redis
redis-rack-cache (~> 2.0)
redis-store (~> 1.10)
reek
request_store
rexml
rubocop
Expand All @@ -473,6 +497,8 @@ DEPENDENCIES
sinatra (~> 1.0)
sinatra-advanced-routes
sinatra-contrib (~> 1.0)
solargraph
solargraph-rails
sparql-client!
unicorn
unicorn-worker-killer
Expand Down
143 changes: 18 additions & 125 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,134 +1,27 @@
set :author, "ontoportal-lirmm"
set :application, "ontologies_api"
set :repo_url, "https://github.com/#{fetch(:author)}/#{fetch(:application)}.git"
set :repo_url, "[email protected]:biodivportal/ontologies_api.git"
set :user, 'ontoportal'

set :deploy_via, :remote_cache

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

# Default deploy_to directory is /var/www/my_app
set :deploy_to, "/srv/ontoportal/#{fetch(:application)}"

# Default value for :scm is :git
# set :scm, :git

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
set :log_level, :error

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}
set :deploy_to, '/srv/ontoportal/ontologies_api'

# 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 default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
set :stages, %w[appliance]
set :default_stage, 'appliance'
set :stage, 'appliance'
set :application, 'ontologies_api'

# Default value for keep_releases is 5
set :keep_releases, 5
set :config_folder_path, "#{fetch(:application)}/#{fetch(:stage)}"
# SSH parameters
set :ssh_port, 22
set :pty, true

# 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://[email protected]/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 = `curl #{curl_opts} -s -w "%{http_code}" "#{host}/documentation" -o /dev/null`
failed_tests << 'Documentation smoke test FAILURE.' unless (curl_result == '200')

if defined?(APIKEY)
curl_result = `curl #{curl_opts} -s -w "%{http_code}" "#{host}/ontologies?include=all&include_views=true&apikey=#{APIKEY}" -o /dev/null`
failed_tests << 'Ontologies smoke test FAILURE.' unless (curl_result == '200')
end
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
# Source code
set :repository_cache, "git_cache"
set :deploy_via, :remote_cache
set :ssh_options, { :forward_agent => true }

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
# Linked files and directories
append :linked_files, "config/environments/appliance.rb"

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 'sudo systemctl restart unicorn'
execute 'sleep 5'
end
end
append :linked_dirs, 'logs', '.bundle'
set :keep_releases, 2

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
17 changes: 0 additions & 17 deletions config/deploy/agroportal.rb

This file was deleted.

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')
}
17 changes: 0 additions & 17 deletions config/deploy/staging.rb

This file was deleted.

31 changes: 14 additions & 17 deletions config/deploy/test.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# 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
# 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
set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'test'
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')
}
51 changes: 51 additions & 0 deletions config/environments/biodiv-denbi-config.rb.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# coding: utf-8

$CLOUD_PROVIDER = ''

# ----------------------------------------------------------------------
# OntoPortal Customization


$HOSTNAME = $UI_HOSTNAME = "biodivportal.gfbio.dev"
$REST_HOSTNAME = "data.#{$HOSTNAME}"
$REST_PORT = nil
$REST_URL_PREFIX = "https://#{[$REST_HOSTNAME, $REST_PORT].compact.join(':')}/"

# Organization info
#$ORG = 'NCBO'
#$ORG_URL = 'http://ontoportal.org'

# Site name (required)
$SITE = 'BiodivPortal'

# Unique string representing the UI's id for use with the BioPortal Core
# This api key is automatically generated on first boot and updated here
$API_KEY = ""

# REST core service address
#$REST_URL = "http://#{$REST_HOSTNAME}:#{$REST_PORT}"

# Help page, launched from Support -> Help menu item in top navigation bar.
#$WIKI_HELP_PAGE = 'https://www.bioontology.org/wiki/index.php/BioPortal_Help'

# Google Analytics ID (optional)
#$ANALYTICS_ID = ''

# Announcements mailman mailing list REQUEST address, EX: [email protected]
# NOTE: You must use the REQUEST address for the mailing list. ONLY WORKS WITH MAILMAN LISTS.
#$ANNOUNCE_LIST = '[email protected]'

# Email addresses used for sending notifications (errors, feedback, support)
#$SUPPORT_EMAIL = '[email protected]'
#$ADMIN_EMAIL = '[email protected]'
#$ERROR_EMAIL = '[email protected]'

# reCAPTCHA
# In order to use reCAPTCHA on the user account creation page:
# 1. Obtain a key from reCAPTCHA: http://recaptcha.net
# 2. Include the corresponding keys below (between the single quotes)
# 3. Set the USE_RECAPTCHA option to 'true'
#ENV['USE_RECAPTCHA'] = 'false'
#ENV['RECAPTCHA_PUBLIC_KEY'] = ''
#ENV['RECAPTCHA_PRIVATE_KEY'] = ''

0 comments on commit 0d30fe7

Please sign in to comment.