Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV-1475 catalog indexing: update what env vars it uses for the database #76

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ services:
- gem_cache:/gems
environment:
- SOLR_URL=http://solr-sdr-catalog:9033/solr/catalog
- redirect_file=/dev/null
- NO_DB=1
- REDIRECT_FILE=/dev/null
#- NO_DB=1
network_mode: host
command: sleep infinity

Expand All @@ -37,6 +37,10 @@ services:
- PUSHGATEWAY=http://pushgateway:9091
- REDIRECT_FILE=/dev/null
- SOLR_URL=http://solr-sdr-catalog:9033/solr/catalog
- MARIADB_HT_RO_USERNAME=ht_rights
- MARIADB_HT_RO_PASSWORD=ht_rights
- MARIADB_HT_RO_HOST=mariadb
- MARIADB_HT_RO_DATABASE=ht
depends_on:
pushgateway: *healthy
mariadb: *healthy
Expand All @@ -54,6 +58,14 @@ services:
image: ghcr.io/hathitrust/db-image:latest
ports:
- "3306:3306"
environment:
# setting via MYSQL_ROOT_PASSWORD didn't work; this at least
# makes it clear that we have to dig out its generated root password
# from its startup
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: ht
MYSQL_USER: ht_rights
MYSQL_PASSWORD: ht_rights
healthcheck:
<<: *healthcheck-defaults
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
Expand Down
7 changes: 5 additions & 2 deletions lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ def env_local_file
Sequel.connect(Services[:db_connection_string], login_timeout: 2, pool_timeout: 100, max_connections: 6)
end

# From the Sequel Docs (https://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html):
# Note that when using a JDBC adapter, the best way to use Sequel is via Sequel.connect
# using a connection string, NOT Sequel.jdbc
Services.register(:db_connection_string) do
"jdbc:mysql://#{ENV["MYSQL_HOST"]}/#{ENV["MYSQL_DATABASE"]}? \
user=#{ENV["MYSQL_USER"]}&password=#{ENV["MYSQL_PASSWORD"]}& \
"jdbc:mysql://#{ENV["MARIADB_HT_RO_HOST"]}/#{ENV["MARIADB_HT_RO_DATABASE"]}? \
user=#{ENV["MARIADB_HT_RO_USERNAME"]}&password=#{ENV["MARIADB_HT_RO_PASSWORD"]}& \
useTimezone=true&serverTimezone=UTC"
end

Expand Down
Loading