Skip to content

[DEPLOYMENT] Images not loading unless Debug=True #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ryan24b opened this issue Mar 23, 2025 · 3 comments
Open

[DEPLOYMENT] Images not loading unless Debug=True #542

Ryan24b opened this issue Mar 23, 2025 · 3 comments
Labels
deployment Issues related to deploying AdventureLog

Comments

@Ryan24b
Copy link

Ryan24b commented Mar 23, 2025

Explain your issue

I've been troubleshooting why the Flags on the World Travel page would not load and show as "No image available"
During this, I found that changing Debug=True allows the Images to load, but as soon as it's back to False, they don't work.

This is the same for any images I upload. They will upload without a problem but only display when the server is Debug=True.

Visiting https://adventurelogapi.mydomain.com/media/flags/af.png results in a 404 Not found from nginx

I have Aventurelog exposed through a Cloudflare Tunnel
Front: adventurelog.mydomain.com
Back: adventurelogapi.mydomain.com

Provide an obfuscated docker-compose.yml

services:
web:
#build: ./frontend/
image: ghcr.io/seanmorley15/adventurelog-frontend:latest
container_name: adventurelog-frontend
restart: unless-stopped
environment:
- PUBLIC_SERVER_URL=http://server:8000 # Should be the service name of the backend with port 8000, even if you change the port in the backend service
- ORIGIN=https://adventurelog.mydomain.com
- BODY_SIZE_LIMIT=Infinity
ports:
- 8015:3000
depends_on:
- server

db:
image: postgis/postgis:15-3.3
container_name: adventurelog-db
restart: unless-stopped
environment:
POSTGRES_DB: adventurelog
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
volumes:
- /mnt/nvme/apps/docker/adventurelog/db:/var/lib/postgresql/data/

server:
#build: ./backend/
image: ghcr.io/seanmorley15/adventurelog-backend:latest
container_name: adventurelog-backend
restart: unless-stopped
environment:
- DISABLE_REGISTRATION=true
- PGHOST=db
- PGDATABASE=adventurelog
- PGUSER=user
- PGPASSWORD=pass
- SECRET_KEY=secret
- DJANGO_ADMIN_USERNAME=user
- DJANGO_ADMIN_PASSWORD=pass
- DJANGO_ADMIN_EMAIL=[email protected]
- PUBLIC_URL= https://adventurelogapi.mydomain.com # Match the outward port, used for the creation of image urls
- CSRF_TRUSTED_ORIGINS=http://localhost:8015,http://localhost:8016,https://adventurelog.mydomain.com,https://adventurelogapi.mydomain.com # Comma separated list of trusted origins for CSRF
- DEBUG=False
- FRONTEND_URL=https://adventurelog.mydomain.com # Used for email generation. This should be the url of the frontend
ports:
- 8016:80
depends_on:
- db
volumes:
- /mnt/nvme/apps/docker/adventurelog/media:/code/media/

Provide any necessary logs from the containers and browser

The logs don't show any issues but will paste them anyway.

Backend:

Starting nginx: nginx.
PostgreSQL is up - continuing...
Operations to perform:
Apply all migrations: account, admin, adventures, auth, authtoken, contenttypes, integrations, mfa, sessions, sites, socialaccount, users, worldtravel
Running migrations:
No migrations to apply.
Creating superuser...
Superuser already exists.
Latest country, region, and state data already downloaded.

DB:

PostgreSQL Database directory appears to contain a database; Skipping initialization
2025-03-23 06:22:37.115 UTC [1] LOG: starting PostgreSQL 15.4 (Debian 15.4-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2025-03-23 06:22:37.115 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-03-23 06:22:37.115 UTC [1] LOG: listening on IPv6 address "::", port 5432
2025-03-23 06:22:37.123 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-03-23 06:22:37.130 UTC [29] LOG: database system was shut down at 2025-03-23 06:22:06 UTC
2025-03-23 06:22:37.136 UTC [1] LOG: database system is ready to accept connections

Frontend:

The origin to be set is: https://adventurelog.mydomain.com

Listening on 0.0.0.0:3000

@Ryan24b Ryan24b added the deployment Issues related to deploying AdventureLog label Mar 23, 2025
@Ryan24b Ryan24b closed this as completed Mar 31, 2025
@filcuk
Copy link

filcuk commented Apr 12, 2025

I believe this is still true in the latest release. I receive 500 on images otherwise whilst everything else works.

@ivanvmoreno
Copy link

I can replicate this. Version v0.9.0, no images load on the browser unless running the backend container with the environment variable DEBUG=True.

@Ryan24b Ryan24b reopened this Apr 22, 2025
@Ryan24b
Copy link
Author

Ryan24b commented Apr 22, 2025

I didn't realise I had accidentally closed this. I've opened it again after confirming that the problem still exists.

I tried v0.8.0, and the problem existed there, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Issues related to deploying AdventureLog
Projects
None yet
Development

No branches or pull requests

3 participants