-
Notifications
You must be signed in to change notification settings - Fork 36
CGIMAP container #300
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
Merged
CGIMAP container #300
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
29f1164
Add cgmap container
e0f2388
Correct the misspelled name
a798afd
Add helm template for cgimap
d38f22c
Merge from develop
Rub21 9a90c8a
Update cgimap dockerfile
Rub21 60810bf
Merge branch 'develop' into cgmap
Rub21 951463d
Update tiler-imposm dockerfile
Rub21 36a3ae6
Update python
Rub21 057b8a2
Update cgimap container
Rub21 26c3a80
Update cgimap container
Rub21 c380960
Merge from develop
Rub21 905e88e
Update container for cgimap
Rub21 fe68c7e
Build cgimap image using multistage
Rub21 9630297
Update cgimap config
Rub21 89acb3b
Update release tags
Rub21 7d9409d
Add memcache server for cgimap
Rub21 a7c9418
Update cgimap start and github action
Rub21 1095b85
Add --daemon for cgimap
Rub21 8dac9a7
Set empty values for planetFiles.image
Rub21 2e179bd
Disable cgimap in chartpress
Rub21 42798ed
Use chartpress==2.3.0
Rub21 6549d9c
Add HorizontalPodAutoscaler for cgimap
Rub21 deadff6
Update web-api container
Rub21 347cec4
Fix apache config
Rub21 770ca83
Add PG password for tiler-db config as env var
Rub21 943eb10
Update cgimap dockerfile using code form original repo
Rub21 31aa902
Enable resources option for requests and limits - cgimap
Rub21 15e362a
Evaluate memoryUtilization for web container - autoscaling
Rub21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -48,4 +48,5 @@ charts: | |
valuesPath: osmchaDb.image | ||
planet-files: | ||
valuesPath: planetFiles.image | ||
|
||
cgimap: | ||
valuesPath: cgimap.image |
This file contains hidden or 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,18 @@ | ||
version: '3' | ||
services: | ||
# ##################################################### | ||
# ## cgmap section | ||
# ##################################################### | ||
cgimap: | ||
image: osmseed-cgimap:v1 | ||
build: | ||
context: ../images/cgimap | ||
dockerfile: Dockerfile | ||
ports: | ||
- '80:80' | ||
volumes: | ||
- ../data/cgimap-data:/apps/data/ | ||
# command: > | ||
# /bin/bash -c " ./start.sh" | ||
env_file: | ||
- ../envs/.env.db |
This file contains hidden or 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 gettext-base && \ | ||
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.template / | ||
CMD /start.sh |
This file contains hidden or 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/cgimap.yml build | ||
docker compose -f compose/cgimap.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 hidden or 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" => "${API_WEB_HOST}", "port" => "${API_WEB_PORT}" ) ) ) | ||
} | ||
|
||
fastcgi.debug = 1 | ||
|
||
fastcgi.server = ( ".map" => | ||
(( "host" => "127.0.0.1", | ||
"port" => 8000, | ||
"check-local" => "disable", | ||
)) | ||
) | ||
|
This file contains hidden or 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,17 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# Make sure that the follow env vars has been declare | ||
# API_WEB_HOST | ||
# API_WEB_PORT | ||
envsubst < lighttpd.conf.template > lighttpd.conf | ||
/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 hidden or 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,64 @@ | ||
{{- if .Values.cgimap.enabled -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "osm-seed.fullname" . }}-cgimap | ||
labels: | ||
app: {{ template "osm-seed.name" . }} | ||
component: cgimap-deployment | ||
environment: {{ .Values.environment }} | ||
release: {{ .Release.Name }} | ||
spec: | ||
replicas: {{ .Values.cgimap.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: {{ template "osm-seed.name" . }} | ||
release: {{ .Release.Name }} | ||
run: {{ .Release.Name }}-cgimap | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "osm-seed.name" . }} | ||
release: {{ .Release.Name }} | ||
run: {{ .Release.Name }}-cgimap | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }}-cgimap | ||
image: "{{ .Values.cgimap.image.name }}:{{ .Values.cgimap.image.tag }}" | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 80 | ||
initialDelaySeconds: 600 # 10 min, because the compile process takes time. | ||
timeoutSeconds: 30 | ||
{{- if .Values.cgimap.resources.enabled }} | ||
resources: | ||
requests: | ||
memory: {{ .Values.cgimap.resources.requests.memory }} | ||
cpu: {{ .Values.cgimap.resources.requests.cpu }} | ||
limits: | ||
memory: {{ .Values.cgimap.resources.limits.memory }} | ||
cpu: {{ .Values.cgimap.resources.limits.cpu }} | ||
{{- end }} | ||
env: | ||
- name: POSTGRES_HOST | ||
value: {{ .Release.Name }}-db | ||
- name: POSTGRES_DB | ||
value: {{ .Values.db.env.POSTGRES_DB }} | ||
- name: POSTGRES_PASSWORD | ||
value: {{ quote .Values.db.env.POSTGRES_PASSWORD }} | ||
- name: POSTGRES_USER | ||
value: {{ .Values.db.env.POSTGRES_USER }} | ||
- name: API_WEB_HOST | ||
value: {{ .Release.Name }}-web | ||
- name: API_WEB_PORT | ||
value: 80 | ||
{{- if .Values.cgimap.nodeSelector.enabled }} | ||
nodeSelector: | ||
{{ .Values.cgimap.nodeSelector.label_key }} : {{ .Values.cgimap.nodeSelector.label_value }} | ||
{{- end }} | ||
{{- end }} |
This file contains hidden or 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,26 @@ | ||
{{- if and .Values.cgimap.enabled (eq .Values.serviceType "ClusterIP") }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ template "osm-seed.fullname" . }}-ingress-cgimap-api | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
cert-manager.io/cluster-issuer: letsencrypt-prod-issuer | ||
spec: | ||
tls: | ||
- hosts: | ||
- cgimap.{{ .Values.domain }} | ||
secretName: {{ template "osm-seed.fullname" . }}-secret-cgimap | ||
|
||
rules: | ||
- host: cgimap.{{ .Values.domain }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: {{ template "osm-seed.fullname" . }}-cgimap | ||
port: | ||
number: 80 | ||
{{- end }} |
This file contains hidden or 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,43 @@ | ||
{{- if .Values.cgimap.enabled -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "osm-seed.fullname" . }}-cgimap | ||
labels: | ||
app: {{ template "osm-seed.name" . }} | ||
component: cgimap-service | ||
environment: {{ .Values.environment }} | ||
release: {{ .Release.Name }} | ||
annotations: | ||
{{- if and (eq .Values.serviceType "LoadBalancer") .Values.AWS_SSL_ARN }} | ||
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ .Values.AWS_SSL_ARN }} | ||
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http | ||
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: https | ||
{{- end }} | ||
{{- if eq .Values.serviceType "ClusterIP" }} | ||
kubernetes.io/ingress.class: nginx | ||
cert-manager.io/cluster-issuer: letsencrypt-prod-issuer | ||
{{- else }} | ||
fake.annotation: fake | ||
{{- end }} | ||
{{- with .Values.cgimap.serviceAnnotations }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
type: {{ .Values.serviceType }} | ||
ports: | ||
- port: 80 | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
{{- if and (eq .Values.serviceType "LoadBalancer") .Values.AWS_SSL_ARN }} | ||
- port: 443 | ||
targetPort: http | ||
protocol: TCP | ||
name: https | ||
{{- end }} | ||
selector: | ||
app: {{ template "osm-seed.name" . }} | ||
release: {{ .Release.Name }} | ||
run: {{ .Release.Name }}-cgimap | ||
{{- end }} |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.