Skip to content

Commit

Permalink
Set enable_mergejoin and enable_hashjoin for cgimap session
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jul 19, 2024
1 parent def627f commit 90e61c9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions images/web/cgimap.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/usr/bin/env bash

# Run SQL commands
psql -h $POSTGRES_HOST -d $POSTGRES_DB -U $POSTGRES_USER -c "SET enable_mergejoin = false;"
psql -h $POSTGRES_HOST -d $POSTGRES_DB -U $POSTGRES_USER -c "SET enable_hashjoin = false;"
psql -h $POSTGRES_HOST -d $POSTGRES_DB -U $POSTGRES_USER -c "SELECT pg_reload_conf();"

# Export environment variables
export PGPASSWORD=$POSTGRES_PASSWORD
export CGIMAP_HOST=$POSTGRES_HOST
export CGIMAP_DBNAME=$POSTGRES_DB
export CGIMAP_USERNAME=$POSTGRES_USER
Expand All @@ -25,13 +20,16 @@ export CGIMAP_MAX_RELATION_MEMBERS="32000"
# export CGIMAP_MODERATOR_MAXDEBT="1280"
# export CGIMAP_PIDFILE="/var/www/cgimap.pid"

# Check for web site status
# Verificar el estado del sitio web
if [[ "$WEBSITE_STATUS" == "database_readonly" || "$WEBSITE_STATUS" == "api_readonly" ]]; then
export CGIMAP_DISABLE_API_WRITE="true"
fi

if [[ "$WEBSITE_STATUS" == "database_offline" || "$WEBSITE_STATUS" == "api_offline" ]]; then
echo "Website is $WEBSITE_STATUS. No action required for cgimap service."
else
export PGOPTIONS="-c enable_mergejoin=off -c enable_hashjoin=off"
psql -h $POSTGRES_HOST -U $POSTGRES_USER -c "SHOW enable_mergejoin;"
psql -h $POSTGRES_HOST -U $POSTGRES_USER -c "SHOW enable_hashjoin;"
/usr/local/bin/openstreetmap-cgimap --port=8000 --daemon --instances=10
fi

0 comments on commit 90e61c9

Please sign in to comment.