diff --git a/.github/workflows/build-deploy-ocr.yml b/.github/workflows/build-deploy-ocr.yml index 527f9bbc..3fba49c4 100644 --- a/.github/workflows/build-deploy-ocr.yml +++ b/.github/workflows/build-deploy-ocr.yml @@ -1,18 +1,20 @@ name: Create, publish, deploy a OCR API image on: - workflow_dispatch: - inputs: - deploy-env: - description: 'The environment to deploy to' - required: true - type: choice - options: - - dev - - demo - ocr-docker-tag: - description: 'This is optional if you would like to deploy an already published OCR-API image' - required: false + push: + branches: put-middle-behind-app-gateway + # workflow_dispatch: + # inputs: + # deploy-env: + # description: 'The environment to deploy to' + # required: true + # type: choice + # options: + # - dev + # - demo + # ocr-docker-tag: + # description: 'This is optional if you would like to deploy an already published OCR-API image' + # required: false permissions: contents: read @@ -35,7 +37,7 @@ jobs: shell: bash id: set_tag run: | - USER_INPUT="${{ github.event.inputs.ocr-docker-tag }}" + USER_INPUT="94c027a592208de803795dd22efa4fb4c27f914e" echo "docker_tag=$( #this gives a new sha as default if dispatch input is empty echo ${USER_INPUT:-"${{ github.sha }}"} @@ -44,7 +46,7 @@ jobs: id: image_check run: | echo "docker_inspect=$( - docker manifest inspect ghcr.io/${{ env.REPO }}-ocr:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $? + docker manifest inspect ghcr.io/${{ env.REPO }}-middleware:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $? )" >> $GITHUB_OUTPUT - name: Build and Push backend if: ${{ steps.image_check.outputs.docker_inspect == 1 }} @@ -54,14 +56,14 @@ jobs: docker-pw: ${{ secrets.GITHUB_TOKEN }} docker-username: ${{ github.actor }} docker-tag: ${{ steps.set_tag.outputs.docker_tag }} - dockerfile-path: ./OCR/Dockerfile - docker-context-path: ./OCR/ - api-name: ocr + dockerfile-path: ./backend/Dockerfile + docker-context-path: ./backend/ + api-name: middleware deploy-ocr: name: Deploy OCR runs-on: ubuntu-latest - environment: ${{ inputs.deploy-env }} + environment: dev needs: [build-publish-ocr] steps: - uses: actions/checkout@v4 @@ -73,7 +75,7 @@ jobs: - name: Deploy OCR-API uses: ./.github/actions/deploy-api with: - deploy-env: ${{ inputs.deploy-env }} + deploy-env: dev docker-tag: ${{ needs.build-publish-ocr.outputs.docker_tag }} docker-registry: ghcr.io - api-name: ocr + api-name: middleware diff --git a/ops/terraform/modules/app_gateway/main.tf b/ops/terraform/modules/app_gateway/main.tf index 9cb33cd0..7eebe0ba 100644 --- a/ops/terraform/modules/app_gateway/main.tf +++ b/ops/terraform/modules/app_gateway/main.tf @@ -12,24 +12,24 @@ resource "azurerm_public_ip" "lb-pip" { locals { backend_address_pool_name_static = "${var.name}-${var.env}-beap-static" backend_address_pool_name_api_ocr = "${var.name}-${var.env}-beap-api-ocr" - backend_address_pool_name_api_middleware = "${var.name}-${var.env}-beap-api" + backend_address_pool_name_api_middleware = "${var.name}-${var.env}-beap-api-middleware" frontend_port_name_api_ocr = "${var.name}-${var.env}-feport-api-ocr" - frontend_port_name_api_middleware = "${var.name}-${var.env}-feport-api" + frontend_port_name_api_middleware = "${var.name}-${var.env}-feport-api-middleware" frontend_port_name_static = "${var.name}-${var.env}-feport-static" frontend_ip_configuration_name = "${var.name}-${var.env}-feip" http_setting_name_static = "${var.name}-${var.env}-be-htst-static" http_setting_name_api_ocr = "${var.name}-${var.env}-be-htst-api-ocr" - http_setting_name_api_middleware = "${var.name}-${var.env}-be-htst-api" + http_setting_name_api_middleware = "${var.name}-${var.env}-be-htst-api-middleware" listener_name_static = "${var.name}-${var.env}-httplstn-static" listener_name_api_ocr = "${var.name}-${var.env}-httplstn-api-ocr" - listener_name_api_middleware = "${var.name}-${var.env}-httplstn-api" + listener_name_api_middleware = "${var.name}-${var.env}-httplstn-api-middleware" request_routing_rule_name_api_ocr = "${var.name}-${var.env}-rqrt-api-ocr" - request_routing_rule_name_api_middleware = "${var.name}-${var.env}-rqrt-api" + request_routing_rule_name_api_middleware = "${var.name}-${var.env}-rqrt-api-middleware" request_routing_rule_name_static = "${var.name}-${var.env}-rqrt-static" redirect_configuration_name = "${var.name}-${var.env}-rdrcfg" static_probe_name_app = "${var.name}-${var.env}-be-probe-app-static" api_probe_name_app_ocr = "${var.name}-${var.env}-be-probe-app-api-ocr" - api_probe_name_app_middleware = "${var.name}-${var.env}-be-probe-app-api_middleware" + api_probe_name_app_middleware = "${var.name}-${var.env}-be-probe-app-api-middleware" redirect_rule = "${var.name}-${var.env}-redirect" } @@ -132,7 +132,7 @@ resource "azurerm_application_gateway" "load_balancer" { unhealthy_threshold = 3 protocol = "Https" port = 443 - path = "/api" + path = "/actuator/health" pick_host_name_from_backend_http_settings = true match { body = "UP" @@ -209,7 +209,7 @@ resource "azurerm_application_gateway" "load_balancer" { name = "${var.name}-${var.env}-urlmap" default_backend_address_pool_name = local.backend_address_pool_name_static default_backend_http_settings_name = local.http_setting_name_static - default_rewrite_rule_set_name = "${var.name}-routing" + default_rewrite_rule_set_name = "${var.name}-middleware-routing" path_rule { name = "ocr"