diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 64db3d5..bafd587 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,24 +3,28 @@ "dockerComposeFile": ["../compose.yml"], "service": "dev", "runServices": ["dev", "docs"], - "workspaceFolder": "/home/calitp/app", + "workspaceFolder": "/calitp/app", "postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"], // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.defaultProfile.linux": "bash", - "terminal.integrated.profiles.linux": { - "bash": { - "path": "/bin/bash" - } + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "bash", + "terminal.integrated.profiles.linux": { + "bash": { + "path": "/bin/bash" + } + } + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "bpruitt-goddard.mermaid-markdown-syntax-highlighting", + "eamodio.gitlens", + "esbenp.prettier-vscode", + "mhutchie.git-graph", + "ms-python.python", + "ms-python.vscode-pylance" + ] } - }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "bpruitt-goddard.mermaid-markdown-syntax-highlighting", - "eamodio.gitlens", - "esbenp.prettier-vscode", - "mhutchie.git-graph", - "ms-python.python", - "ms-python.vscode-pylance" - ] + } } diff --git a/appcontainer/Dockerfile b/appcontainer/Dockerfile index 4006e14..8034adb 100644 --- a/appcontainer/Dockerfile +++ b/appcontainer/Dockerfile @@ -20,16 +20,16 @@ RUN useradd --create-home --shell /bin/bash $USER && \ touch /var/run/nginx.pid && \ chown -R $USER /var/run/nginx.pid && \ # setup directories and permissions for gunicorn, (eventual) app - mkdir -p /home/$USER/app && \ - mkdir -p /home/$USER/run && \ - chown -R $USER /home/$USER && \ + mkdir -p /$USER/app && \ + mkdir -p /$USER/run && \ + chown -R $USER /$USER && \ # install server components apt-get update && \ apt-get install -qq --no-install-recommends build-essential nginx gettext && \ python -m pip install --upgrade pip # enter run (gunicorn) directory -WORKDIR /home/$USER/run +WORKDIR /$USER/run # switch to non-root $USER USER $USER @@ -43,13 +43,13 @@ RUN pip install --no-cache-dir -r requirements.txt # copy gunicorn config file COPY appcontainer/gunicorn.conf.py gunicorn.conf.py -ENV GUNICORN_CONF "/home/$USER/run/gunicorn.conf.py" +ENV GUNICORN_CONF "/$USER/run/gunicorn.conf.py" # overwrite default nginx.conf COPY appcontainer/nginx.conf /etc/nginx/nginx.conf # enter app directory -WORKDIR /home/$USER/app +WORKDIR /$USER/app # basic bash entrypoint ENTRYPOINT ["/bin/bash"] diff --git a/appcontainer/gunicorn.conf.py b/appcontainer/gunicorn.conf.py index 5c9e961..c5ca1a0 100644 --- a/appcontainer/gunicorn.conf.py +++ b/appcontainer/gunicorn.conf.py @@ -6,7 +6,7 @@ import multiprocessing # the unix socket defined in nginx.conf -bind = "unix:/home/calitp/run/gunicorn.sock" +bind = "unix:/calitp/run/gunicorn.sock" # Recommend (2 x $num_cores) + 1 as the number of workers to start off with workers = multiprocessing.cpu_count() * 2 + 1 diff --git a/appcontainer/nginx.conf b/appcontainer/nginx.conf index f856e83..a9d4909 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; } server { @@ -39,7 +39,7 @@ http { # path for static files location /static/ { - alias /home/calitp/app/static/; + alias /calitp/app/static/; expires 1y; add_header Cache-Control public; } diff --git a/compose.yml b/compose.yml index 8976583..3d310ae 100644 --- a/compose.yml +++ b/compose.yml @@ -10,7 +10,7 @@ services: ports: - "8000" volumes: - - .:/home/calitp/app + - .:/calitp/app dev: build: @@ -21,7 +21,7 @@ services: ports: - "8000" volumes: - - .:/home/calitp/app + - .:/calitp/app docs: image: docker-python-web:dev @@ -30,4 +30,4 @@ services: ports: - "8001" volumes: - - .:/home/calitp/app + - .:/calitp/app