From 2c64d1e2845ce5010cbcb3e3b08dada036f3bd73 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Mon, 10 Jun 2024 16:47:46 -0700 Subject: [PATCH] refactor(container): move app root out of /home --- .devcontainer/devcontainer.json | 2 +- .devcontainer/postAttach.sh | 2 +- appcontainer/Dockerfile | 2 +- appcontainer/nginx.conf | 8 ++++---- compose.yml | 4 ++-- terraform/app_service.tf | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7cb87f0351..7cda99910f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "dockerComposeFile": ["../compose.yml"], "service": "dev", "runServices": ["dev", "docs", "server"], - "workspaceFolder": "/home/calitp/app", + "workspaceFolder": "/calitp/app", "postStartCommand": ["/bin/bash", "bin/reset_db.sh"], "postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"], "customizations": { diff --git a/.devcontainer/postAttach.sh b/.devcontainer/postAttach.sh index 29495649d0..b5c5440caa 100755 --- a/.devcontainer/postAttach.sh +++ b/.devcontainer/postAttach.sh @@ -3,5 +3,5 @@ set -eu # initialize pre-commit -git config --global --add safe.directory /home/calitp/app +git config --global --add safe.directory /calitp/app pre-commit install --overwrite diff --git a/appcontainer/Dockerfile b/appcontainer/Dockerfile index 4aa3cf9dfd..9e6cb3b98d 100644 --- a/appcontainer/Dockerfile +++ b/appcontainer/Dockerfile @@ -5,7 +5,7 @@ RUN python -m pip install --upgrade pip # overwrite default nginx.conf COPY appcontainer/nginx.conf /etc/nginx/nginx.conf -COPY appcontainer/proxy.conf /home/calitp/run/proxy.conf +COPY appcontainer/proxy.conf /calitp/run/proxy.conf # copy source files COPY manage.py manage.py diff --git a/appcontainer/nginx.conf b/appcontainer/nginx.conf index 27f322248c..b0fe492bdb 100644 --- a/appcontainer/nginx.conf +++ b/appcontainer/nginx.conf @@ -22,7 +22,7 @@ http { upstream app_server { # fail_timeout=0 means we always retry an upstream even if it failed # to return a good HTTP response - server unix:/home/calitp/run/gunicorn.sock fail_timeout=0; + server unix:/calitp/run/gunicorn.sock fail_timeout=0; } # maps $binary_ip_address to $limit variable if request is of type POST @@ -67,7 +67,7 @@ http { # path for static files location /static/ { - alias /home/calitp/app/static/; + alias /calitp/app/static/; expires 1y; add_header Cache-Control public; } @@ -81,12 +81,12 @@ http { # case-insensitive regex matches path location ~* ^/(eligibility/confirm)$ { limit_req zone=rate_limit; - include /home/calitp/run/proxy.conf; + include /calitp/run/proxy.conf; } # app path location @proxy_to_app { - include /home/calitp/run/proxy.conf; + include /calitp/run/proxy.conf; } } } diff --git a/compose.yml b/compose.yml index 663aaf00dc..c1a400b304 100644 --- a/compose.yml +++ b/compose.yml @@ -23,7 +23,7 @@ services: ports: - "${DJANGO_LOCAL_PORT:-8000}:8000" volumes: - - ./:/home/calitp/app + - ./:/calitp/app docs: image: benefits_client:dev @@ -32,7 +32,7 @@ services: ports: - "8001" volumes: - - ./:/home/calitp/app + - ./:/calitp/app server: image: ghcr.io/cal-itp/eligibility-server:dev diff --git a/terraform/app_service.tf b/terraform/app_service.tf index c150ceacaa..15dd3e5042 100644 --- a/terraform/app_service.tf +++ b/terraform/app_service.tf @@ -11,7 +11,7 @@ resource "azurerm_service_plan" "main" { } locals { - data_mount = "/home/calitp/app/data" + data_mount = "/calitp/app/data" } resource "azurerm_linux_web_app" "main" {