From fac45f2da507ea97228d3eaeddf96af2bd09261b Mon Sep 17 00:00:00 2001 From: zv0n Date: Wed, 3 Jun 2026 20:32:06 +0200 Subject: [PATCH 1/3] backend/nginx - update configuration to allow rootless execution --- backend/Dockerfile | 2 +- backend/nginx.conf | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 3ba994e1d..f1867d361 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -67,7 +67,7 @@ RUN chmod +x /code/entrypoint.sh \ RUN python3 manage.py collectstatic --noinput --verbosity 2 # Expose ports -EXPOSE 80 8000 +EXPOSE 8080 8000 # Start with an entrypoint that runs init tasks then starts supervisord ENTRYPOINT ["/code/entrypoint.sh"] diff --git a/backend/nginx.conf b/backend/nginx.conf index 23dba446a..9e2bbd872 100644 --- a/backend/nginx.conf +++ b/backend/nginx.conf @@ -1,19 +1,32 @@ worker_processes 1; + +error_log /tmp/nginx_error.log notice; +pid /tmp/nginx.pid; + events { worker_connections 1024; } + http { + proxy_temp_path /tmp/proxy_temp; + client_body_temp_path /tmp/client_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; client_max_body_size 100M; + access_log /tmp/nginx_access.log; + # The backend is running in the same container, so reference localhost upstream django { server 127.0.0.1:8000; # Use localhost to point to Gunicorn running internally } server { - listen 80; + listen 8080; server_name localhost; location / { proxy_pass http://django; # Forward to the upstream block @@ -39,4 +52,4 @@ http { add_header Referrer-Policy "strict-origin-when-cross-origin" always; } } -} \ No newline at end of file +} From 18f8bc85b53c6a0a7f510630fc4151374f23d9cd Mon Sep 17 00:00:00 2001 From: zv0n Date: Wed, 3 Jun 2026 20:32:37 +0200 Subject: [PATCH 2/3] backend - allow rootless execution --- backend/server/main/settings.py | 2 +- backend/supervisord.conf | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/server/main/settings.py b/backend/server/main/settings.py index a8fb777ed..c978e3e1f 100644 --- a/backend/server/main/settings.py +++ b/backend/server/main/settings.py @@ -368,7 +368,7 @@ def env(*keys, default=None): }, 'file': { 'class': 'logging.FileHandler', - 'filename': 'scheduler.log', + 'filename': getenv('LOG_FILE', 'scheduler.log'), }, }, 'root': { diff --git a/backend/supervisord.conf b/backend/supervisord.conf index eb72171b6..cf35cc50b 100644 --- a/backend/supervisord.conf +++ b/backend/supervisord.conf @@ -1,5 +1,7 @@ [supervisord] nodaemon=true +logfile=/tmp/supervisord.log +pidfile=/tmp/supervisord.pid [program:nginx] command=/usr/sbin/nginx -g "daemon off;" From cab17104ef0d99b566cb9c73ba6ea537ec25b2ed Mon Sep 17 00:00:00 2001 From: zv0n Date: Fri, 5 Jun 2026 19:14:08 +0200 Subject: [PATCH 3/3] documentation update --- docker-compose.yml | 2 +- documentation/docs/configuration/rootless_mode.md | 12 ++++++++++++ documentation/docs/install/docker.md | 1 + documentation/docs/install/nginx_proxy_manager.md | 2 +- kustomization.yml | 6 +++--- 5 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 documentation/docs/configuration/rootless_mode.md diff --git a/docker-compose.yml b/docker-compose.yml index 034ec065e..f46905261 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: restart: unless-stopped env_file: .env ports: - - "${BACKEND_PORT:-8016}:80" + - "${BACKEND_PORT:-8016}:8080" depends_on: - db volumes: diff --git a/documentation/docs/configuration/rootless_mode.md b/documentation/docs/configuration/rootless_mode.md new file mode 100644 index 000000000..6defe902d --- /dev/null +++ b/documentation/docs/configuration/rootless_mode.md @@ -0,0 +1,12 @@ +# Rootless Mode + +To enable rootless mode, you must: + +- set a non-root user to run the container (any UID will work) +- update ownership of media volume (mounted as `/code/media/`) to your selected UID +- set the following environment variable for server service + +```yaml +environment: + - LOG_FILE=/tmp/scheduler.log +``` diff --git a/documentation/docs/install/docker.md b/documentation/docs/install/docker.md index 3e5d42085..acdad7bdf 100644 --- a/documentation/docs/install/docker.md +++ b/documentation/docs/install/docker.md @@ -67,6 +67,7 @@ The `.env` file contains all the configuration settings for your AdventureLog in ## Optional Configuration - [Disable Registration](../configuration/disable_registration.md) +- [Rootless mode](../configuration/rootless_mode.md) - [Google Maps](../configuration/google_maps_integration.md) - [Email Configuration](../configuration/email.md) - [Immich Integration](../configuration/immich_integration.md) diff --git a/documentation/docs/install/nginx_proxy_manager.md b/documentation/docs/install/nginx_proxy_manager.md index a6b661ab1..b8fc21896 100644 --- a/documentation/docs/install/nginx_proxy_manager.md +++ b/documentation/docs/install/nginx_proxy_manager.md @@ -43,6 +43,6 @@ networks: - **Domain Names**: Enter the domain name where you will be hosting AdventureLog. - **Scheme**: `http` - **Forward Hostname/IP**: `adventurelog-backend` The name of the AdventureLog **backend** container in the `docker-compose.yml` file. - - **Forward Port**: `80` This is the internal port of the AdventureLog **backend** container so you will not need to change it even if you change the external port. + - **Forward Port**: `8080` This is the internal port of the AdventureLog **backend** container so you will not need to change it even if you change the external port. This will allow you to access AdventureLog using the domain name you specified in the Nginx Proxy Manager configuration. diff --git a/kustomization.yml b/kustomization.yml index da7c6e77d..676041811 100644 --- a/kustomization.yml +++ b/kustomization.yml @@ -61,7 +61,7 @@ spec: image: ghcr.io/seanmorley15/adventurelog-backend:latest imagePullPolicy: IfNotPresent ports: - - containerPort: 80 + - containerPort: 8080 - containerPort: 8000 volumeMounts: - name: adventure-journal @@ -122,8 +122,8 @@ spec: ports: - name: http protocol: TCP - port: 80 - targetPort: 80 + port: 8080 + targetPort: 8080 - name: base protocol: TCP port: 8000