Skip to content

Commit

Permalink
Merge pull request #302 from pulibrary/301-docker-locally
Browse files Browse the repository at this point in the history
Add working example for setting up local prod docker image.
  • Loading branch information
hackartisan authored Jan 29, 2025
2 parents be3851b + 9c8154e commit 0126995
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ To view staging logs go to https://grafana-nomad.lib.princeton.edu and log in wi

Build Docker Image: `docker build . -t dpul-collections`

Set up database: `mix setup`

The SECRET_KEY_BASE below is just a filler one for the purpose of testing locally.

Run Docker Image: `docker run -t -p 4000:4000 -e DATABASE_URL='ecto://postgres:@host.docker.internal:5434/database' -e SECRET_KEY_BASE='B8rwzeX3DFLveiJ4cP28lRGc0PWdEr8ZF/hDoPRucw95Nzf2IPnu7lhEB+Yldx6Z' dpul-collections`
Run Docker Image: `docker run -t -p 4000:4000 -e INDEXER=true -e INDEX_CACHE_COLLECTIONS='cache_version:1,write_collection:dpulc' -e PHX_HOST=localhost -e SOLR_CONFIG_SET='dpul-collections' -e SOLR_USERNAME='solr' -e SOLR_PASSWORD='SolrRocks' -e SOLR_READ_COLLECTION='dpulc' -e SOLR_BASE_URL='http://host.docker.internal:8985' -e RELEASE_IP=127.0.0.1 -e FIGGY_DATABASE_URL='ecto://postgres:[email protected]:5435/postgres' -e DATABASE_URL='ecto://postgres:@host.docker.internal:5434/dpul_collections_dev' -e SECRET_KEY_BASE='B8rwzeX3DFLveiJ4cP28lRGc0PWdEr8ZF/hDoPRucw95Nzf2IPnu7lhEB+Yldx6Z' dpul-collections`

Commit Solr: `curl http://solr:SolrRocks@localhost:8985/solr/dpulc/update?commit=true`

Available at http://localhost:4000
6 changes: 3 additions & 3 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ if config_env() == :prod do
base_url: solr_base_url,
read_collection: solr_read_collection,
config_set: solr_config_set,
username: "",
password: ""
username: System.get_env("SOLR_USERNAME") || "",
password: System.get_env("SOLR_PASSWORD") || ""
}

index_cache_collections =
Expand Down Expand Up @@ -116,7 +116,7 @@ if config_env() == :prod do

host = System.get_env("PHX_HOST") || "example.com"
port = String.to_integer(System.get_env("PORT") || "4000")
check_origin = ["https://#{host}"]
check_origin = true

config :dpul_collections, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")

Expand Down

0 comments on commit 0126995

Please sign in to comment.