Skip to content

Commit

Permalink
updated the image that is getting loaded into app service
Browse files Browse the repository at this point in the history
added http logs to azure app service terraform
  • Loading branch information
jburns24 committed Apr 28, 2024
1 parent 0d18392 commit 84a13c2
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 26 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
permissions:
contents: read
id-token: write
packages: write

env:
# Setting an environment variable with the value of a configuration variable
Expand Down Expand Up @@ -51,5 +52,12 @@ jobs:

- name: Terragrunt apply
run: |
set
terragrunt apply --terragrunt-non-interactive -auto-approve
env:
# ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
# ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
# ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET}}
# ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
TF_VAR_discord_token: ${{ secrets.DISCORD_TOKEN }}
TF_VAR_clash_token: ${{ secrets.CLASH_TOKEN }}
TF_VAR_image_name: "${{ github.repository }}:${{ github.sha }}"
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/jburns24/discord-coc-donations-ws-app:latest
ghcr.io/jburns24/discord-coc-donations-ws-app:${{ github.sha }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
21 changes: 0 additions & 21 deletions infra/.terraform.lock.hcl

This file was deleted.

8 changes: 8 additions & 0 deletions infra/acr.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# resource "azurerm_container_registry" "acr" {
# name = "coc-disco-donations-acr"
# resource_group_name = azurerm_resource_group.coc_donations_rg.name
# location = azurerm_resource_group.coc_donations_rg.location
# sku = "Basic"
# admin_enabled = false
# # georeplication_locations = ["eastus", "westus"]
# }
3 changes: 3 additions & 0 deletions infra/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# output "acr_url" {
# value = azurerm_container_registry.acr.login_servers
# }
9 changes: 9 additions & 0 deletions infra/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 1,
"lineage": "5f6c9efc-7124-3d44-8f52-875f62e167b8",
"outputs": {},
"resources": [],
"check_results": null
}
19 changes: 19 additions & 0 deletions infra/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,22 @@ variable "clash_token" {
type = string

}

variable "image_tag" {
description = "The tag for the Docker image"
type = string
default = "latest"

}

variable "container_registry_url" {
description = "The URL for the Container registry"
type = string
default = "https://ghcr.io"

}

variable "image_name" {
description = "The name of the Docker image"
type = string
}
13 changes: 11 additions & 2 deletions infra/web-app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ resource "azurerm_linux_web_app" "coc_donations_app_service" {
"CLASH_TOKEN" = var.clash_token
}

logs {
http_logs {
file_system {
retention_in_days = 1
retention_in_mb = 35
}
}
}

site_config {
always_on = false # This has to be disabled for the free tier
application_stack {
docker_image_name = "coc-disco-donations:latest"
docker_registry_url = "https://ghcr.io/jburns24/discord-coc-donations-ws-app"
docker_image_name = var.image_name
docker_registry_url = var.container_registry_url
}
}
}

0 comments on commit 84a13c2

Please sign in to comment.