diff --git a/.github/actions/build-frontend/action.yml b/.github/actions/build-frontend/action.yml index 0c6ac380..a8284354 100644 --- a/.github/actions/build-frontend/action.yml +++ b/.github/actions/build-frontend/action.yml @@ -38,7 +38,7 @@ runs: shell: bash working-directory: ${{ inputs.frontend-path }} run: | - VITE_API_URL=${{ inputs.api-endpoint }} npm run build + VITE_MIDDLEWARE_API_URL=${{ inputs.api-endpoint }} npm run build - name: Test frontend shell: bash working-directory: ${{ inputs.frontend-path }} diff --git a/.github/actions/build-publish-api/action.yml b/.github/actions/build-publish-api/action.yml index e6f48c45..4f912562 100644 --- a/.github/actions/build-publish-api/action.yml +++ b/.github/actions/build-publish-api/action.yml @@ -42,4 +42,5 @@ runs: context: ${{ inputs.docker-context-path }} file: ${{ inputs.dockerfile-path }} push: true + platforms: linux/amd64 tags: ${{ inputs.docker-registry }}/${{ env.REPO }}-${{ inputs.api-name }}:${{ inputs.docker-tag }} \ No newline at end of file diff --git a/.github/workflows/build-deploy-frontend.yml b/.github/workflows/build-deploy-frontend.yml index 6d17e2b9..48bc5e78 100644 --- a/.github/workflows/build-deploy-frontend.yml +++ b/.github/workflows/build-deploy-frontend.yml @@ -26,7 +26,7 @@ jobs: - uses: ./.github/actions/build-frontend name: Build frontend with: - api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net + api-endpoint: https://reportvision-middleware-${{ inputs.deploy-env }}.azurewebsites.net/ frontend-tarball: ./frontend.tgz frontend-path: ./frontend frontend-build-path: ./frontend/dist/ diff --git a/.github/workflows/build-deploy-ocr.yml b/.github/workflows/build-deploy-ocr.yml index 584e0905..a51b5505 100644 --- a/.github/workflows/build-deploy-ocr.yml +++ b/.github/workflows/build-deploy-ocr.yml @@ -77,4 +77,4 @@ jobs: deploy-env: ${{ inputs.deploy-env }} docker-tag: ${{ needs.build-publish-ocr.outputs.docker_tag }} docker-registry: ghcr.io - api-name: ocr + api-name: ocr \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile index 0fbd123e..ed9cd3e3 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,14 @@ -FROM amazoncorretto:17 -ENV HOME=/app -RUN mkdir -p $HOME -WORKDIR $HOME +# Use a base image with Java and Gradle +FROM openjdk:17-slim + +# Set the working directory +WORKDIR /app + +# Copy the project files +COPY . . + +RUN chmod +x ./gradlew + +EXPOSE 8080 + +ENTRYPOINT [ "./gradlew", "bootRun" ] \ No newline at end of file diff --git a/backend/dev-dockerfile b/backend/dev-dockerfile index 451218df..66f1ee3a 100644 --- a/backend/dev-dockerfile +++ b/backend/dev-dockerfile @@ -2,4 +2,4 @@ FROM amazoncorretto:17 ENV HOME=/app RUN mkdir -p $HOME WORKDIR $HOME -ENTRYPOINT [ "./gradlew", "bootRun", "--continuous", "--args=--server.port=8081" ] \ No newline at end of file +ENTRYPOINT [ "./gradlew", "bootRun", "--continuous", "--args=--server.port=8081" ] diff --git a/dev-env.yaml b/dev-env.yaml index 3fcf9d04..ae63d405 100644 --- a/dev-env.yaml +++ b/dev-env.yaml @@ -50,5 +50,3 @@ services: restart: "unless-stopped" depends_on: - db - command: "./gradlew bootRun --continuous --args='--server.port=8081'" - diff --git a/ops/terraform/main.tf b/ops/terraform/main.tf index 45d63fbb..c3a67c51 100644 --- a/ops/terraform/main.tf +++ b/ops/terraform/main.tf @@ -74,11 +74,16 @@ module "middleware_api" { app_subnet_id = module.networking.middlewaresubnet_id app_settings = { - WEBSITES_PORT = "8081" + WEBSITES_PORT = "8080" + PORT = "8080" + SSL_MODE = "require" POSTGRES_HOST = module.database.postgres_fqdn - POSTGRES_DB = module.database.postgres_db_name + POSTGRES_DB = "${module.database.postgres_db_name}-db" POSTGRES_USER = module.database.postgres_user POSTGRES_PASSWORD = module.vault.postgres_password + WEBSITES_CONTAINER_START_TIME_LIMIT = 400 + FASTAPI_URL = "https://${module.ocr_api.app_hostname}" + DEBUG = true } lb_subnet_id = module.networking.lbsubnet_id @@ -102,12 +107,12 @@ module "ocr_api" { WEBSITES_PORT = "8000" } - lb_subnet_id = module.networking.middlewaresubnet_id + lb_subnet_id = module.networking.lbsubnet_id env = local.environment vnet = module.networking.network_name sku_name = var.sku_name https_only = true - depends_on = [module.networking.ocrsubnet_id, module.networking.middlewaresubnet_id] + depends_on = [module.networking.ocrsubnet_id, module.networking.lbsubnet_id] } module "ocr_autoscale" { diff --git a/ops/terraform/modules/app_service/main.tf b/ops/terraform/modules/app_service/main.tf index d4ed6562..27eec5e1 100644 --- a/ops/terraform/modules/app_service/main.tf +++ b/ops/terraform/modules/app_service/main.tf @@ -27,11 +27,6 @@ resource "azurerm_linux_web_app" "linux_webapp" { scm_minimum_tls_version = "1.2" use_32_bit_worker = false ftps_state = "Disabled" - vnet_route_all_enabled = false - - ip_restriction { - virtual_network_subnet_id = var.lb_subnet_id - action = "Allow" - } + vnet_route_all_enabled = true } } diff --git a/ops/terraform/modules/app_service/variables.tf b/ops/terraform/modules/app_service/variables.tf index 1a204d5e..a624bb01 100644 --- a/ops/terraform/modules/app_service/variables.tf +++ b/ops/terraform/modules/app_service/variables.tf @@ -2,7 +2,7 @@ variable "env" {} variable "name" {} variable "resource_group" {} variable "location" {} -variable "lb_subnet_id" {} + variable "app_subnet_id" {} variable "sku_name" { default = "S2" diff --git a/ops/terraform/modules/database/main.tf b/ops/terraform/modules/database/main.tf index eba5cbc4..2e6d4957 100644 --- a/ops/terraform/modules/database/main.tf +++ b/ops/terraform/modules/database/main.tf @@ -19,7 +19,7 @@ resource "azurerm_postgresql_flexible_server" "postgres_flexible_server" { public_network_access_enabled = false lifecycle { - prevent_destroy = false + prevent_destroy = true ignore_changes = [zone] } } diff --git a/ops/terraform/modules/security/main.tf b/ops/terraform/modules/security/main.tf index 260f69c5..8762ae37 100644 --- a/ops/terraform/modules/security/main.tf +++ b/ops/terraform/modules/security/main.tf @@ -28,12 +28,6 @@ resource "azurerm_network_security_group" "web-nsg" { # } } -resource "azurerm_subnet_network_security_group_association" "web-nsg-subnet" { - depends_on = [azurerm_network_security_rule.ag_nsg_rule_inbound] - subnet_id = var.lb_subnet_id - network_security_group_id = azurerm_network_security_group.web-nsg.id -} - locals { ag_inbound_ports_map = { "100" : "80", # If the key starts with a number, you must use the colon syntax ":" instead of "=" diff --git a/ops/terraform/modules/vault/variables.tf b/ops/terraform/modules/vault/variables.tf index 0fbb513c..88483c34 100644 --- a/ops/terraform/modules/vault/variables.tf +++ b/ops/terraform/modules/vault/variables.tf @@ -6,9 +6,8 @@ variable "object_id" { type = string } variable "postgres_server_id" { - type = string } variable "resource_group_name" {} variable "subscription_id" {} variable "service_plan_id" {} -variable "tenant_id" {} +variable "tenant_id" {} \ No newline at end of file