-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rub21
committed
Sep 1, 2023
1 parent
4b6efd6
commit 29f1164
Showing
7 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3' | ||
services: | ||
# ##################################################### | ||
# ## cgmap section | ||
# ##################################################### | ||
cgmap: | ||
image: osmseed-cgmap:v1 | ||
build: | ||
context: ../images/cgmap | ||
dockerfile: Dockerfile | ||
ports: | ||
# - '8000:8000' | ||
- '80:80' | ||
volumes: | ||
- ../data/cgmap-data:/apps/data/ | ||
# command: > | ||
# /bin/bash -c " ./start.sh" | ||
env_file: | ||
- ../envs/.env.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM ubuntu:20.04 AS builder | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update -qq && \ | ||
apt-get install -y gcc g++ make autoconf automake libtool \ | ||
libfcgi-dev libxml2-dev libmemcached-dev \ | ||
libboost-program-options-dev \ | ||
libcrypto++-dev libyajl-dev \ | ||
libpqxx-dev zlib1g-dev libargon2-dev libfmt-dev \ | ||
postgresql-12 postgresql-server-dev-all \ | ||
git ca-certificates \ | ||
--no-install-recommends && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
|
||
RUN git clone https://github.com/zerebubuth/openstreetmap-cgimap.git ./ | ||
RUN git checkout v0.8.8 | ||
|
||
# Compile, install and remove source | ||
RUN ./autogen.sh && \ | ||
./configure --enable-static --disable-shared --enable-yajl && \ | ||
make -j3 && \ | ||
make check && \ | ||
strip openstreetmap-cgimap | ||
|
||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update -qq && \ | ||
apt-get install -y \ | ||
libfcgi-bin libmemcached11 libboost-locale1.71.0 libboost-program-options1.71.0 \ | ||
libxml2 libcrypto++6 libyajl2 libpqxx-6.4 zlib1g libargon2-1 \ | ||
--no-install-recommends lighttpd && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /app/openstreetmap-cgimap /usr/local/bin | ||
|
||
RUN groupadd -g 61000 cgimap && \ | ||
useradd -g 61000 -l -M -s /bin/false -u 61000 cgimap | ||
|
||
USER cgimap | ||
COPY start.sh / | ||
COPY lighttpd.conf / | ||
CMD /start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# openstreetmap-cgimap | ||
|
||
This container is built using the configuration from Zerebubuth's OpenStreetMap CGImap GitHub repository, with minor modifications. | ||
|
||
|
||
# Build and up | ||
|
||
```sh | ||
docker compose -f compose/cgmap.yml build | ||
docker compose -f compose/cgmap.yml up | ||
``` | ||
|
||
Note: Ensure that you are running PostgreSQL on your local machine. For example: | ||
|
||
|
||
```sh | ||
kubectl port-forward staging-db-0 5432:5432 | ||
``` | ||
|
||
Check results: | ||
|
||
http://localhost/api/0.6/map?bbox=-77.09529161453248,-12.071898885565846,-77.077374458313,-12.066474684936727 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# default document-root | ||
server.document-root = "/openstreetmap/cgimap/" | ||
|
||
# TCP port | ||
server.port = 80 | ||
|
||
server.reject-expect-100-with-417 = "disable" | ||
|
||
# selecting modules | ||
server.modules = ( "mod_access", "mod_rewrite", "mod_fastcgi", "mod_proxy", "mod_alias" ) | ||
|
||
# handling unknown routes | ||
server.error-handler-404 = "/dispatch.map" | ||
|
||
# include, relative to dirname of main config file | ||
#include "mime.types.conf" | ||
|
||
# read configuration from output of a command | ||
#include_shell "/usr/local/bin/confmimetype /etc/mime.types" | ||
mimetype.assign = ( | ||
".html" => "text/html", | ||
".txt" => "text/plain", | ||
".jpg" => "image/jpeg", | ||
".png" => "image/png" | ||
) | ||
|
||
#debug.log-request-handling = "enable" | ||
|
||
$HTTP["request-method"] == "GET" { | ||
url.rewrite-once = ( | ||
"^/api/0\.6/map(\.(json|xml))?(\?(.*))?$" => "/dispatch.map", | ||
"^/api/0\.6/(node|way|relation)/[[:digit:]]+(\.(json|xml))?$" => "/dispatch.map", | ||
"^/api/0\.6/(node|way|relation)/[[:digit:]]+/history.*$" => "/dispatch.map", | ||
"^/api/0\.6/(node|way|relation)/[[:digit:]]+/[[:digit:]]+.*$" => "/dispatch.map", | ||
"^/api/0\.6/(node|way|relation)/[[:digit:]]+/relations$" => "/dispatch.map", | ||
"^/api/0\.6/node/[[:digit:]]+/ways$" => "/dispatch.map", | ||
"^/api/0\.6/(way|relation)/[[:digit:]]+/full$" => "/dispatch.map", | ||
"^/api/0\.6/changeset/[[:digit:]]+.*$" => "/dispatch.map", | ||
"^/api/0\.6/(nodes|ways|relations)(\?(.*))?$" => "/dispatch.map", | ||
"^/api/0\.6/changeset/[[:digit:]]+/download$" => "/dispatch.map", | ||
) | ||
} | ||
|
||
$HTTP["request-method"] == "POST" { | ||
url.rewrite-once = ( | ||
"^/api/0\.6/changeset/[[:digit:]]+/upload.*$" => "/dispatch.map", | ||
) | ||
} | ||
|
||
$HTTP["request-method"] == "PUT" { | ||
url.rewrite-once = ( | ||
"^/api/0\.6/changeset/[[:digit:]]+/close.*$" => "/dispatch.map", | ||
"^/api/0\.6/changeset/[[:digit:]]+$" => "/dispatch.map", | ||
"^/api/0\.6/changeset/create.*$" => "/dispatch.map", | ||
) | ||
} | ||
|
||
$HTTP["url"] =~ "^/(?!(dispatch\.map))" { | ||
proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => "3000" ) ) ) | ||
} | ||
|
||
fastcgi.debug = 1 | ||
|
||
fastcgi.server = ( ".map" => | ||
(( "host" => "127.0.0.1", | ||
"port" => 8000, | ||
"check-local" => "disable", | ||
)) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
/usr/sbin/lighttpd -f lighttpd.conf | ||
|
||
/usr/local/bin/openstreetmap-cgimap \ | ||
--port=8000 \ | ||
--instances=30 \ | ||
--dbname=$POSTGRES_DB \ | ||
--host=$POSTGRES_HOST \ | ||
--username=$POSTGRES_USER \ | ||
--password=$POSTGRES_PASSWORD | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters