Skip to content

Commit

Permalink
Merge pull request #42 from ioos/new_ckan_version_draft
Browse files Browse the repository at this point in the history
Adds custom PYCSW db and eliminates random-hex duplicate default
  • Loading branch information
benjwadams authored Sep 27, 2018
2 parents 5b85195 + dc6fbfb commit 3a9443e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions contrib/scripts/check_plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
# exit with true to ensure the

google_analytics_enabled=${GA_ENABLED:-}
pycsw_default_db=${PYCSW_DB:-pycsw}
config="/etc/ckan/production.ini"

# source the original CKAN entrypoint without the final call to exec
Expand Down Expand Up @@ -69,15 +70,16 @@ ckan-paster --plugin=ckan db init -c "$config"
ckan-paster --plugin=ckanext-spatial spatial initdb -c "$config"
ckan-paster --plugin=ckanext-harvest harvester initdb -c "$config"

db_q="SELECT 1 FROM pg_database WHERE datname='pycsw'"
db_q="SELECT 1 FROM pg_database WHERE datname='$pycsw_default_db'"
if [[ -z "$(psql -h db -U ckan -tAc "$db_q")" ]]; then
createdb -h db -U ckan pycsw -E utf-8
createdb -h db -U ckan "$pycsw_default_db" -E utf-8
fi

psql -h db -U ckan -qc 'CREATE EXTENSION IF NOT EXISTS postgis' pycsw
psql -h db -U ckan -qc 'CREATE EXTENSION IF NOT EXISTS postgis' "$pycsw_default_db"

# make sure /etc/pycsw/pycsw.cfg has correct DB set
tbl_q="SELECT 1 FROM information_schema.tables WHERE table_name = 'records'"
if [[ -z "$(psql -h db -U ckan -tAc "$tbl_q" pycsw)" ]]; then
if [[ -z "$(psql -h db -U ckan -tAc "$tbl_q" "$pycsw_default_db")" ]]; then
ckan-paster --plugin=ckanext-spatial ckan-pycsw setup -p \
/etc/pycsw/pycsw.cfg
fi
Expand All @@ -89,7 +91,6 @@ ckan-paster --plugin=ckan config-tool "$config" \
"ckan.site_logo = /ioos_logo.png" \
"ckan.harvest.mq.type = redis" \
"ckan.harvest.mq.hostname = redis" \
"ckanext.harvest.default_dataset_name_append = random-hex" \
"ckan.spatial.validator.profiles = iso19139ngdc" \
"ckanext.spatial.search_backend = solr" \
"ckan.spatial.harvest.continue_on_validation_errors = true"
Expand Down

0 comments on commit 3a9443e

Please sign in to comment.