Skip to content

Commit

Permalink
Update cgimap config to start and increase num of conection to postgr…
Browse files Browse the repository at this point in the history
…es DB - production
  • Loading branch information
Rub21 committed May 13, 2024
1 parent 6987b2a commit 8b9425f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion images/db/config/postgresql.production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '*'
# defaults to 'localhost'; use '*' for all
# (change requires restart)
#port = 5432 # (change requires restart)
max_connections = 200 # (change requires restart)
max_connections = 500 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
# (change requires restart)
Expand Down
30 changes: 30 additions & 0 deletions images/web/cgimap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
export CGIMAP_HOST=$POSTGRES_HOST
export CGIMAP_DBNAME=$POSTGRES_DB
export CGIMAP_USERNAME=$POSTGRES_USER
export CGIMAP_PASSWORD=$POSTGRES_PASSWORD
export CGIMAP_OAUTH_HOST=$POSTGRES_HOST
export CGIMAP_UPDATE_HOST=$POSTGRES_HOST
export CGIMAP_LOGFILE="/var/www/log/cgimap.log"
export CGIMAP_MEMCACHE=$OPENSTREETMAP_memcache_servers
export CGIMAP_RATELIMIT="204800"
export CGIMAP_MAXDEBT="250"
export CGIMAP_MAP_AREA="0.25"
export CGIMAP_MAP_NODES="100000"
export CGIMAP_MAX_WAY_NODES="2000"
export CGIMAP_MAX_RELATION_MEMBERS="32000"
# export CGIMAP_RATELIMIT_UPLOAD="true"
# export CGIMAP_MODERATOR_RATELIMIT="1048576"
# export CGIMAP_MODERATOR_MAXDEBT="1280"
# export CGIMAP_PIDFILE="/var/www/cgimap.pid"

# Check for web site status
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
/usr/local/bin/openstreetmap-cgimap --port=8000 --daemon --instances=10
fi
# pkill -9 -f 'openstreetmap-cgimap'
13 changes: 3 additions & 10 deletions images/web/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,9 @@ while "$flag" = true; do

bundle exec rails db:migrate

# Start lighttpd and cgimap
/usr/local/bin/openstreetmap-cgimap \
--port=8000 \
--daemon \
--instances=10 \
--dbname=$POSTGRES_DB \
--host=$POSTGRES_HOST \
--username=$POSTGRES_USER \
--password=$POSTGRES_PASSWORD \
--logfile log/cgimap.log
# Start cgimap
./cgimap.sh

# Start the delayed jobs queue worker and Start the app
bundle exec rake jobs:work &
apachectl -k start -DFOREGROUND
Expand Down

0 comments on commit 8b9425f

Please sign in to comment.