open-eats / OpenEats

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

Website blank on fresh install #149

Closed 3riatarka closed 2 years ago

3riatarka commented 3 years ago

I'm not capable of bringing up the web UI.

The Django admin interface is working (and it shows the mockup recipes), but whenever I try to access the front page, the only thing the browser loads is the following code:

<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="description" content="The best recipes on the internet!"/><meta property="og:description" content="The best recipes on the internet!"/><meta property="og:title" content="OpenEats"/><meta property="og:image" content="/images/chef.png"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/images/favicon.ico"><link rel="icon" type="image/x-icon" href="/images/favicon.ico"><title>Open Eats</title><link href="/static/css/main.5db71e20.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="app"></div><script type="text/javascript" src="/static/js/main.d2bea86a.js"></script></body></html>

I modified the original docker-compose to fit my installation, but as far as I understand, it should be working by now. Here is my docker-compose:

version: '2.3'

services:
  api:
    image: openeats/openeats-api:latest
    command: /startup/prod-entrypoint.sh
    restart: on-failure
    container_name: openeats_api
    networks:
        private_lan:
            ipv4_address: 10.0.1.41
    volumes:
      - /<redacted>/static-files:/code/static-files
      - /<redacted>/site-media:/code/site-media
    depends_on:
      db:
        condition: service_healthy
    environment:
        - DJANGO_SECRET_KEY=<redacted>
        - HTTP_X_FORWARDED_PROTO=true
        - DATABASE_ENGINE=django.db.backends.mysql
        - MYSQL_DATABASE=openeats
        - MYSQL_USER=root
        - MYSQL_ROOT_PASSWORD=<redacted>
        - MYSQL_HOST=db
        - MYSQL_PORT=3306
        - MYSQL_TEST_DATABASE=test_openeats
        - DJANGO_DEBUG=False
        - API_URL=10.0.1.41:8000
        - API_PORT=8000
        - DJANGO_SETTINGS_MODULE=base.settings
        - ALLOWED_HOST=*

  web:
    image: openeats/openeats-web:latest
    command: yarn start
    container_name: openeats_web
    networks:
        private_lan:
            ipv4_address: 10.0.1.46
    volumes:
    depends_on:
      - api
    volumes:
      - /<redacted>/public-ui:/code/build
    environment:
        - HTTP_X_FORWARDED_PROTO=true
        - API_URL=10.0.1.41:8000
        - API_PORT=8000
        - ALLOWED_HOST=*

  db:
    image: mariadb:5.5.64
    container_name: openeats_db
    networks:
        private_lan:
            ipv4_address: 10.0.1.42
    volumes:
      - /<redacted>/database:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 20s
      retries: 20
    environment:
        - MYSQL_DATABASE=openeats
        - MYSQL_ROOT_PASSWORD=<redacted>

  nginx:
    image: openeats/openeats-nginx:latest
    container_name: openeats_nginx
    command: ./start.sh
    networks:
        private_lan:
            ipv4_address: 10.0.1.44
    volumes:
      - /<redacted>/static-files:/var/www/html/openeats-static/static-files
      - /<redacted>/site-media:/var/www/html/openeats-static/site-media
      - /<redacted>/openeats/public-ui:/var/www/html/openeats-static/public-ui
    depends_on:
      - api
      - web
    environment:
        - API_URL=10.0.1.41:8000
        - API_PORT=8000
        - DJANGO_SETTINGS_MODULE=base.settings
        - ALLOWED_HOST=*

networks:
    private_lan:
        external: true

Can anyone spot where the problem is? I've already checked the local folder binding and permissions, and they are exactly the same as other websites and containers that work perfectly fine.

Thank you all.

dlchamp commented 3 years ago

On first load it does take a while because it's building the tables inside the database.

I had a similar issue and thought it bugged so I restarted it. Turns out I corrupted the database by not letting it complete the first setup so I had to delete and rebuild the database. Give it about 5 minutes before trying to access anything after a fresh install.

3riatarka commented 2 years ago

Commenting with a dirty fix, just in case anyone is going through this.

Using the Firefox developer tools I checked the console, and there was a warning that 'process' variable was not defined.

I took a quick look at the source code, and noticed it was mainly used to set the locale in this line (index.js:35): const messages = require('./locale/'+process.env.NODE_LOCALE+'.json');

So, I went to the main..js in the Docker data directory and replaced the value that had the same content with a static route: '.locale/en.json'

Now the application loads and seems to work fine.