From 0b94463266850c7552f5c0cc0fd86d0c5d8e812d Mon Sep 17 00:00:00 2001 From: Varun Date: Thu, 14 Sep 2023 13:59:08 +0545 Subject: [PATCH] feat: removed fmtm_map micro frontend from docker and github actions removed fmtm_map micro frontend from docker and github actions --- .env.example | 1 - .github/workflows/build_and_deploy.yml | 18 -------------- .github/workflows/reusable/pytest.yml | 1 - INSTALL.md | 1 - docker-compose.deploy.yml | 33 -------------------------- docker-compose.noodk.yml | 4 ---- docker-compose.yml | 28 ---------------------- docs/dev/Production.md | 1 - docs/dev/Setup.md | 1 - docs/dev/Troubleshooting.md | 2 +- gen-env.sh | 23 ------------------ src/backend/app/config.py | 5 +--- src/frontend/debug.dockerfile | 2 -- src/frontend/main/src/environment.ts | 1 - src/frontend/main/webpack.config.js | 2 +- src/frontend/prod.dockerfile | 3 --- 16 files changed, 3 insertions(+), 123 deletions(-) diff --git a/.env.example b/.env.example index 540fe6af62..e8fcdce65d 100644 --- a/.env.example +++ b/.env.example @@ -13,7 +13,6 @@ ODK_CENTRAL_PASSWD=fmtm URL_SCHEME=http API_URL=127.0.0.1:8000 FRONTEND_MAIN_URL=127.0.0.1:8080 -FRONTEND_MAP_URL=127.0.0.1:8081 # API_PREFIX=/api ### OSM ### diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 0dd127b61c..2bdfb79533 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -51,7 +51,6 @@ jobs: run: | cd src/frontend echo "FRONTEND_MAIN_VERSION=$(jq -r '.version' main/package.json)" >> $GITHUB_ENV - echo "FRONTEND_MAP_VERSION=$(jq -r '.version' fmtm_openlayer_map/package.json)" >> $GITHUB_ENV - name: Build and push backend uses: docker/build-push-action@v4 @@ -77,21 +76,6 @@ jobs: APP_VERSION=${{ env.FRONTEND_MAIN_VERSION }} API_URL=${{ env.URL_SCHEME }}://${{ env.API_URL }} FRONTEND_MAIN_URL=${{ env.URL_SCHEME }}://${{ env.FRONTEND_MAIN_URL }} - FRONTEND_MAP_URL=${{ env.URL_SCHEME }}://${{ env.FRONTEND_MAP_URL }} - - - name: Build and push frontend map - uses: docker/build-push-action@v4 - with: - context: src/frontend - file: src/frontend/prod.dockerfile - push: true - tags: "ghcr.io/hotosm/fmtm/frontend/map:${{ env.FRONTEND_MAP_VERSION }}-${{ github.ref_name }}" - build-args: | - APP_NAME=fmtm_openlayer_map - APP_VERSION=${{ env.FRONTEND_MAP_VERSION }} - API_URL=${{ env.URL_SCHEME }}://${{ env.API_URL }} - FRONTEND_MAIN_URL=${{ env.URL_SCHEME }}://${{ env.FRONTEND_MAIN_URL }} - FRONTEND_MAP_URL=${{ env.URL_SCHEME }}://${{ env.FRONTEND_MAP_URL }} deploy-containers: runs-on: ubuntu-latest @@ -114,14 +98,12 @@ jobs: run: | cd src/frontend echo "FRONTEND_MAIN_VERSION=$(jq -r '.version' main/package.json)" >> $GITHUB_OUTPUT - echo "FRONTEND_MAP_VERSION=$(jq -r '.version' fmtm_openlayer_map/package.json)" >> $GITHUB_OUTPUT - name: Environment to .env run: | echo "${{ secrets.DOTENV }}" > .env echo "API_VERSION=${{ steps.extract_api_version.outputs.API_VERSION }}" >> .env echo "FRONTEND_MAIN_VERSION=${{ steps.extract_frontend_versions.outputs.FRONTEND_MAIN_VERSION }}" >> .env - echo "FRONTEND_MAP_VERSION=${{ steps.extract_frontend_versions.outputs.FRONTEND_MAP_VERSION }}" >> .env - uses: webfactory/ssh-agent@v0.7.0 with: diff --git a/.github/workflows/reusable/pytest.yml b/.github/workflows/reusable/pytest.yml index 136aef25cf..ddc9276005 100644 --- a/.github/workflows/reusable/pytest.yml +++ b/.github/workflows/reusable/pytest.yml @@ -24,7 +24,6 @@ jobs: OSM_CLIENT_SECRET: ${{ vars.OSM_CLIENT_SECRET }} OSM_SECRET_KEY: ${{ vars.OSM_SECRET_KEY }} FRONTEND_MAIN_URL: ${{ vars.FRONTEND_MAIN_URL }} - FRONTEND_MAP_URL: ${{ vars.FRONTEND_MAP_URL }} options: --user root services: diff --git a/INSTALL.md b/INSTALL.md index 60061f4d68..d460db39f2 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -91,7 +91,6 @@ ODK_CENTRAL_PASSWD=`` URL_SCHEME=http API_URL=127.0.0.1:8000 FRONTEND_MAIN_URL=localhost:8080 -FRONTEND_MAP_URL=localhost:8081 # API_PREFIX=/api ### OSM ### diff --git a/docker-compose.deploy.yml b/docker-compose.deploy.yml index de2a27d1fc..5085516a59 100644 --- a/docker-compose.deploy.yml +++ b/docker-compose.deploy.yml @@ -115,7 +115,6 @@ services: APP_VERSION: ${FRONTEND_MAIN_VERSION} API_URL: ${URL_SCHEME}://${API_URL} FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL} - FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL} container_name: fmtm_main depends_on: - api @@ -126,7 +125,6 @@ services: - BROTLI=true - API_URL=${URL_SCHEME}://${API_URL} - FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL} - - FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL} restart: unless-stopped labels: - "traefik.enable=true" @@ -135,34 +133,3 @@ services: - "traefik.http.routers.ui-main.rule=Host(`${FRONTEND_MAIN_URL}`)" - "traefik.http.services.ui-main-svc.loadbalancer.server.port=8080" - "traefik.http.routers.ui-main.service=ui-main-svc" - - ui-map: - image: "ghcr.io/hotosm/fmtm/frontend/map:${FRONTEND_MAP_VERSION}-${GIT_BRANCH}" - build: - context: src/frontend - dockerfile: prod.dockerfile - args: - APP_NAME: fmtm_openlayer_map - APP_VERSION: ${FRONTEND_MAP_VERSION} - API_URL: ${URL_SCHEME}://${API_URL} - FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL} - FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL} - container_name: fmtm_map - depends_on: - - api - - traefik - networks: - - fmtm-net - environment: - - BROTLI=true - - API_URL=${URL_SCHEME}://${API_URL} - - FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL} - - FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL} - restart: unless-stopped - labels: - - "traefik.enable=true" - - "traefik.http.routers.ui-map.tls=true" - - "traefik.http.routers.ui-map.tls.certresolver=letsencrypt" - - "traefik.http.routers.ui-map.rule=Host(`${FRONTEND_MAP_URL}`)" - - "traefik.http.services.ui-map-svc.loadbalancer.server.port=8080" - - "traefik.http.routers.ui-map.service=ui-map-svc" diff --git a/docker-compose.noodk.yml b/docker-compose.noodk.yml index 562f9b0a08..88ac3fa3ed 100644 --- a/docker-compose.noodk.yml +++ b/docker-compose.noodk.yml @@ -76,7 +76,6 @@ services: APP_NAME: main API_URL: ${URL_SCHEME}://${API_URL} FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL} - FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL} container_name: fmtm_main depends_on: - api @@ -86,7 +85,6 @@ services: environment: - API_URL=${URL_SCHEME}://${API_URL} - FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL} - - FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL} ports: - "8081:8081" networks: @@ -102,7 +100,6 @@ services: APP_NAME: fmtm_openlayer_map API_URL: ${URL_SCHEME}://${API_URL} FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL} - FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL} container_name: fmtm_map depends_on: - api @@ -112,7 +109,6 @@ services: environment: - API_URL=${URL_SCHEME}://${API_URL} - FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL} - - FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL} ports: - "8082:8082" networks: diff --git a/docker-compose.yml b/docker-compose.yml index 87ed015feb..de851d2e8d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -83,7 +83,6 @@ services: APP_NAME: main API_URL: ${URL_SCHEME}://${API_URL} FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL} - FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL} container_name: fmtm_main depends_on: - api @@ -93,39 +92,12 @@ services: environment: - API_URL=${URL_SCHEME}://${API_URL} - FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL} - - FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL} ports: - "8080:8080" networks: - fmtm-dev restart: unless-stopped - ui-map: - image: "ghcr.io/hotosm/fmtm/frontend/map:debug" - build: - context: src/frontend - dockerfile: debug.dockerfile - args: - APP_NAME: fmtm_openlayer_map - API_URL: ${URL_SCHEME}://${API_URL} - FRONTEND_MAIN_URL: ${URL_SCHEME}://${FRONTEND_MAIN_URL} - FRONTEND_MAP_URL: ${URL_SCHEME}://${FRONTEND_MAP_URL} - container_name: fmtm_map - depends_on: - - api - volumes: - - ./src/frontend/fmtm_openlayer_map:/app - - /app/node_modules/ - environment: - - API_URL=${URL_SCHEME}://${API_URL} - - FRONTEND_MAIN_URL=${URL_SCHEME}://${FRONTEND_MAIN_URL} - - FRONTEND_MAP_URL=${URL_SCHEME}://${FRONTEND_MAP_URL} - ports: - - "8081:8081" - networks: - - fmtm-dev - restart: unless-stopped - central-db: image: "postgis/postgis:14-3.3-alpine" container_name: central_db diff --git a/docs/dev/Production.md b/docs/dev/Production.md index 9b0667e4ab..6fdf307019 100644 --- a/docs/dev/Production.md +++ b/docs/dev/Production.md @@ -60,7 +60,6 @@ that file to contain the needful (it should look like this): # FMTM API_URL=https://fmtm-api.hotosm.org FRONTEND_MAIN_URL=https://fmtm.hotosm.org - FRONTEND_MAP_URL=https://map.fmtm.hotosm.org # API_PREFIX=/api # OSM diff --git a/docs/dev/Setup.md b/docs/dev/Setup.md index 1cf3459cda..533057b55d 100644 --- a/docs/dev/Setup.md +++ b/docs/dev/Setup.md @@ -270,7 +270,6 @@ ODK_CENTRAL_PASSWD=`` URL_SCHEME=http API_URL=127.0.0.1:8000 FRONTEND_MAIN_URL=localhost:8080 -FRONTEND_MAP_URL=localhost:8081 # API_PREFIX=/api ### OSM ### diff --git a/docs/dev/Troubleshooting.md b/docs/dev/Troubleshooting.md index 65d5f54eb4..c257922f54 100644 --- a/docs/dev/Troubleshooting.md +++ b/docs/dev/Troubleshooting.md @@ -42,7 +42,7 @@ If you would rather not do this, an alternative can be to feed them into the pdm command: ```bash -FRONTEND_MAIN_URL="" FRONTEND_MAP_URL="" \ +FRONTEND_MAIN_URL="" \ OSM_CLIENT_ID="" OSM_CLIENT_SECRET="" OSM_SECRET_KEY="" \ pdm run uvicorn app.main:api --host 0.0.0.0 --port 8000 ``` diff --git a/gen-env.sh b/gen-env.sh index a6462d7675..04f64a4eb2 100644 --- a/gen-env.sh +++ b/gen-env.sh @@ -165,28 +165,6 @@ do fi done -# FRONTEND MAP -echo -echo "Enter the FMTM Map Frontend URL." -echo "If you have a valid domain name, enter it here." -while true -do - read -e -p "Enter d for default 127.0.0.1:8080, else your IP/domain: " frontend_map_url - - if [ "$frontend_map_url" != "d" ] - then - echo "Using $FRONTEND_MAP_URL" - break - elif [ "$api_url" = "" ] - then - echo "Invalid input!" - else - echo "Using $FRONTEND_MAP_URL" - FRONTEND_MAP_URL="frontend_map_url" - break - fi -done - echo echo "Please enter your OSM authentication details" read -e -p "Client ID: " OSM_CLIENT_ID @@ -226,7 +204,6 @@ echo "### FMTM ###" echo "URL_SCHEME=${URL_SCHEME}" >> "${DOTENV_NAME}" echo "API_URL=${API_URL}" >> "${DOTENV_NAME}" echo "FRONTEND_MAIN_URL=${FRONTEND_MAIN_URL}" >> "${DOTENV_NAME}" -echo "FRONTEND_MAP_URL=${FRONTEND_MAP_URL}" >> "${DOTENV_NAME}" echo "### OSM ###" echo "OSM_CLIENT_ID=${OSM_CLIENT_ID}" >> "${DOTENV_NAME}" diff --git a/src/backend/app/config.py b/src/backend/app/config.py index daa77dc272..4d89116e15 100644 --- a/src/backend/app/config.py +++ b/src/backend/app/config.py @@ -33,7 +33,6 @@ class Settings(BaseSettings): URL_SCHEME: Optional[str] = "http" FRONTEND_MAIN_URL: Optional[str] - FRONTEND_MAP_URL: Optional[str] EXTRA_CORS_ORIGINS: Optional[Union[str, list[str]]] = [] @@ -54,11 +53,9 @@ def assemble_cors_origins( # Build default origins from env vars url_scheme = info.data.get("URL_SCHEME") main_url = info.data.get("FRONTEND_MAIN_URL") - map_url = info.data.get("FRONTEND_MAP_URL") - if url_scheme and main_url and map_url: + if url_scheme and main_url: default_origins = [ f"{url_scheme}://{main_url}", - f"{url_scheme}://{map_url}", ] if val is None: diff --git a/src/frontend/debug.dockerfile b/src/frontend/debug.dockerfile index 1c970eec60..dda364d8b5 100755 --- a/src/frontend/debug.dockerfile +++ b/src/frontend/debug.dockerfile @@ -4,8 +4,6 @@ ARG API_URL ENV API_URL="${API_URL}" ARG FRONTEND_MAIN_URL ENV FRONTEND_MAIN_URL="${FRONTEND_MAIN_URL}" -ARG FRONTEND_MAP_URL -ENV FRONTEND_MAP_URL="${FRONTEND_MAP_URL}" WORKDIR /app COPY ./${APP_NAME}/package*.json ./ RUN npm install diff --git a/src/frontend/main/src/environment.ts b/src/frontend/main/src/environment.ts index ecc7b554c6..72b95bf22d 100755 --- a/src/frontend/main/src/environment.ts +++ b/src/frontend/main/src/environment.ts @@ -1,5 +1,4 @@ export default { - main_url: process.env.FRONTEND_MAP_URL, nodeEnv: process.env.NODE_ENV, baseApiUrl: process.env.API_URL, decode: (id: any) => { diff --git a/src/frontend/main/webpack.config.js b/src/frontend/main/webpack.config.js index 916900f005..1f9b0bb6ea 100755 --- a/src/frontend/main/webpack.config.js +++ b/src/frontend/main/webpack.config.js @@ -168,7 +168,7 @@ module.exports = function (webpackEnv) { ), ), - new EnvironmentPlugin(['API_URL', 'FRONTEND_MAIN_URL', 'FRONTEND_MAP_URL']), + new EnvironmentPlugin(['API_URL', 'FRONTEND_MAIN_URL']), ], }; }; diff --git a/src/frontend/prod.dockerfile b/src/frontend/prod.dockerfile index eab9db4f26..02c9b4db78 100644 --- a/src/frontend/prod.dockerfile +++ b/src/frontend/prod.dockerfile @@ -7,15 +7,12 @@ ARG API_URL ENV API_URL="${API_URL}" ARG FRONTEND_MAIN_URL ENV FRONTEND_MAIN_URL="${FRONTEND_MAIN_URL}" -ARG FRONTEND_MAP_URL -ENV FRONTEND_MAP_URL="${FRONTEND_MAP_URL}" LABEL org.hotosm.fmtm.app-name="${APP_NAME}" \ org.hotosm.fmtm.app-version="${APP_VERSION}" \ org.hotosm.fmtm.maintainer="${MAINTAINER}" \ org.hotosm.fmtm.api-url="${API_URL}" \ org.hotosm.fmtm.main-url="${FRONTEND_MAIN_URL}" \ - org.hotosm.fmtm.fmtm_openlayer_map-url="${FRONTEND_MAP_URL}" WORKDIR /app COPY ./${APP_NAME}/package*.json ./