From e804bd65dd59686005ec29b47231f44cf6b9edd9 Mon Sep 17 00:00:00 2001 From: Wille Marcel Date: Thu, 12 Oct 2023 18:46:10 -0300 Subject: [PATCH] Build osmcha to ohm config + add env vars --- envs/.env.osmcha.example | 11 ++++++++--- images/osmcha-web/Dockerfile | 9 +++++++++ images/osmcha-web/start.sh | 1 - 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/envs/.env.osmcha.example b/envs/.env.osmcha.example index 53740d6a..7c3d265c 100644 --- a/envs/.env.osmcha.example +++ b/envs/.env.osmcha.example @@ -9,11 +9,16 @@ OAUTH_OSM_SECRET=xya DJANGO_ANON_USER_THROTTLE_RATE=30/min DJANGO_COMMON_USER_THROTTLE_RATE=180/min DJANGO_NON_STAFF_USER_THROTTLE_RATE=3/min -OAUTH_REDIRECT_URI=http://localhost:8000/oauth-landing.html -OSMCHA_FRONTEND_VERSION=oh-pages +OSMCHA_URL=public-url +OAUTH_REDIRECT_URI=$OSMCHA_URL/oauth-landing.html DJANGO_ENABLE_CHANGESET_COMMENTS=False DJANGO_OSM_COMMENTS_API_KEY="" DJANGO_ROOT=/app DJANGO_SETTINGS_MODULE=config.settings.local C_FORCE_ROOT=True -OSMCHA_FRONTEND_VERSION=v0.86.0-production \ No newline at end of file +REACT_APP_OSM_URL=https://www.openhistoricalmap.org +REACT_APP_OSM_API=https://www.openhistoricalmap.org/api/0.6 +REACT_APP_OVERPASS_BASE=https://overpass-api.openhistoricalmap.org/api/interpreter +REACT_APP_NOMINATIM_URL=https://www.openhistoricalmap.org/geocoder/search_osm_nominatim +REACT_APP_PRODUCTION_API_URL=$OSMCHA_URL/api/v1 +REACT_APP_MAPBOX_ACCESS_TOKEN='' diff --git a/images/osmcha-web/Dockerfile b/images/osmcha-web/Dockerfile index ba519d8e..871f1c17 100644 --- a/images/osmcha-web/Dockerfile +++ b/images/osmcha-web/Dockerfile @@ -30,6 +30,15 @@ RUN pip3 install git+https://github.com/OpenHistoricalMap/social-core.git@master RUN pip3 install -U requests RUN pip3 install certifi RUN pip3 install django-extensions +# Clone and build the frontend +RUN git clone git@github.com:mapbox/osmcha-frontend.git +WORKDIR /app/osmcha-frontend +RUN yarn +RUN REACT_APP_VERSION=ohm REACT_APP_STACK=PRODUCTION PUBLIC_URL=$OSMCHA_URL npx react-scripts build +RUN cp -R ./build/*.html ../osmchadjango/frontend/templates/frontend/ +RUN cp ./build/* ../osmchadjango/static/ +RUN cp -R ./build/static/* ../osmcha-django/osmchadjango/static + ADD . /app RUN echo "alias python=python3" >> ~/.bashrc diff --git a/images/osmcha-web/start.sh b/images/osmcha-web/start.sh index 7f53a0bc..9eefc10c 100755 --- a/images/osmcha-web/start.sh +++ b/images/osmcha-web/start.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash set -e -python3 manage.py update_frontend python3 manage.py collectstatic --noinput python3 manage.py migrate python3 manage.py runserver 0.0.0.0:8000