Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CES-607] Add pm2 support to AppService modules #188

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions infra/modules/azure_app_service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
| <a name="input_health_check_path"></a> [health\_check\_path](#input\_health\_check\_path) | Endpoint where health probe is exposed | `string` | n/a | yes |
| <a name="input_java_version"></a> [java\_version](#input\_java\_version) | Java version to use | `string` | `17` | no |
| <a name="input_node_version"></a> [node\_version](#input\_node\_version) | Node version to use | `number` | `20` | no |
| <a name="input_pm2_startup_file_name"></a> [pm2\_startup\_file\_name](#input\_pm2\_startup\_file\_name) | (Optional) Use this variable to enable PM2. The specified file is used as PM2 process entry point | `string` | `null` | no |
| <a name="input_private_dns_zone_resource_group_name"></a> [private\_dns\_zone\_resource\_group\_name](#input\_private\_dns\_zone\_resource\_group\_name) | (Optional) The name of the resource group holding private DNS zone to use for private endpoints. Default is Virtual Network resource group | `string` | `null` | no |
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | Resource group to deploy resources to | `string` | n/a | yes |
| <a name="input_slot_app_settings"></a> [slot\_app\_settings](#input\_slot\_app\_settings) | Staging slot application settings | `map(string)` | `{}` | no |
Expand Down
2 changes: 2 additions & 0 deletions infra/modules/azure_app_service/app_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ resource "azurerm_linux_web_app" "this" {
health_check_eviction_time_in_min = 2
ip_restriction_default_action = "Deny"

app_command_line = local.app_service.command_line

application_stack {
node_version = var.stack == "node" ? "${var.node_version}-lts" : null
java_version = var.stack == "java" ? var.java_version : null
Expand Down
2 changes: 2 additions & 0 deletions infra/modules/azure_app_service/app_service_slot.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ resource "azurerm_linux_web_app_slot" "this" {
health_check_eviction_time_in_min = 2
ip_restriction_default_action = "Deny"

app_command_line = local.app_service.command_line

application_stack {
node_version = var.stack == "node" ? "${var.node_version}-lts" : null
java_version = var.stack == "java" ? var.java_version : null
Expand Down
1 change: 1 addition & 0 deletions infra/modules/azure_app_service/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ locals {
sku_name = local.sku_name_mapping[local.tier]
zone_balancing_enabled = local.tier != "s"
is_slot_enabled = local.tier == "s" ? 0 : 1
command_line = var.pm2_startup_file_name == null ? null : "pm2 start ${var.pm2_startup_file_name} -i max --no-daemon"
}

app_service_slot = {
Expand Down
6 changes: 6 additions & 0 deletions infra/modules/azure_app_service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,9 @@ variable "subnet_service_endpoints" {
description = "(Optional) Enable service endpoints for the underlying subnet. This variable should be set only if function dependencies do not use private endpoints"
default = null
}

variable "pm2_startup_file_name" {
type = string
default = null
description = "(Optional) Use this variable to enable PM2. The specified file is used as PM2 process entry point"
}
1 change: 1 addition & 0 deletions infra/modules/azure_app_service_exposed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This module is used to create an Azure App Service, allowing it to be configured
| <a name="input_health_check_path"></a> [health\_check\_path](#input\_health\_check\_path) | Endpoint where health probe is exposed | `string` | n/a | yes |
| <a name="input_java_version"></a> [java\_version](#input\_java\_version) | Java version to use | `string` | `17` | no |
| <a name="input_node_version"></a> [node\_version](#input\_node\_version) | Node version to use | `number` | `20` | no |
| <a name="input_pm2_startup_file_name"></a> [pm2\_startup\_file\_name](#input\_pm2\_startup\_file\_name) | (Optional) Use this variable to enable PM2. The specified file is used as PM2 process entry point | `string` | `null` | no |
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | Resource group to deploy resources to | `string` | n/a | yes |
| <a name="input_slot_app_settings"></a> [slot\_app\_settings](#input\_slot\_app\_settings) | Staging slot application settings | `map(string)` | `{}` | no |
| <a name="input_stack"></a> [stack](#input\_stack) | n/a | `string` | `"node"` | no |
Expand Down
2 changes: 2 additions & 0 deletions infra/modules/azure_app_service_exposed/app_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ resource "azurerm_linux_web_app" "this" {
health_check_path = var.health_check_path
health_check_eviction_time_in_min = 2

app_command_line = local.app_service.command_line

application_stack {
node_version = var.stack == "node" ? "${var.node_version}-lts" : null
java_version = var.stack == "java" ? var.java_version : null
Expand Down
2 changes: 2 additions & 0 deletions infra/modules/azure_app_service_exposed/app_service_slot.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ resource "azurerm_linux_web_app_slot" "this" {
health_check_path = var.health_check_path
health_check_eviction_time_in_min = 2

app_command_line = local.app_service.command_line

application_stack {
node_version = var.stack == "node" ? "${var.node_version}-lts" : null
java_version = var.stack == "java" ? var.java_version : null
Expand Down
1 change: 1 addition & 0 deletions infra/modules/azure_app_service_exposed/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ locals {
zone_balancing_enabled = local.tier != "s" && local.tier != "xs"
is_slot_enabled = local.tier == "s" || local.tier == "xs" ? 0 : 1
always_on = local.tier == "xs" ? false : true
command_line = var.pm2_startup_file_name == null ? null : "pm2 start ${var.pm2_startup_file_name} -i max --no-daemon"
}

application_insights = {
Expand Down
6 changes: 6 additions & 0 deletions infra/modules/azure_app_service_exposed/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ variable "sticky_app_setting_names" {
description = "(Optional) A list of application setting names that are not swapped between slots"
default = []
}

variable "pm2_startup_file_name" {
type = string
default = null
description = "(Optional) Use this variable to enable PM2. The specified file is used as PM2 process entry point"
}
Loading