open-eats / OpenEats

:pizza: Self Hosted Recipe Management App :hamburger:
https://open-eats.github.io/
MIT License
669 stars 102 forks source link

images: 500 Internal Server Error #138

Closed Slinky-Wrangle-Punch closed 3 years ago

Slinky-Wrangle-Punch commented 3 years ago

I'm using the docker version. Everything is working, BUT:

The custom food images aren't loading. Even in the admin page I get an "500 Internal Server Error" if I want to open the image directly (e.g. with the path /site-media/upload/recipe_photos/example-image.png)

Did I get some settings wrong or this a bug?

my env_prod.list:

# Database config
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=***pwd***

# Django config
API_URL=0.0.0.0:8000
API_PORT=8000
DJANGO_SECRET_KEY=**key**
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=False
ALLOWED_HOST=*
HTTP_X_FORWARDED_PROTO=true

# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_LOCALE=de

my docker-prod.override.yml:

version: '2.3'
services:
  nginx:
    restart: always
    ports:
      - "7000:80" 
  api:
    restart: always
  web:
    restart: on-failure
  db:
    restart: always
Slinky-Wrangle-Punch commented 3 years ago

okay... I continued today with some more error debugging. It seems like the error occurs after I restore some images with the code from the docu:

docker cp /dir/on/local/system/site-media/. openeats_api_1:/code/site-media/

The problem was that the permissions weren't correct inside of the docker. I fixed it inside of the docker:

first opened the docker with: docker-compose -f docker-prod.yml run --rm --entrypoint 'sh' api

Then changed the permissions:

chmod -R 755 /code/site-media/