From fec99878de1a924cfa77c54f0a8e51dc82625f8e Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Mon, 29 Dec 2025 21:51:56 -0600 Subject: [PATCH] 104 switch to daisyui (#107) * adding daisyui * adding daisy ui * switching to daisy ui * switching to daisy ui * adding daisy ui * adding daisy ui * updating docker compose --- Dockerfile | 8 +++---- api/entrypoint.sh | 5 +++-- database/litestream/litestream.yml | 4 ++-- docker-compose.yaml | 12 +++++----- infrastructure/container_app.tf | 36 +++++++++++++++++------------- infrastructure/variables.tf | 5 +++++ 6 files changed, 41 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4da73dd..983faf8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/amd64 node:22-slim +FROM node:22 WORKDIR app COPY ./api/dist ./api/dist @@ -9,10 +9,10 @@ WORKDIR api RUN npm ci WORKDIR / -COPY ./api/entrypoint.sh ./entrypoint.sh -RUN chmod +x entrypoint.sh +COPY ./api/entrypoint.sh ./app/entrypoint.sh +RUN chmod +x ./app/entrypoint.sh EXPOSE 3000 -ENTRYPOINT ["/entrypoint.sh"] +CMD ["./app/entrypoint.sh"] # ENTRYPOINT ["tail", "-f", "/dev/null"] \ No newline at end of file diff --git a/api/entrypoint.sh b/api/entrypoint.sh index 7eaefbe..527bbb0 100644 --- a/api/entrypoint.sh +++ b/api/entrypoint.sh @@ -1,3 +1,4 @@ #!/bin/bash -npx typeorm migration:run -d ./app/api/dist/database/data-source.js -node ./app/api/dist/main.js \ No newline at end of file +cd ./app +npx typeorm migration:run -d ./api/dist/database/data-source.js +node ./api/dist/main.js \ No newline at end of file diff --git a/database/litestream/litestream.yml b/database/litestream/litestream.yml index 21c6706..31716d9 100644 --- a/database/litestream/litestream.yml +++ b/database/litestream/litestream.yml @@ -1,4 +1,4 @@ dbs: - - path: /var/lib/data/flying.db + - path: /mnt/data/flying.db replicas: - - path: /mnt/backup/flying.db \ No newline at end of file + - path: /mnt/data/backup/flying.db \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index a044036..40362fc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -16,11 +16,11 @@ services: container_name: restore image: litestream/litestream:0.3.13 volumes: - - ./database/flying.db:/var/lib/data/flying.db + - ./database/flying.db:/mnt/data/flying.db - ./database/litestream/litestream.yml:/mnt/litestream/litestream.yml - backup:/mnt/data/backup - - data:/var/lib/data - command: restore -config /mnt/litestream/litestream.yml -if-db-not-exists -if-replica-exists /var/lib/data/flying.db + - data:/mnt/data + command: restore -config /mnt/litestream/litestream.yml -if-db-not-exists -if-replica-exists /mnt/data/flying.db app: container_name: flying @@ -31,9 +31,9 @@ services: env_file: - ./api/.env environment: - - DB_PATH=../../var/lib/data/flying.db + - DB_PATH=../../mnt/data/flying.db volumes: - - data:/var/lib/data + - data:/mnt/data depends_on: restore: condition: service_completed_successfully @@ -44,7 +44,7 @@ services: volumes: - ./database/litestream/litestream.yml:/mnt/litestream/litestream.yml - backup:/mnt - - data:/var/lib/data + - data:/mnt/data command: replicate -config /mnt/litestream/litestream.yml depends_on: app: diff --git a/infrastructure/container_app.tf b/infrastructure/container_app.tf index 9308462..8c7e2d2 100644 --- a/infrastructure/container_app.tf +++ b/infrastructure/container_app.tf @@ -1,8 +1,3 @@ -# data "azuread_application" "app_registration" { -# provider = azuread.external_tenant -# display_name = module.environment.app_reg_name -# } - resource "azurerm_container_app" "container_app" { name = module.environment.app_name container_app_environment_id = data.azurerm_container_app_environment.container_app_environment.id @@ -14,7 +9,7 @@ resource "azurerm_container_app" "container_app" { max_replicas = 2 init_container { - args = ["restore", "-if-db-not-exists", "-if-replica-exists", "/var/lib/data/flying.db"] + args = ["restore", "-if-db-not-exists", "-if-replica-exists", "/mnt/data/flying.db"] cpu = 0.25 image = "litestream/litestream:0.5.2" memory = "0.5Gi" @@ -22,13 +17,13 @@ resource "azurerm_container_app" "container_app" { volume_mounts { name = "data" - path = "/var/lib/data" + path = "/mnt/data" + sub_path = "data" } volume_mounts { name = "backup" - path = "/mnt/data" - sub_path = "data" + path = "/mnt/data/backup" } volume_mounts { @@ -47,13 +42,13 @@ resource "azurerm_container_app" "container_app" { volume_mounts { name = "data" - path = "/var/lib/data" + path = "/mnt/data" + sub_path = "data" } volume_mounts { name = "backup" - path = "/mnt/data" - sub_path = "data" + path = "/mnt/data/backup" } volume_mounts { @@ -65,7 +60,7 @@ resource "azurerm_container_app" "container_app" { container { cpu = 0.25 - image = "noahspan/flying:19615036250" + image = "noahspan/flying:20586783321" memory = "0.5Gi" name = "flying" @@ -104,6 +99,11 @@ resource "azurerm_container_app" "container_app" { value = var.JWKS_URI } + env { + name = "SESSION_SECRET" + secret_name = "session-secret" + } + env { name = "TENANT_ID" value = var.EXTERNAL_TENANT_ID @@ -111,7 +111,7 @@ resource "azurerm_container_app" "container_app" { env { name = "DB_PATH" - value = "/var/lib/data/flying.db" + value = "/mnt/data/flying.db" } env { @@ -130,7 +130,8 @@ resource "azurerm_container_app" "container_app" { volume_mounts { name = "data" - path = "/var/lib/data" + path = "/mnt/data" + sub_path = "data" } } @@ -179,6 +180,11 @@ resource "azurerm_container_app" "container_app" { value = var.DOCKER_IO_PASSWORD } + secret { + name = "session-secret" + value = var.SESSION_SECRET + } + lifecycle { ignore_changes = [ template[0].container[0].image, template[0].container[0].image, template[0].init_container[0].image, registry[0].server ] } diff --git a/infrastructure/variables.tf b/infrastructure/variables.tf index 00ea6e0..f647261 100644 --- a/infrastructure/variables.tf +++ b/infrastructure/variables.tf @@ -36,6 +36,11 @@ variable "EXTERNAL_TENANT_ID" { type = string } +variable "SESSION_SECRET" { + sensitive = true + type = string +} + variable "TENANT_ID" { type = string }