Skip to content

Commit

Permalink
Update osmcha wbe contianer and helm templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Dec 23, 2023
1 parent 700b451 commit 977e9d1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
25 changes: 6 additions & 19 deletions images/osmcha-web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
FROM node:16-slim as builder

ENV DEBIAN_FRONTEND noninteractive

ARG BUILD_ENV=prod

## Necesary env values to deploy
ENV OSMCHA_URL=https://osmcha-staging.openhistoricalmap.org
ENV OSMCHA_API_URL=www.openhistoricalmap.org
ENV REACT_APP_OSM_URL=https://www.openhistoricalmap.org
ENV REACT_APP_OSM_API=https://www.openhistoricalmap.org/api/0.6
ENV REACT_APP_OVERPASS_BASE=//overpass-api.openhistoricalmap.org/api/interpreter

ENV BUILD_ENV=prod
ENV REACT_APP_PRODUCTION_API_URL=/api/v1
RUN apt-get update && apt-get install -y git
RUN mkdir /app
WORKDIR /app
RUN git clone https://github.com/sunu/osmcha-frontend.git /app
RUN find /app -type f -exec sed -i 's/www.openstreetmap.org/www.openhistoricalmap.org/g' {} +
RUN git clone https://github.com/Rub21/osmcha-frontend.git /app
RUN git checkout env/realchangesets
RUN yarn install
ENV REACT_APP_PRODUCTION_API_URL /api/v1
RUN sed -i "s|https://osmcha.org|$OSMCHA_URL|g" package.json
RUN yarn build:${BUILD_ENV}

FROM nginx:alpine
COPY --from=builder /app/build /assets
COPY start.sh .
CMD [ "/app/start.sh" ]
8 changes: 8 additions & 0 deletions images/osmcha-web/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -x
export BUILD_ENV=prod
export REACT_APP_PRODUCTION_API_URL=/api/v1
sed -i "s|https://osmcha.org|$OSMCHA_URL|g" package.json
yarn build:${BUILD_ENV}
find /app/build -type f -exec sed -i "s/www.openstreetmap.org/$OSMCHA_API_URL/g" {} +
cp -r /app/build/* /assets/
10 changes: 8 additions & 2 deletions osm-seed/templates/osmcha-app/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ data:
OAUTH_OSM_SECRET: {{ .Values.osmchaApi.env.OAUTH_OSM_SECRET | quote }}
OAUTH_REDIRECT_URI: {{ .Values.osmchaApi.env.OAUTH_REDIRECT_URI | quote }}
DJANGO_SECURE_SSL_REDIRECT: "False"
OSMCHA_URL: {{ .Values.osmchaApi.env.OSMCHA_URL | quote }}
DJANGO_DEBUG: "False"
DJANGO_ENV: "production"
OSM_SERVER_URL: {{ .Values.osmchaApi.env.OSM_SERVER_URL | quote }}
DJANGO_DEBUG: "False"
DJANGO_ENV: "production"
# OSM_SERVER_URL: {{ .Values.osmchaApi.env.OSM_SERVER_URL | quote }}
REDIS_URL: "redis://{{ .Release.Name }}-osmcha-redis:6379"
OSM_PLANET_BASE_URL: {{ .Values.osmchaApi.env.OSM_PLANET_BASE_URL | quote }}
# frontend
OSMCHA_URL: {{ .Values.osmchaApi.env.OSMCHA_URL | quote }}
OSMCHA_API_URL: {{ .Values.osmchaApi.env.OSMCHA_API_URL | quote }}
REACT_APP_OSM_URL: {{ .Values.osmchaApi.env.REACT_APP_OSM_URL | quote }}
REACT_APP_OSM_API: {{ .Values.osmchaApi.env.REACT_APP_OSM_API | quote }}
REACT_APP_OVERPASS_BASE: {{ .Values.osmchaApi.env.REACT_APP_OVERPASS_BASE | quote }}
REACT_APP_ENABLE_REAL_CHANGESETS: .Values.osmchaApi.env.REACT_APP_ENABLE_REAL_CHANGESETS }}"
REACT_APP_MAPBOX_ACCESS_TOKEN: {{ .Values.osmchaApi.env.REACT_APP_MAPBOX_ACCESS_TOKEN | quote }}
---
apiVersion: v1
kind: ConfigMap
Expand Down
14 changes: 13 additions & 1 deletion osm-seed/templates/osmcha-app/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ spec:
run: {{ .Release.Name }}-osmcha-app
spec:
initContainers:
- name: web-builder
image: "{{ .Values.osmchaWeb.image.name }}:{{ .Values.osmchaWeb.image.tag }}"
envFrom:
- configMapRef:
name: {{ .Release.Name }}-osmcha-common-env
volumeMounts:
- name: nginx-assets
mountPath: /assets
- name: init
image: "{{ .Values.osmchaApi.image.name }}:{{ .Values.osmchaApi.image.tag }}"
command:
Expand Down Expand Up @@ -84,7 +92,7 @@ spec:
{{- end }}

- name: nginx
image: "{{ .Values.osmchaWeb.image.name }}:{{ .Values.osmchaWeb.image.tag }}"
image: "nginx:latest"
ports:
- containerPort: 80
volumeMounts:
Expand All @@ -93,9 +101,13 @@ spec:
readOnly: true
- name: staticfiles
mountPath: /staticfiles
- name: nginx-assets
mountPath: /assets
volumes:
- name: staticfiles
emptyDir: {}
- name: nginx-assets
emptyDir: {}
- name: osmcha-frontend-nginx-config
configMap:
name: {{ .Release.Name }}-osmcha-nginx-config
Expand Down

0 comments on commit 977e9d1

Please sign in to comment.