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

Allows use of external database or renaming of docker database service. #4771

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions contrib/docker/ckan-entrypoint.sh
Expand Up @@ -34,17 +34,13 @@ set_environment () {
export CKAN_SMTP_PASSWORD=${CKAN_SMTP_PASSWORD}
export CKAN_SMTP_MAIL_FROM=${CKAN_SMTP_MAIL_FROM}
export CKAN_MAX_UPLOAD_SIZE_MB=${CKAN_MAX_UPLOAD_SIZE_MB}
export CKAN_DB_HOST=$(echo $CKAN_SQLALCHEMY_URL | grep -o -P '(?<=@).*(?=/)')
}

write_config () {
ckan-paster make-config --no-interactive ckan "$CONFIG"
}

# Wait for PostgreSQL
while ! pg_isready -h db -U postgres; do
sleep 1;
done

# If we don't already have a config file, bootstrap
if [ ! -e "$CONFIG" ]; then
write_config
Expand All @@ -68,5 +64,11 @@ if [ -z "$CKAN_DATAPUSHER_URL" ]; then
fi

set_environment
ckan-paster --plugin=ckan db init -c "${CKAN_CONFIG}/production.ini"

# Wait for PostgreSQL
while ! pg_isready -h $CKAN_DB_HOST -U postgres; do
sleep 1;
done

ckan-paster --plugin=ckan $CKAN_DB_HOST init -c "${CKAN_CONFIG}/production.ini"
exec "$@"