Skip to content

Commit

Permalink
implemented different API URLs for dev and prod UIs (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsteinig authored Oct 17, 2024
1 parent 862cd57 commit c4aa39b
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/reusable-docker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
exit"
- name: copy compose
run: |
scp deployment/compose.yaml ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }}:/usr/config
scp deployment/compose-${{ inputs.environment }}.yaml ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }}:/usr/config/compose.yaml
- name: activate docker
run: |
ssh ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }} "cd /usr/config && \\
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/reusable-frontend-ui-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and publish UI docker image
on:
workflow_dispatch:
inputs:
environment:
required: true
type: string
jobs:
publish_image:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: checkout
uses: actions/checkout@v4

- name: lowercase the repository name
run: |
echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}"
- name: login
run: |
echo ${{ secrets.GITHUB_TOKEN}} | docker login --username ${{ github.actor }} --password-stdin ghcr.io
- name: build
run: |
cd air-quality-ui
docker build . -t ghcr.io/${REPO}/vairify-frontend-${{ inputs.environment }}:latest \
--build-arg VITE_AIR_QUALITY_API_URL=${{ vars.VAIRIFY_API_URL }} \
--build-arg VITE_AIR_QUALITY_UI_URL=${{ vars.VAIRIFY_UI_URL }}
- name: publish
run: |
docker push ghcr.io/${REPO}/vairify-frontend-${{ inputs.environment }}:latest
63 changes: 63 additions & 0 deletions deployment/compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
services:
db:
container_name: mongo
image: mongo:latest
restart: always
ports:
- 27017:27017
volumes:
- database:/data/db

etl-insitu:
image: ghcr.io/ecmwfcode4earth/vairify/vairify-etl-insitu
container_name: etl-insitu
depends_on:
- db
environment:
- MONGO_DB_URI=mongodb://mongo:27017/
- MONGO_DB_NAME=${MONGO_DB_NAME}
- OPEN_AQ_API_URL=${OPEN_AQ_API_URL}
- OPEN_AQ_API_KEY=${OPEN_AQ_API_KEY}
- CDSAPI_URL=${CDSAPI_URL}
- CDSAPI_KEY=${CDSAPI_KEY}
- STORE_GRIB_FILES=${STORE_GRIB_FILES}

etl-forecast:
container_name: etl-forecast
image: ghcr.io/ecmwfcode4earth/vairify/vairify-etl-forecast
depends_on:
- db
environment:
- MONGO_DB_URI=mongodb://mongo:27017/
- MONGO_DB_NAME=${MONGO_DB_NAME}
- CDSAPI_URL=${CDSAPI_URL}
- CDSAPI_KEY=${CDSAPI_KEY}
- STORE_GRIB_FILES=${STORE_GRIB_FILES}
volumes:
- data_textures:/app/data_textures

api:
container_name: backend-api
image: ghcr.io/ecmwfcode4earth/vairify/vairify-backend-api
depends_on:
- db
ports:
- 8000:8000
environment:
- MONGO_DB_URI=mongodb://mongo:27017
- MONGO_DB_NAME=${MONGO_DB_NAME}

ui:
container_name: frontend-ui
image: ghcr.io/ecmwfcode4earth/vairify/vairify-frontend-dev
depends_on:
- api
ports:
- 8001:80
volumes:
- data_textures:/app/data_textures


volumes:
database: {}
data_textures: {}
63 changes: 63 additions & 0 deletions deployment/compose-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
services:
db:
container_name: mongo
image: mongo:latest
restart: always
ports:
- 27017:27017
volumes:
- database:/data/db

etl-insitu:
image: ghcr.io/ecmwfcode4earth/vairify/vairify-etl-insitu
container_name: etl-insitu
depends_on:
- db
environment:
- MONGO_DB_URI=mongodb://mongo:27017/
- MONGO_DB_NAME=${MONGO_DB_NAME}
- OPEN_AQ_API_URL=${OPEN_AQ_API_URL}
- OPEN_AQ_API_KEY=${OPEN_AQ_API_KEY}
- CDSAPI_URL=${CDSAPI_URL}
- CDSAPI_KEY=${CDSAPI_KEY}
- STORE_GRIB_FILES=${STORE_GRIB_FILES}

etl-forecast:
container_name: etl-forecast
image: ghcr.io/ecmwfcode4earth/vairify/vairify-etl-forecast
depends_on:
- db
environment:
- MONGO_DB_URI=mongodb://mongo:27017/
- MONGO_DB_NAME=${MONGO_DB_NAME}
- CDSAPI_URL=${CDSAPI_URL}
- CDSAPI_KEY=${CDSAPI_KEY}
- STORE_GRIB_FILES=${STORE_GRIB_FILES}
volumes:
- data_textures:/app/data_textures

api:
container_name: backend-api
image: ghcr.io/ecmwfcode4earth/vairify/vairify-backend-api
depends_on:
- db
ports:
- 8000:8000
environment:
- MONGO_DB_URI=mongodb://mongo:27017
- MONGO_DB_NAME=${MONGO_DB_NAME}

ui:
container_name: frontend-ui
image: ghcr.io/ecmwfcode4earth/vairify/vairify-frontend-prod
depends_on:
- api
ports:
- 8001:80
volumes:
- data_textures:/app/data_textures


volumes:
database: {}
data_textures: {}

0 comments on commit c4aa39b

Please sign in to comment.