Skip to content

Commit

Permalink
Build and deploy Persons API (#552)
Browse files Browse the repository at this point in the history
* Adjust deployment workflow to include the Persons Api

* Deploy a Custom Container App using Terraform
  • Loading branch information
DrizzlyOwl committed Aug 8, 2024
1 parent f20e2b8 commit fe05649
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,32 @@ jobs:
name: Deploy '${{ needs.set-env.outputs.branch }}' to ${{ needs.set-env.outputs.environment }}
needs: [ set-env ]
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build-push-deploy.yml@v2.2.0
strategy:
matrix:
image: [
"Dockerfile",
"Dockerfile.PersonsApi"
]
include:
- image: "Dockerfile"
aca_name_secret: "AZURE_ACA_NAME"
name: "tramsapi-app"
- image: "Dockerfile.PersonsApi"
aca_name_secret: "AZURE_PERSONS_API_ACA_NAME"
name: "personsapi-app"
with:
docker-image-name: 'tramsapi-app'
docker-build-file-name: './Dockerfile'
docker-image-name: '${{ matrix.name }}'
docker-build-file-name: './${{ matrix.image }}'
environment: ${{ needs.set-env.outputs.environment }}
annotate-release: true
# Only annotate the release once, because both apps are deployed at the same time
annotate-release: ${{ matrix.name == 'tramsapi-app' }}
docker-build-args: |
COMMIT_SHA="${{ needs.set-env.outputs.checked-out-sha }}"
secrets:
azure-acr-name: ${{ secrets.ACR_NAME }}
azure-acr-credentials: ${{ secrets.ACR_CREDENTIALS }}
azure-aca-credentials: ${{ secrets.AZURE_ACA_CREDENTIALS }}
azure-aca-name: ${{ secrets.AZURE_ACA_NAME }}
azure-aca-name: ${{ secrets[matrix.aca_name_secret] }}
azure-aca-resource-group: ${{ secrets.AZURE_ACA_RESOURCE_GROUP }}

create-tag:
Expand Down
1 change: 1 addition & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ No resources.
| <a name="input_container_health_probe_path"></a> [container\_health\_probe\_path](#input\_container\_health\_probe\_path) | Specifies the path that is used to determine the liveness of the Container | `string` | n/a | yes |
| <a name="input_container_scale_http_concurrency"></a> [container\_scale\_http\_concurrency](#input\_container\_scale\_http\_concurrency) | When the number of concurrent HTTP requests exceeds this value, then another replica is added. Replicas continue to add to the pool up to the max-replicas amount. | `number` | `10` | no |
| <a name="input_container_secret_environment_variables"></a> [container\_secret\_environment\_variables](#input\_container\_secret\_environment\_variables) | Container secret environment variables | `map(string)` | n/a | yes |
| <a name="input_custom_container_apps"></a> [custom\_container\_apps](#input\_custom\_container\_apps) | Custom container apps, by default deployed within the container app environment managed by this module. | <pre>map(object({<br> container_app_environment_id = optional(string, "")<br> resource_group_name = optional(string, "")<br> revision_mode = optional(string, "Single")<br> container_port = optional(number, 0)<br> ingress = optional(object({<br> external_enabled = optional(bool, true)<br> target_port = optional(number, null)<br> traffic_weight = object({<br> percentage = optional(number, 100)<br> })<br> cdn_frontdoor_custom_domain = optional(string, "")<br> cdn_frontdoor_origin_fqdn_override = optional(string, "")<br> cdn_frontdoor_origin_host_header_override = optional(string, "")<br> enable_cdn_frontdoor_health_probe = optional(bool, false)<br> cdn_frontdoor_health_probe_protocol = optional(string, "")<br> cdn_frontdoor_health_probe_interval = optional(number, 120)<br> cdn_frontdoor_health_probe_request_type = optional(string, "")<br> cdn_frontdoor_health_probe_path = optional(string, "")<br> cdn_frontdoor_forwarding_protocol_override = optional(string, "")<br> }), null)<br> identity = optional(list(object({<br> type = string<br> identity_ids = list(string)<br> })), [])<br> secrets = optional(list(object({<br> name = string<br> value = string<br> })), [])<br> registry = optional(object({<br> server = optional(string, "")<br> username = optional(string, "")<br> password_secret_name = optional(string, "")<br> identity = optional(string, "")<br> }), null),<br> image = string<br> cpu = number<br> memory = number<br> command = list(string)<br> liveness_probes = optional(list(object({<br> interval_seconds = number<br> transport = string<br> port = number<br> path = optional(string, null)<br> })), [])<br> env = optional(list(object({<br> name = string<br> value = optional(string, null)<br> secretRef = optional(string, null)<br> })), [])<br> min_replicas = number<br> max_replicas = number<br> }))</pre> | `{}` | no |
| <a name="input_dns_mx_records"></a> [dns\_mx\_records](#input\_dns\_mx\_records) | DNS MX records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(<br> object({<br> preference : number,<br> exchange : string<br> })<br> )<br> })<br> )</pre> | `{}` | no |
| <a name="input_dns_ns_records"></a> [dns\_ns\_records](#input\_dns\_ns\_records) | DNS NS records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(string)<br> })<br> )</pre> | n/a | yes |
| <a name="input_dns_txt_records"></a> [dns\_txt\_records](#input\_dns\_txt\_records) | DNS TXT records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(string)<br> })<br> )</pre> | n/a | yes |
Expand Down
2 changes: 2 additions & 0 deletions terraform/container-apps-hosting.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ module "azure_container_apps_hosting" {
existing_logic_app_workflow = local.existing_logic_app_workflow
existing_network_watcher_name = local.existing_network_watcher_name
existing_network_watcher_resource_group_name = local.existing_network_watcher_resource_group_name

custom_container_apps = local.custom_container_apps
}
1 change: 1 addition & 0 deletions terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ locals {
statuscake_contact_group_name = var.statuscake_contact_group_name
statuscake_contact_group_integrations = var.statuscake_contact_group_integrations
statuscake_contact_group_email_addresses = var.statuscake_contact_group_email_addresses
custom_container_apps = var.custom_container_apps
}
58 changes: 58 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,61 @@ variable "cdn_frontdoor_waf_custom_rules" {
}))
default = {}
}

variable "custom_container_apps" {
description = "Custom container apps, by default deployed within the container app environment managed by this module."
type = map(object({
container_app_environment_id = optional(string, "")
resource_group_name = optional(string, "")
revision_mode = optional(string, "Single")
container_port = optional(number, 0)
ingress = optional(object({
external_enabled = optional(bool, true)
target_port = optional(number, null)
traffic_weight = object({
percentage = optional(number, 100)
})
cdn_frontdoor_custom_domain = optional(string, "")
cdn_frontdoor_origin_fqdn_override = optional(string, "")
cdn_frontdoor_origin_host_header_override = optional(string, "")
enable_cdn_frontdoor_health_probe = optional(bool, false)
cdn_frontdoor_health_probe_protocol = optional(string, "")
cdn_frontdoor_health_probe_interval = optional(number, 120)
cdn_frontdoor_health_probe_request_type = optional(string, "")
cdn_frontdoor_health_probe_path = optional(string, "")
cdn_frontdoor_forwarding_protocol_override = optional(string, "")
}), null)
identity = optional(list(object({
type = string
identity_ids = list(string)
})), [])
secrets = optional(list(object({
name = string
value = string
})), [])
registry = optional(object({
server = optional(string, "")
username = optional(string, "")
password_secret_name = optional(string, "")
identity = optional(string, "")
}), null),
image = string
cpu = number
memory = number
command = list(string)
liveness_probes = optional(list(object({
interval_seconds = number
transport = string
port = number
path = optional(string, null)
})), [])
env = optional(list(object({
name = string
value = optional(string, null)
secretRef = optional(string, null)
})), [])
min_replicas = number
max_replicas = number
}))
default = {}
}

0 comments on commit fe05649

Please sign in to comment.