From da8dfe91962bb9b4e208378d1a9ee8a2d7c34205 Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Fri, 19 Jun 2026 21:33:30 +0000 Subject: [PATCH] Adds umap app. --- umap/app.yaml | 5 ++ umap/versions/3/README.md | 39 +++++++++++++ umap/versions/3/db-init-job.yaml | 61 ++++++++++++++++++++ umap/versions/3/deployment.yaml | 92 ++++++++++++++++++++++++++++++ umap/versions/3/ingress.yaml | 26 +++++++++ umap/versions/3/kustomization.yaml | 16 ++++++ umap/versions/3/manifest.yaml | 21 +++++++ umap/versions/3/namespace.yaml | 4 ++ umap/versions/3/pvc.yaml | 11 ++++ umap/versions/3/service.yaml | 13 +++++ 10 files changed, 288 insertions(+) create mode 100644 umap/app.yaml create mode 100644 umap/versions/3/README.md create mode 100644 umap/versions/3/db-init-job.yaml create mode 100644 umap/versions/3/deployment.yaml create mode 100644 umap/versions/3/ingress.yaml create mode 100644 umap/versions/3/kustomization.yaml create mode 100644 umap/versions/3/manifest.yaml create mode 100644 umap/versions/3/namespace.yaml create mode 100644 umap/versions/3/pvc.yaml create mode 100644 umap/versions/3/service.yaml diff --git a/umap/app.yaml b/umap/app.yaml new file mode 100644 index 0000000..beebb37 --- /dev/null +++ b/umap/app.yaml @@ -0,0 +1,5 @@ +name: umap +is: umap +description: uMap is a self-hosted mapping tool that lets you create and share custom maps using OpenStreetMap data. Built with Django and Leaflet. +icon: https://raw.githubusercontent.com/umap-project/umap/master/umap/static/umap/img/logo.svg +latest: "3" diff --git a/umap/versions/3/README.md b/umap/versions/3/README.md new file mode 100644 index 0000000..27ad0a6 --- /dev/null +++ b/umap/versions/3/README.md @@ -0,0 +1,39 @@ +# uMap + +uMap is a tool for creating and sharing custom maps using OpenStreetMap as the base layer. + +## Dependencies + +- **PostgreSQL** (with PostGIS extension) - Database for storing maps and geographic data + +## Configuration + +Key settings in `config.yaml`: + +- **domain** - Where uMap will be accessible +- **storage** - Persistent volume size (default: `2Gi`) +- **db.name** - Database name (default: `umap`) + +## First-Time Setup + +1. Add and deploy the app: + ```bash + wild app add umap + wild app deploy umap + ``` + +2. Create a superuser account: + ```bash + kubectl exec -n umap deploy/umap -- umap createsuperuser + ``` + +3. Log in at `/en/login/` with the credentials you just created. + +4. Create maps by clicking **Create a map** on the homepage — no account is required for anonymous map creation by default. + +## Notes + +- uMap uses PostGIS for geographic queries — the db-init job installs the PostGIS extension automatically +- The Django `secretKey` is auto-generated in `secrets.yaml` +- Maps can be made public, unlisted, or private +- The admin panel is at `/admin/` for managing users and content diff --git a/umap/versions/3/db-init-job.yaml b/umap/versions/3/db-init-job.yaml new file mode 100644 index 0000000..8849971 --- /dev/null +++ b/umap/versions/3/db-init-job.yaml @@ -0,0 +1,61 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: umap-db-init + namespace: {{ .namespace }} + labels: + component: db-init +spec: + template: + metadata: + labels: + component: db-init + spec: + restartPolicy: OnFailure + securityContext: + runAsNonRoot: true + runAsUser: 999 + runAsGroup: 999 + seccompProfile: + type: RuntimeDefault + containers: + - name: postgres-init + image: postgres:15 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: false + env: + - name: PGHOST + value: {{ .db.host }} + - name: PGUSER + value: postgres + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: umap-secrets + key: postgres.password + - name: DB_NAME + value: {{ .db.name }} + - name: DB_USER + value: {{ .db.user }} + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: umap-secrets + key: dbPassword + command: + - /bin/bash + - -c + - | + set -e + until pg_isready; do sleep 2; done + psql -c "CREATE DATABASE ${DB_NAME};" || echo "Database already exists" + psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" || echo "User already exists" + psql -c "ALTER USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" + psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};" + psql -d ${DB_NAME} -c "GRANT ALL ON SCHEMA public TO ${DB_USER};" + psql -d ${DB_NAME} -c "CREATE EXTENSION IF NOT EXISTS postgis;" || echo "PostGIS extension not available - uMap requires PostGIS on the PostgreSQL server" + echo "Done" diff --git a/umap/versions/3/deployment.yaml b/umap/versions/3/deployment.yaml new file mode 100644 index 0000000..8d85355 --- /dev/null +++ b/umap/versions/3/deployment.yaml @@ -0,0 +1,92 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: umap + namespace: {{ .namespace }} +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + component: web + template: + metadata: + labels: + component: web + spec: + securityContext: + seccompProfile: + type: RuntimeDefault + containers: + - name: umap + image: umap/umap:3.7.3 + ports: + - name: http + containerPort: 8000 + protocol: TCP + env: + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: umap-secrets + key: databaseUrl + - name: SECRET_KEY + valueFrom: + secretKeyRef: + name: umap-secrets + key: secretKey + - name: SITE_URL + value: https://{{ .domain }} + - name: STATIC_ROOT + value: /srv/umap/static + - name: MEDIA_ROOT + value: /srv/umap/uploads + - name: ALLOWED_HOSTS + value: "{{ .domain }}" + - name: CSRF_TRUSTED_ORIGINS + value: "https://{{ .domain }}" + resources: + limits: + cpu: 1000m + ephemeral-storage: 1Gi + memory: 512Mi + requests: + cpu: 50m + ephemeral-storage: 50Mi + memory: 256Mi + volumeMounts: + - name: umap-uploads + mountPath: /srv/umap/uploads + livenessProbe: + httpGet: + path: / + port: 8000 + httpHeaders: + - name: Host + value: "{{ .domain }}" + initialDelaySeconds: 60 + timeoutSeconds: 5 + periodSeconds: 15 + failureThreshold: 6 + readinessProbe: + httpGet: + path: / + port: 8000 + httpHeaders: + - name: Host + value: "{{ .domain }}" + initialDelaySeconds: 30 + timeoutSeconds: 3 + periodSeconds: 10 + failureThreshold: 3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + volumes: + - name: umap-uploads + persistentVolumeClaim: + claimName: umap-uploads + restartPolicy: Always diff --git a/umap/versions/3/ingress.yaml b/umap/versions/3/ingress.yaml new file mode 100644 index 0000000..2bfa4ea --- /dev/null +++ b/umap/versions/3/ingress.yaml @@ -0,0 +1,26 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: umap + namespace: {{ .namespace }} + annotations: + external-dns.alpha.kubernetes.io/target: {{ .externalDnsDomain }} + external-dns.alpha.kubernetes.io/cloudflare-proxied: "false" + external-dns.alpha.kubernetes.io/ttl: "60" +spec: + ingressClassName: traefik + rules: + - host: {{ .domain }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: umap + port: + number: 80 + tls: + - hosts: + - {{ .domain }} + secretName: {{ .tlsSecretName }} diff --git a/umap/versions/3/kustomization.yaml b/umap/versions/3/kustomization.yaml new file mode 100644 index 0000000..771dd04 --- /dev/null +++ b/umap/versions/3/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: {{ .namespace }} +labels: + - includeSelectors: true + pairs: + app: umap + managedBy: kustomize + partOf: wild-cloud +resources: + - namespace.yaml + - db-init-job.yaml + - deployment.yaml + - service.yaml + - ingress.yaml + - pvc.yaml diff --git a/umap/versions/3/manifest.yaml b/umap/versions/3/manifest.yaml new file mode 100644 index 0000000..5853166 --- /dev/null +++ b/umap/versions/3/manifest.yaml @@ -0,0 +1,21 @@ +version: 3.7.3-1 +requires: + - name: postgres +defaultConfig: + namespace: umap + externalDnsDomain: '{{ .cloud.domain }}' + domain: umap.{{ .cloud.domain }} + tlsSecretName: wildcard-wild-cloud-tls + storage: 2Gi + db: + host: '{{ .apps.postgres.host }}' + port: '{{ .apps.postgres.port }}' + name: umap + user: umap +defaultSecrets: + - key: dbPassword + - key: secretKey + - key: databaseUrl + default: 'postgis://{{ .app.db.user }}:{{ .secrets.dbPassword }}@{{ .app.db.host }}:{{ .app.db.port }}/{{ .app.db.name }}' +requiredSecrets: + - postgres.password diff --git a/umap/versions/3/namespace.yaml b/umap/versions/3/namespace.yaml new file mode 100644 index 0000000..054927e --- /dev/null +++ b/umap/versions/3/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .namespace }} diff --git a/umap/versions/3/pvc.yaml b/umap/versions/3/pvc.yaml new file mode 100644 index 0000000..829e72f --- /dev/null +++ b/umap/versions/3/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: umap-uploads + namespace: {{ .namespace }} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .storage }} diff --git a/umap/versions/3/service.yaml b/umap/versions/3/service.yaml new file mode 100644 index 0000000..7806b1e --- /dev/null +++ b/umap/versions/3/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: umap + namespace: {{ .namespace }} +spec: + selector: + component: web + ports: + - name: http + port: 80 + targetPort: 8000 + protocol: TCP