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

Newest docker update doesn't start #3099

Closed
marmata opened this issue Apr 7, 2024 · 11 comments
Closed

Newest docker update doesn't start #3099

marmata opened this issue Apr 7, 2024 · 11 comments

Comments

@marmata
Copy link

marmata commented Apr 7, 2024

Tandoor Version

1.5.16

Setup

Docker / Docker-Compose

Reverse Proxy

Caddy

Other

No response

Bug description

Since updating to 1.5.16 I only get 500 error when connecting to Tandoor. By looking at the logs it has probably been introduced by this commit. Any way to put the files back where they should be? Any command I can use inside the docker? Thanks!

Relevant logs

07/04/2024 19:14:06 Checking configuration...
07/04/2024 19:14:06 Waiting for database to be ready...
07/04/2024 19:14:06 Database is ready
07/04/2024 19:14:06 Migrating database
07/04/2024 19:14:06 DEPRECATION WARNING: Environment var "REVERSE_PROXY_AUTH" is deprecated. Please use "REMOTE_USER_AUTH".
07/04/2024 19:14:06 DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.
07/04/2024 19:14:08 Operations to perform:
07/04/2024 19:14:08   Apply all migrations: account, admin, auth, authtoken, contenttypes, cookbook, oauth2_provider, sessions, sites, socialaccount
07/04/2024 19:14:09 Running migrations:
07/04/2024 19:14:09   No migrations to apply.
07/04/2024 19:14:09 Copying cached static files from docker build
07/04/2024 19:14:09 mv: can't rename '/opt/recipes/staticfiles-collect/*': No such file or directory
07/04/2024 19:14:09 [2024-04-07 17:14:09 +0000] [1] [INFO] Starting gunicorn 21.2.0
07/04/2024 19:14:09 [2024-04-07 17:14:09 +0000] [1] [INFO] Listening at: http://[::]:8080 (1)
07/04/2024 19:14:09 [2024-04-07 17:14:09 +0000] [1] [INFO] Using worker: gthread
07/04/2024 19:14:09 [2024-04-07 17:14:09 +0000] [16] [INFO] Booting worker with pid: 16
07/04/2024 19:14:09 [2024-04-07 17:14:09 +0000] [17] [INFO] Booting worker with pid: 17
07/04/2024 19:14:09 [2024-04-07 17:14:09 +0000] [18] [INFO] Booting worker with pid: 18
07/04/2024 19:14:10 DEPRECATION WARNING: Environment var "REVERSE_PROXY_AUTH" is deprecated. Please use "REMOTE_USER_AUTH".
07/04/2024 19:14:10 DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.
07/04/2024 19:14:10 DEPRECATION WARNING: Environment var "REVERSE_PROXY_AUTH" is deprecated. Please use "REMOTE_USER_AUTH".
07/04/2024 19:14:10 DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.
07/04/2024 19:14:10 DEPRECATION WARNING: Environment var "REVERSE_PROXY_AUTH" is deprecated. Please use "REMOTE_USER_AUTH".
07/04/2024 19:14:10 DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.
07/04/2024 19:15:04 ERROR:django.request:Internal Server Error: /search/
07/04/2024 19:15:04 Traceback (most recent call last):
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
07/04/2024 19:15:04     response = get_response(request)
07/04/2024 19:15:04                ^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
07/04/2024 19:15:04     response = wrapped_callback(request, *callback_args, **callback_kwargs)
07/04/2024 19:15:04                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/cookbook/views/views.py", line 51, in search
07/04/2024 19:15:04     return render(request, 'search.html', {})
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/shortcuts.py", line 24, in render
07/04/2024 19:15:04     content = loader.render_to_string(template_name, context, request, using=using)
07/04/2024 19:15:04               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/loader.py", line 62, in render_to_string
07/04/2024 19:15:04     return template.render(context, request)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/backends/django.py", line 61, in render
07/04/2024 19:15:04     return self.template.render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 175, in render
07/04/2024 19:15:04     return self._render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/test/utils.py", line 112, in instrumented_test_render
07/04/2024 19:15:04     return self.nodelist.render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
07/04/2024 19:15:04     return SafeString("".join([node.render_annotated(context) for node in self]))
07/04/2024 19:15:04                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
07/04/2024 19:15:04     return self.render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 157, in render
07/04/2024 19:15:04     return compiled_parent._render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/test/utils.py", line 112, in instrumented_test_render
07/04/2024 19:15:04     return self.nodelist.render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
07/04/2024 19:15:04     return SafeString("".join([node.render_annotated(context) for node in self]))
07/04/2024 19:15:04                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
07/04/2024 19:15:04     return self.render(context)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/library.py", line 237, in render
07/04/2024 19:15:04     output = self.func(*resolved_args, **resolved_kwargs)
07/04/2024 19:15:04              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/cookbook/templatetags/theming_tags.py", line 13, in theme_values
07/04/2024 19:15:04     return get_theming_values(request)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/cookbook/templatetags/theming_tags.py", line 39, in get_theming_values
07/04/2024 19:15:04     'logo_color_32': static('assets/logo_color_32.png'),
07/04/2024 19:15:04                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/templatetags/static.py", line 179, in static
07/04/2024 19:15:04     return StaticNode.handle_simple(path)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/templatetags/static.py", line 129, in handle_simple
07/04/2024 19:15:04     return staticfiles_storage.url(path)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/staticfiles/storage.py", line 203, in url
07/04/2024 19:15:04     return self._url(self.stored_name, name, force)
07/04/2024 19:15:04            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/staticfiles/storage.py", line 182, in _url
07/04/2024 19:15:04     hashed_name = hashed_name_func(*args)
07/04/2024 19:15:04                   ^^^^^^^^^^^^^^^^^^^^^^^
07/04/2024 19:15:04   File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/staticfiles/storage.py", line 513, in stored_name
07/04/2024 19:15:04     raise ValueError(
07/04/2024 19:15:04 ValueError: Missing staticfiles manifest entry for 'assets/logo_color_32.png'
07/04/2024 19:15:04 ::ffff:172.21.0.4 - marmata [07/Apr/2024:19:15:04 +0200] "GET /search/ HTTP/1.0" 500 145 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
07/04/2024 19:15:04 ERROR:django.request:Internal Server Error: /favicon.ico
07/04/2024 19:15:04 ::ffff:172.21.0.4 - marmata [07/Apr/2024:19:15:04 +0200] "GET /favicon.ico HTTP/1.0" 500 145 "https://my.domain.tld/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
07/04/2024 19:15:06 ::ffff:172.21.0.4 - marmata [07/Apr/2024:19:15:06 +0200] "GET /service-worker.js HTTP/1.0" 200 39291 "https://my.domain.tld/service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
@jhuang0
Copy link

jhuang0 commented Apr 7, 2024

I've got the same issue.

1 similar comment
@casimpunkt
Copy link

I've got the same issue.

@smilerz
Copy link
Collaborator

smilerz commented Apr 7, 2024

It's not a general problem with the newest container. Mine works fine. image

Can you try deleting static files, stopping the container and restarting.

@jhuang0
Copy link

jhuang0 commented Apr 7, 2024

I mounted the following and then unmounted it:

  - /Tandoor/staticfiles-collect:/opt/recipes/staticfiles-collect

That seemed to clear out the issue. I'm guessing if I'd used console to login and clear the folder, it would have done the same.

@vabene1111
Copy link
Collaborator

I will revert the change befefore more people get affected, it's not really important, was just a nice to have

@tooboredtocode
Copy link
Contributor

Interesting, I can't seem to replicate the issue. @marmata @jhuang0 @casimpunkt, can one of you share your configuration files so I can try to replicate the issue and debug the problem?

@gjgress
Copy link

gjgress commented Apr 8, 2024

I am also having this issue on 1.5.17, interestingly enough. Not sure if I ever had 1.5.16 so it is unclear if it was a problem that persisted from 1.5.16 or that newly appeared with 1.5.17.

Note that I am running tandoor via DockSTARTer, with an Nginx setup.

docker-compose.yml

name: compose
services:
  tandoor:
    container_name: tandoor
    environment:
      ALLOWED_HOSTS: '*'
      DATABASE_URL: sqlite://localhost/data/db.sqlite3
      DEBUG: "0"
      GUNICORN_MEDIA: "1"
      SECRET_KEY: [secret key]
      TZ: Asia/Tokyo
    hostname: [hostname]
    image: docker.io/vabene1111/recipes:latest
    logging:
      driver: json-file
      options:
        max-file: "10"
        max-size: 200k
    networks:
      default: null
    ports:
      - mode: ingress
        target: 8080
        published: "8085"
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /etc/localtime
        target: /etc/localtime
        read_only: true
        bind:
          create_host_path: true
      - type: bind
        source: /home/[user]/.config/appdata/tandoor/staticfiles
        target: /opt/recipes/staticfiles
        bind:
          create_host_path: true
      - type: bind
        source: /home/[user]/.config/appdata/tandoor/mediafiles
        target: /opt/recipes/mediafiles
        bind:
          create_host_path: true
      - type: bind
        source: /home/[user]/.config/appdata/tandoor/data
        target: /opt/recipes/data
        bind:
          create_host_path: true
      - type: bind
        source: /home/[user]/storage
        target: /storage
        bind:
          create_host_path: true
  app:
    container_name: nginx-proxy-manager
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
      - ~/.config/appdata/tandoor/mediafiles:/media

.env

TANDOOR_ALLOWED_HOSTS='*'
TANDOOR_DATABASE_URL='sqlite://localhost/data/db.sqlite3'
TANDOOR_DEBUG='0'
TANDOOR_ENABLED='true'
TANDOOR_GUNICORN_MEDIA='1'
TANDOOR_NETWORK_MODE=''
TANDOOR_PORT_8080='8085'
TANDOOR_RESTART='unless-stopped'
TANDOOR_SECRET_KEY='[secret key]'
TANDOOR_TAG='latest'

Also, suggestions for a workaround would be greatly appreciated. At first I was happily tinkering away to find a solution, but it occurred to me that I don't have my database backed up properly and now I'm really nervous about losing my recipes. Can't test any backup solutions till I can get an instance running properly again.

@smilerz
Copy link
Collaborator

smilerz commented Apr 8, 2024

Also, suggestions for a workaround would be greatly appreciated. At first I was happily tinkering away to find a solution, but it occurred to me that I don't have my database backed up properly and now I'm really nervous about losing my recipes. Can't test any backup solutions till I can get an instance running properly again.

Try deleting the contents of staticfiles and restarting the container.

@marmata
Copy link
Author

marmata commented Apr 8, 2024

Interesting, I can't seem to replicate the issue. @marmata @jhuang0 @casimpunkt, can one of you share your configuration files so I can try to replicate the issue and debug the problem?

Sure, here's my docker compose:

services:
  db_recipes:
    restart: always
    image: postgres:15-alpine
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    env_file:
      - ./.env

  web_recipes:
    image: vabene1111/recipes
    restart: always
    env_file:
      - ./.env
    volumes:
      - staticfiles:/opt/recipes/staticfiles
      - nginx_config:/opt/recipes/nginx/conf.d
      - ./mediafiles:/opt/recipes/mediafiles
    depends_on:
      - db_recipes

  nginx_recipes:
    image: nginx:mainline-alpine
    restart: always
    ports:
      - 8079:80
    env_file:
      - ./.env
    depends_on:
      - web_recipes
    volumes:
      - nginx_config:/etc/nginx/conf.d:ro
      - staticfiles:/static
      - ./mediafiles:/media

volumes:
  nginx_config:
  staticfiles:

and my .env

DEBUG=0
ALLOWED_HOSTS=*
SECRET_KEY=secret
TIMEZONE=Europe/Rome
DB_ENGINE=django.db.backends.postgresql
POSTGRES_HOST=db_recipes
POSTGRES_PORT=5432
POSTGRES_USER=djangouser
POSTGRES_PASSWORD=password
POSTGRES_DB=djangodb
FRACTION_PREF_DEFAULT=0
COMMENT_PREF_DEFAULT=1
SHOPPING_MIN_AUTOSYNC_INTERVAL=5
GUNICORN_MEDIA=0
REVERSE_PROXY_AUTH=0

@gjgress
Copy link

gjgress commented Apr 8, 2024

Deleting the staticfiles folder seems to work. I have a feeling the only reason it didn't work for me on 1.5.17 was because updating the image didn't fix whatever was wrong with the staticfiles. Anyway, happy to provide any more information to help replicate the issue if possible.

@tooboredtocode
Copy link
Contributor

It appears that the root of the problem lies in Compose's behavior of reusing existing images, which have already moved the necessary files. Consequently, this prevents any further movement of files. While platforms like K8S generate containers from scratch, mitigating this issue, other platforms like Compose are affected.

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

No branches or pull requests

7 participants