forked from ontoportal/ontologies_api
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
137 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] = '' | ||
|