Skip to content

Commit

Permalink
Feature: Update docker compose to add ncbo cron (#80)
Browse files Browse the repository at this point in the history
* update config.rb sample with the new SOLR configuration values

* add ncbo_cron service to the API docker compose file and sync the volumes beetween the two
  • Loading branch information
syphax-bouazzouni committed Jun 8, 2024
1 parent 3cc0045 commit e26a21f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 29 deletions.
4 changes: 2 additions & 2 deletions config/environments/config.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ REDIS_PORT = ENV.include?("REDIS_PORT") ? ENV["REDIS_PORT"
REPORT_PATH = ENV.include?("REPORT_PATH") ? ENV["REPORT_PATH"] : "./test/ontologies_report.json"
REPOSITORY_FOLDER = ENV.include?("REPOSITORY_FOLDER") ? ENV["REPOSITORY_FOLDER"] : "./test/data/ontology_files/repo"
REST_URL_PREFIX = ENV.include?("REST_URL_PREFIX") ? ENV["REST_URL_PREFIX"] : ENV["API_URL"] || "http://localhost:9393"
SOLR_PROP_SEARCH_URL = ENV.include?("SOLR_PROP_SEARCH_URL") ? ENV["SOLR_PROP_SEARCH_URL"] : "http://localhost:8983/solr/prop_search_core1"
SOLR_TERM_SEARCH_URL = ENV.include?("SOLR_TERM_SEARCH_URL") ? ENV["SOLR_TERM_SEARCH_URL"] : "http://localhost:8983/solr/term_search_core1"
SOLR_PROP_SEARCH_URL = ENV.include?("SOLR_PROP_SEARCH_URL") ? ENV["SOLR_PROP_SEARCH_URL"] : "http://localhost:8983/solr"
SOLR_TERM_SEARCH_URL = ENV.include?("SOLR_TERM_SEARCH_URL") ? ENV["SOLR_TERM_SEARCH_URL"] : "http://localhost:8983/solr"

begin
# For prefLabel extract main_lang first, or anything if no main found.
Expand Down
16 changes: 13 additions & 3 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
application = 'ontologies_api'
app_path = "/srv/ontoportal/#{application}"
working_directory "#{app_path}/current/"
current_version_path = "#{app_path}/current"

if Dir.exists?(current_version_path)
app_socket_path = app_path + '/shared/tmp/sockets/unicorn.sock'
app_gemfile_path = "#{current_version_path}/Gemfile"
else
current_version_path = app_path
app_gemfile_path = "#{app_path}/Gemfile"
app_socket_path = app_path + '/tmp/sockets/unicorn.sock'
end

working_directory current_version_path
worker_processes 8
timeout 300
preload_app true
Expand All @@ -12,12 +22,12 @@
pid 'tmp/pids/unicorn.pid'

# Listen on both fast-failing unix data socket (for nginx) & a backloggable TCP connection
listen app_path + '/shared/tmp/sockets/unicorn.sock', :backlog => 1024
listen app_socket_path, :backlog => 1024
#listen 8087, :backlog => 256

# Make sure unicorn is using current gems after rolling restarts
before_exec do |server|
ENV['BUNDLE_GEMFILE'] = "#{app_path}/current/Gemfile"
ENV['BUNDLE_GEMFILE'] = app_gemfile_path
end

before_fork do |server, worker|
Expand Down
76 changes: 52 additions & 24 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,25 @@ x-app: &app
environment: &env
# default bundle config resolves to /usr/local/bundle/config inside of the container
# we are setting it to local app directory if we need to use 'bundle config local'
BUNDLE_APP_CONFIG: /srv/ontoportal/ontologies_api/.bundle
BUNDLE_PATH: /srv/ontoportal/bundle
COVERAGE: 'true' # enable simplecov code coverage
REDIS_HOST: redis-ut
REDIS_PORT: 6379
SOLR_TERM_SEARCH_URL: http://solr-ut:8983/solr
SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr
GOO_BACKEND_NAME: 4store
GOO_PORT: 9000
GOO_HOST: 4store-ut
MGREP_HOST: mgrep-ut
MGREP_PORT: 55555
REPOSITORY_FOLDER: /srv/ontoportal/data/repository
REPORT_PATH: /srv/ontoportal/data/reports/ontologies_report.json
MGREP_DICTIONARY_FILE: /srv/ontoportal/data/mgrep
stdin_open: true
tty: true
command: /bin/bash
volumes:
# bundle volume for hosting gems installed by bundle; it speeds up gem install in local development
- bundle:/srv/ontoportal/bundle
- .:/srv/ontoportal/ontologies_api
# mount directory containing development version of the gems if you need to use 'bundle config local'
#- /Users/alexskr/ontoportal:/Users/alexskr/ontoportal
depends_on: &depends_on
solr-prop-ut:
condition: service_healthy
solr-term-ut:
condition: service_healthy
redis-ut:
condition: service_healthy



services:
api:
Expand All @@ -34,21 +30,46 @@ services:
.env
environment:
<<: *env
GOO_BACKEND_NAME: 4store
GOO_PORT: 9000
GOO_HOST: 4store-ut
GOO_PATH_QUERY: /sparql/
GOO_PATH_DATA: /data/
GOO_PATH_UPDATE: /update/
BUNDLE_APP_CONFIG: /srv/ontoportal/ontologies_api/.bundle
profiles:
- 4store
depends_on:
- solr-ut
- redis-ut
- mgrep-ut
- 4store-ut
- ncbo_cron
ports:
- "9393:9393"
volumes:
# bundle volume for hosting gems installed by bundle; it speeds up gem install in local development
- app_api:/srv/ontoportal/ontologies_api
- repository:/srv/ontoportal/data/repository

ncbo_cron:
<<: *app
image: agroportal/ncbo_cron:master
env_file:
.env
environment:
<<: *env
BUNDLE_APP_CONFIG: /srv/ontoportal/ncbo_cron/.bundle
command: "bundle exec bin/ncbo_cron"
profiles:
- 4store
volumes:
- app_cron:/srv/ontoportal/ncbo_cron
- repository:/srv/ontoportal/data/repository
- history:/usr/local/hist
- reports:/srv/ontoportal/data/reports
- mgrep:/srv/ontoportal/data/mgrep
- logs:/srv/ontoportal/ncbo_cron/logs
depends_on:
- solr-ut
- redis-ut
- mgrep-ut
- 4store-ut


mgrep-ut:
image: ontoportal/mgrep-ncbo:0.1
Expand Down Expand Up @@ -84,8 +105,9 @@ services:
ports:
- 8983:8983
command: bin/solr start -cloud -f
# volumes:
#- solr_data:/var/solr/data
volumes:
- solr_data:/var/solr/data

agraph-ut:
image: franzinc/agraph:v8.1.0
platform: linux/amd64
Expand Down Expand Up @@ -152,7 +174,13 @@ services:
- gb

volumes:
bundle:
app_api:
app_cron:
agdata:
4store:
#solr_data:
repository:
solr_data:
reports:
mgrep:
logs:
history:

0 comments on commit e26a21f

Please sign in to comment.