seanmorley15 / AdventureLog

Self-hostable travel tracker and trip planner.
https://adventurelog.app
Other
393 stars 12 forks source link

Stuck on "Refreshing Token" #204

Closed NovaCyntax closed 4 weeks ago

NovaCyntax commented 4 weeks ago

Stuck on "Refreshing Token" upon trying to log in with default credentials. Below are my docker-compose.yml and nginx.conf files. I'm just trying to get the initial login to work. Some port values and directories might have changed, I'm not sure, I've been trying to fix this issue for a while so I've gone through a lot of iterations. Additionally, when failing to "sign up" (I don't even know if that's the initial step) through the web interface, I just receive an error message that says "G", as displayed in the image. Any help would be much appreciated because I've been looking for something like this for a long time.

image

docker-compose.yml

version: "3.9"

services:
  web:
    #build: ./frontend/
    image: ghcr.io/seanmorley15/adventurelog-frontend:latest
    environment:
      - PUBLIC_SERVER_URL=http://192.168.1.14:8567
      - ORIGIN=http://192.168.1.14:8097
      - BODY_SIZE_LIMIT=Infinity
    ports:
      - "8097:3000"
    depends_on:
      - server

  db:
    image: postgres:latest
    environment:
      POSTGRES_DB: database
      POSTGRES_USER: adventure
      POSTGRES_PASSWORD: changeme123
    volumes:
      - /home/nova/adventure-log/postgresql:/var/lib/postgresql/data/

  server:
    #build: ./backend/
    image: ghcr.io/seanmorley15/adventurelog-backend:latest
    environment:
      - PGHOST=db
      - PGDATABASE=database
      - PGUSER=adventure
      - PGPASSWORD=changeme123
      - SECRET_KEY=changeme123
      - DJANGO_ADMIN_USERNAME=admin
      - DJANGO_ADMIN_PASSWORD=admin
      - DJANGO_ADMIN_EMAIL=admin@example.com
      - PUBLIC_URL='http://127.0.0.1:81'
      - CSRF_TRUSTED_ORIGINS=http://192.168.1.14:8097,http://192.168.1.14:8567
      - DEBUG=False
      - FRONTEND_URL='http://192.168.1.14:8097'
    ports:
      - "8567:8000"
    depends_on:
      - db
    volumes:
      - /home/nova/adventure-log/media:/code/media/

  nginx:
    image: nginx:latest
    ports:
      - "81:80" # Using port 81 to avoid conflict with your existing setup
    volumes:
      - /home/nova/adventure-log/media:/app/media
      - /home/nova/adventure-log/proxy/nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - server

volumes:
  postgres_data:
  adventurelog_media:

nginx.conf

server {
    listen 80;
    server_name localhost;

    location /media/ {
        alias /app/media/;
    }
}

Example Log Messages

adventure-log-web-1 log:

Refreshing token

adventure-log-server-1 log:

[16/Aug/2024 03:59:39] "POST /auth/token/refresh/ HTTP/1.1" 200 291
Forbidden: /auth/user/
[16/Aug/2024 03:59:39] "GET /auth/user/ HTTP/1.1" 403 51
[16/Aug/2024 03:59:39] "GET /csrf/ HTTP/1.1" 200 81
Forbidden: /auth/login/
[16/Aug/2024 03:59:39] "POST /auth/login/ HTTP/1.1" 403 183
seanmorley15 commented 4 weeks ago

Hmm. I would make sure that your browser cache and cookies are clear to remove any old sessions. Also ensure you are accessing the frontend from http://192.168.1.14:8097. The issue that stands out as most likely is the PUBLIC_SERVER_URL - I would change it to http://server:8567 because this is the address that the SSR server on the backend connects to. Hope this helps, let me know if you have any other questions!

seanmorley15 commented 4 weeks ago

I think I found it :) Try setting: PUBLIC_SERVER_URL=http://server:8000 instead not http://server:8567 like i mentioned earlier

NovaCyntax commented 4 weeks ago

I think I found it :) Try setting: PUBLIC_SERVER_URL=http://server:8000 instead not http://server:8567 like i mentioned earlier

I managed to get it working, I think clearing browser cache and cookies did the trick. I also had to register for an account first as opposed to attempting to sign in with the credentials from the docker-compose. Upon registering, I was able to change the username/password from the web application frontend.

However, I'm now running into a couple different issues - "Wikipedia autofill" isn't working, and there are no images shown (national flags etc.). The zoom/pan of the world map works however. Would your suggested fix impact these issues? I'm a bit reluctant to change the docker-compose after finally getting in.

Note: I will also be providing my working docker-compose.yml here for anyone else experiencing these issues once I get everything sorted out.

seanmorley15 commented 4 weeks ago

Glad its working better. Regarding wikipedia autofill, it only works right now with exact names of articles or else it will do nothing, I will need to add some indication of it not finding an article. Regarding the national flags, a few minutes ago I released an update that will make new installations auto download the flags, assuming your database was created before this update you can manually trigger it. Commands found here. Thanks and keep me updated!

NovaCyntax commented 4 weeks ago

Glad its working better. Regarding wikipedia autofill, it only works right now with exact names of articles or else it will do nothing, I will need to add some indication of it not finding an article. Regarding the national flags, a few minutes ago I released an update that will make new installations auto download the flags, assuming your database was created before this update you can manually trigger it. Commands found here. Thanks and keep me updated!

Great stuff. I can confirm that the exact Wikipedia article name made it autofill the description. The image-pull for the location doesn't display an image, but I will wait until my system gets the latest update (not sure if it's available, it says I'm on the latest version) before diagnosing that further. I will open a new issue for that one if that's the case.

Thanks for the help, historical Github issues like this from other people on other projects have helped me a lot when diagnosing problems on my system, so hopefully you'll only see this issue once :)

seanmorley15 commented 4 weeks ago

Great! I'm sure others will find this thread useful in the future!