Skip to content
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

Stuck on first restart #352

Open
ilgigante77 opened this issue Oct 25, 2024 · 0 comments
Open

Stuck on first restart #352

ilgigante77 opened this issue Oct 25, 2024 · 0 comments
Labels
deployment Issues related to deploying AdventureLog

Comments

@ilgigante77
Copy link

Describe the bug
The server is struck in the middle of the first restart

To Reproduce
Made a clean install, logged in, then stopped, changed the public url and restarted

Expected behavior
Should startup regularly

Docker Compose
FIRST RUN

services:
  web:
    #build: ./frontend/
    image: ghcr.io/seanmorley15/adventurelog-frontend:latest
    container_name: adventurelog-frontend
    restart: always
    environment:
      - PUBLIC_SERVER_URL=http://server:8000 # MOST DOCKER USERS WILL NEVER NEED TO CHANGE THIS, EVEN IF YOU CHANGE THE PORTS
      - ORIGIN=http://xxxxxxx:9080
      - BODY_SIZE_LIMIT=Infinity # This is measured in bytes
    ports:
      - "9080:3000"
    depends_on:
      - server
    healthcheck:
      test: "wget --no-verbose --tries=1 --spider http://127.0.0.1:3000 || exit 1"
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 10s

  db:
    image: postgis/postgis:15-3.3
    container_name: adventurelog-db
    restart: always
    environment:
      POSTGRES_DB: database
      POSTGRES_USER: adventure
      POSTGRES_PASSWORD: *****
    ports:
      - "9083:5432"
    volumes:
      - /srv/adventure/data:/var/lib/postgresql/data/
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  server:
    #build: ./backend/
    image: ghcr.io/seanmorley15/adventurelog-backend:latest
    container_name: adventurelog-backend
    restart: always
    environment:
      - PGHOST=db
      - PGDATABASE=database
      - PGUSER=adventure
      - PGPASSWORD=***** # This should be the same as the POSTGRES_PASSWORD in the db service
      - SECRET_KEY=*****
      - DJANGO_ADMIN_USERNAME=admin
      - DJANGO_ADMIN_PASSWORD=*****
      - DJANGO_ADMIN_EMAIL=**************
      - PUBLIC_URL='http://<server-ip>:9082' # NOTE: THIS IS THE PUBLIC URL TO THE **NGINX** SERVER USED FOR MEDIA FILES!
      - CSRF_TRUSTED_ORIGINS=http://<server-ip> # This is a comma separated list of trusted origins for CSRF, this should include where your frontend is hosted.
      - DEBUG=True
      - FRONTEND_URL='http://xxxxxxx:9080' # This is the URL of the frontend server
      - DISABLE_REGISTRATION=False
    ports:
      - "9081:8000"
    depends_on:
      - db
    volumes:
      - /srv/adventure/media:/code/media/
    healthcheck:
      test: "bash -c 'echo -n > /dev/tcp/127.0.0.1/8000'"
      interval: 1m30s
      timeout: 5s
      retries: 3
      start_period: 5m

  nginx:
    image: nginx:latest
    container_name: adventurelog-nginx
    restart: always
    ports:
      - "9082:80"
    volumes:
      - /srv/adventure/media:/app/media
      - /srv/adventure/proxy/nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - server
    healthcheck:
      test: "curl -k --fail http://127.0.0.1:80/media/images/test.webp || exit 1"
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 5s

SECOND RUN

services:
  web:
    #build: ./frontend/
    image: ghcr.io/seanmorley15/adventurelog-frontend:latest
    container_name: adventurelog-frontend
    restart: always
    environment:
      - PUBLIC_SERVER_URL=http://server:8000 # MOST DOCKER USERS WILL NEVER NEED TO CHANGE THIS, EVEN IF YOU CHANGE THE PORTS
      - ORIGIN=https://yyyyyyyyy.local
      - BODY_SIZE_LIMIT=Infinity # This is measured in bytes
    ports:
      - "9080:3000"
    depends_on:
      - server
    healthcheck:
      test: "wget --no-verbose --tries=1 --spider http://127.0.0.1:3000 || exit 1"
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 10s

  db:
    image: postgis/postgis:15-3.3
    container_name: adventurelog-db
    restart: always
    environment:
      POSTGRES_DB: database
      POSTGRES_USER: adventure
      POSTGRES_PASSWORD: *****
    ports:
      - "9083:5432"
    volumes:
      - /srv/adventure/data:/var/lib/postgresql/data/
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  server:
    #build: ./backend/
    image: ghcr.io/seanmorley15/adventurelog-backend:latest
    container_name: adventurelog-backend
    restart: always
    environment:
      - PGHOST=db
      - PGDATABASE=database
      - PGUSER=adventure
      - PGPASSWORD=***** # This should be the same as the POSTGRES_PASSWORD in the db service
      - SECRET_KEY=*****
      - DJANGO_ADMIN_USERNAME=admin
      - DJANGO_ADMIN_PASSWORD=*****
      - DJANGO_ADMIN_EMAIL=**************
      - PUBLIC_URL='http://<server-ip>:9082' # NOTE: THIS IS THE PUBLIC URL TO THE **NGINX** SERVER USED FOR MEDIA FILES!
      - CSRF_TRUSTED_ORIGINS=http://<server-ip> # This is a comma separated list of trusted origins for CSRF, this should include where your frontend is hosted.
      - DEBUG=True
      - FRONTEND_URL='https://yyyyyyyyy.local' # This is the URL of the frontend server
      - DISABLE_REGISTRATION=False
    ports:
      - "9081:8000"
    depends_on:
      - db
    volumes:
      - /srv/adventure/media:/code/media/
    healthcheck:
      test: "bash -c 'echo -n > /dev/tcp/127.0.0.1/8000'"
      interval: 1m30s
      timeout: 5s
      retries: 3
      start_period: 5m

  nginx:
    image: nginx:latest
    container_name: adventurelog-nginx
    restart: always
    ports:
      - "9082:80"
    volumes:
      - /srv/adventure/media:/app/media
      - /srv/adventure/proxy/nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - server
    healthcheck:
      test: "curl -k --fail http://127.0.0.1:80/media/images/test.webp || exit 1"
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 5s

Additional context
Logs:

FIRST RUN (time: 5 m,inutes)

[...]
Country Zimbabwe prepared
State ZW-BU prepared
State ZW-HA prepared
State ZW-MA prepared
State ZW-MC prepared
State ZW-ME prepared
State ZW-MW prepared
State ZW-MV prepared
State ZW-MN prepared
State ZW-MS prepared
State ZW-MI prepared
All data imported successfully
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
October 25, 2024 - 13:57:24
Django version 5.0.8, using settings 'main.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

SECOND RUN (time: infinite)

[...]
Country Zimbabwe prepared
State ZW-BU prepared
State ZW-HA prepared
State ZW-MA prepared
State ZW-MC prepared
State ZW-ME prepared
State ZW-MW prepared
State ZW-MV prepared
State ZW-MN prepared
State ZW-MS prepared
State ZW-MI prepared
@ilgigante77 ilgigante77 added the bug Something isn't working label Oct 25, 2024
@seanmorley15 seanmorley15 added deployment Issues related to deploying AdventureLog and removed bug Something isn't working labels Nov 18, 2024
@seanmorley15 seanmorley15 changed the title [BUG] Struck on first restart Stuck on first restart Nov 18, 2024
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

2 participants