diff --git a/.github/workflows/reusable-docker-deploy.yml b/.github/workflows/reusable-docker-deploy.yml index d60f4432..b798e8da 100644 --- a/.github/workflows/reusable-docker-deploy.yml +++ b/.github/workflows/reusable-docker-deploy.yml @@ -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 && \\ diff --git a/.github/workflows/reusable-frontend-ui-docker-build.yml b/.github/workflows/reusable-frontend-ui-docker-build.yml new file mode 100644 index 00000000..c86e4e94 --- /dev/null +++ b/.github/workflows/reusable-frontend-ui-docker-build.yml @@ -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 \ No newline at end of file diff --git a/deployment/compose-dev.yaml b/deployment/compose-dev.yaml new file mode 100644 index 00000000..8972c41e --- /dev/null +++ b/deployment/compose-dev.yaml @@ -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: {} \ No newline at end of file diff --git a/deployment/compose-prod.yaml b/deployment/compose-prod.yaml new file mode 100644 index 00000000..61076a69 --- /dev/null +++ b/deployment/compose-prod.yaml @@ -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: {} \ No newline at end of file