Skip to content

Commit 8164f48

Browse files
derekadombekAdministratorarinkulshi-skylightmarycrawford
authored
Test deploy middleware (#479)
* deploy middleware to demo env * wip * wip * change image * added default paramaters to dev file * added default values for dev-env file * formatting * added bash exp synthax * updates to db, vault and networking * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * add output variables for db password, username, db name to middleware_api * remove commented out code and update middleware-api or app_service module with variables * minor updates * update app_settings in the middleware * removed unused variables * conatiner change * expose to 8081 * rm continuous * amd64 * add expose fro port 80 in dockerfile * go back to port 8080 and rm the port flag in the cmd * wip * add new app setting vars * deploy middleware to dev * deploy middleware to dev * deploy middleware to dev * deploy middleware to dev * push new var to frontend * push new var to frontend * push new var to frontend * push new var to frontend * push new var to frontend * wip * clean * deploy to middleware with CORS change * deploy to middleware with CORS change * deploy front to dev * wip * wip * wip * clean * push --------- Co-authored-by: Administrator <[email protected]> Co-authored-by: Arindam Kulshi <[email protected]> Co-authored-by: marycrawford <[email protected]>
1 parent c75061f commit 8164f48

File tree

13 files changed

+32
-30
lines changed

13 files changed

+32
-30
lines changed

.github/actions/build-frontend/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ runs:
3838
shell: bash
3939
working-directory: ${{ inputs.frontend-path }}
4040
run: |
41-
VITE_API_URL=${{ inputs.api-endpoint }} npm run build
41+
VITE_MIDDLEWARE_API_URL=${{ inputs.api-endpoint }} npm run build
4242
- name: Test frontend
4343
shell: bash
4444
working-directory: ${{ inputs.frontend-path }}

.github/actions/build-publish-api/action.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ runs:
4242
context: ${{ inputs.docker-context-path }}
4343
file: ${{ inputs.dockerfile-path }}
4444
push: true
45+
platforms: linux/amd64
4546
tags: ${{ inputs.docker-registry }}/${{ env.REPO }}-${{ inputs.api-name }}:${{ inputs.docker-tag }}

.github/workflows/build-deploy-frontend.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- uses: ./.github/actions/build-frontend
2727
name: Build frontend
2828
with:
29-
api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net
29+
api-endpoint: https://reportvision-middleware-${{ inputs.deploy-env }}.azurewebsites.net/
3030
frontend-tarball: ./frontend.tgz
3131
frontend-path: ./frontend
3232
frontend-build-path: ./frontend/dist/

.github/workflows/build-deploy-ocr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ jobs:
7777
deploy-env: ${{ inputs.deploy-env }}
7878
docker-tag: ${{ needs.build-publish-ocr.outputs.docker_tag }}
7979
docker-registry: ghcr.io
80-
api-name: ocr
80+
api-name: ocr

backend/Dockerfile

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
FROM amazoncorretto:17
2-
ENV HOME=/app
3-
RUN mkdir -p $HOME
4-
WORKDIR $HOME
1+
# Use a base image with Java and Gradle
2+
FROM openjdk:17-slim
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy the project files
8+
COPY . .
9+
10+
RUN chmod +x ./gradlew
11+
12+
EXPOSE 8080
13+
14+
ENTRYPOINT [ "./gradlew", "bootRun" ]

backend/dev-dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ FROM amazoncorretto:17
22
ENV HOME=/app
33
RUN mkdir -p $HOME
44
WORKDIR $HOME
5-
ENTRYPOINT [ "./gradlew", "bootRun", "--continuous", "--args=--server.port=8081" ]
5+
ENTRYPOINT [ "./gradlew", "bootRun", "--continuous", "--args=--server.port=8081" ]

dev-env.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,3 @@ services:
5050
restart: "unless-stopped"
5151
depends_on:
5252
- db
53-
command: "./gradlew bootRun --continuous --args='--server.port=8081'"
54-

ops/terraform/main.tf

+9-4
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@ module "middleware_api" {
7474
app_subnet_id = module.networking.middlewaresubnet_id
7575

7676
app_settings = {
77-
WEBSITES_PORT = "8081"
77+
WEBSITES_PORT = "8080"
78+
PORT = "8080"
79+
SSL_MODE = "require"
7880
POSTGRES_HOST = module.database.postgres_fqdn
79-
POSTGRES_DB = module.database.postgres_db_name
81+
POSTGRES_DB = "${module.database.postgres_db_name}-db"
8082
POSTGRES_USER = module.database.postgres_user
8183
POSTGRES_PASSWORD = module.vault.postgres_password
84+
WEBSITES_CONTAINER_START_TIME_LIMIT = 400
85+
FASTAPI_URL = "https://${module.ocr_api.app_hostname}"
86+
DEBUG = true
8287
}
8388

8489
lb_subnet_id = module.networking.lbsubnet_id
@@ -102,12 +107,12 @@ module "ocr_api" {
102107
WEBSITES_PORT = "8000"
103108
}
104109

105-
lb_subnet_id = module.networking.middlewaresubnet_id
110+
lb_subnet_id = module.networking.lbsubnet_id
106111
env = local.environment
107112
vnet = module.networking.network_name
108113
sku_name = var.sku_name
109114
https_only = true
110-
depends_on = [module.networking.ocrsubnet_id, module.networking.middlewaresubnet_id]
115+
depends_on = [module.networking.ocrsubnet_id, module.networking.lbsubnet_id]
111116
}
112117

113118
module "ocr_autoscale" {

ops/terraform/modules/app_service/main.tf

+1-6
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ resource "azurerm_linux_web_app" "linux_webapp" {
2727
scm_minimum_tls_version = "1.2"
2828
use_32_bit_worker = false
2929
ftps_state = "Disabled"
30-
vnet_route_all_enabled = false
31-
32-
ip_restriction {
33-
virtual_network_subnet_id = var.lb_subnet_id
34-
action = "Allow"
35-
}
30+
vnet_route_all_enabled = true
3631
}
3732
}

ops/terraform/modules/app_service/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ variable "env" {}
22
variable "name" {}
33
variable "resource_group" {}
44
variable "location" {}
5-
variable "lb_subnet_id" {}
5+
66
variable "app_subnet_id" {}
77
variable "sku_name" {
88
default = "S2"

ops/terraform/modules/database/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resource "azurerm_postgresql_flexible_server" "postgres_flexible_server" {
1919
public_network_access_enabled = false
2020

2121
lifecycle {
22-
prevent_destroy = false
22+
prevent_destroy = true
2323
ignore_changes = [zone]
2424
}
2525
}

ops/terraform/modules/security/main.tf

-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ resource "azurerm_network_security_group" "web-nsg" {
2828
# }
2929
}
3030

31-
resource "azurerm_subnet_network_security_group_association" "web-nsg-subnet" {
32-
depends_on = [azurerm_network_security_rule.ag_nsg_rule_inbound]
33-
subnet_id = var.lb_subnet_id
34-
network_security_group_id = azurerm_network_security_group.web-nsg.id
35-
}
36-
3731
locals {
3832
ag_inbound_ports_map = {
3933
"100" : "80", # If the key starts with a number, you must use the colon syntax ":" instead of "="

ops/terraform/modules/vault/variables.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ variable "object_id" {
66
type = string
77
}
88
variable "postgres_server_id" {
9-
type = string
109
}
1110
variable "resource_group_name" {}
1211
variable "subscription_id" {}
1312
variable "service_plan_id" {}
14-
variable "tenant_id" {}
13+
variable "tenant_id" {}

0 commit comments

Comments
 (0)