Skip to content

Commit

Permalink
Enable cgimap
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Apr 9, 2024
1 parent 21db976 commit 039aa15
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 31 deletions.
1 change: 1 addition & 0 deletions compose/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
dockerfile: Dockerfile
ports:
- '80:80'
- '8080:8080'
env_file:
- ../envs/.env.web
- ../envs/.env.db
Expand Down
36 changes: 14 additions & 22 deletions images/web/config/production.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# Development mode in case domain is localhost

# ======Redirect to HTTPS
RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} !=127.0.0.1
# RewriteCond %{HTTP_HOST} !=localhost
# RewriteCond %{HTTP_HOST} !=127.0.0.1
# RewriteCond %{HTTPS} off
# RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Expand All @@ -18,28 +18,20 @@
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# <Location />
# # For TM, do not use cgimap auth.
# <If "%{HTTP_REFERER} !~ m#https://tasks(-\w+)?\.osmseed\.org/#">
# CGIPassAuth On
# </If>
# </Location>
<Location />
CGIPassAuth On
</Location>

# ======Proxying traffic to CGImap====
# RewriteCond %{REQUEST_URI} ^/api/0\.6/map
# RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
# RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
# RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]

# For changeset requests originating from TM, do not use cgimap.
# RewriteCond %{REQUEST_METHOD} ^POST$
# RewriteCond %{HTTP_REFERER} !^https://tasks(-\w+)?\.osmseed\.org/ [NC]
# RewriteRule ^/api/0\.6/changeset/[0-9]+/(upload|download)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteCond %{REQUEST_URI} ^/api/0\.6/map
RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]

# Relax Apache security settings
<Directory /var/www/public>
Expand Down
18 changes: 9 additions & 9 deletions images/web/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ while "$flag" = true; do
done &
# time rails i18n:js:export assets:precompile
bundle exec rails db:migrate
# /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
/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
bundle exec rake jobs:work &
apachectl -k start -DFOREGROUND
done

0 comments on commit 039aa15

Please sign in to comment.