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

Error on RPi4: Cannot start openeats web, api and nginx #143

Closed
gennartan opened this issue Dec 28, 2020 · 20 comments
Closed

Error on RPi4: Cannot start openeats web, api and nginx #143

gennartan opened this issue Dec 28, 2020 · 20 comments

Comments

@gennartan
Copy link

The error in the logs:
standard_init_linux.go:219: exec user process caused: exec format error
I am using the default configuration for docker and I am running it on a RPi 4 with the new 64 bits rpi os (debian based)

@daBaret
Copy link

daBaret commented Dec 31, 2020

Hi,
the docker images will not work because it is built for amd64 and not for arm.
If you want to try, I've created multiarch images that should work. I'm using it on a RPI4. I've also updated few dependencies.

In your docker-prod.yml file change:

  • image: openeats/openeats-api
  • image: openeats/openeats-web
  • image: openeats/openeats-nginx

to:

  • image: starto96/openeats-api
  • image: starto96/openeats-web
  • image: starto96/openeats-nginx

For the database I'm using:

  • image: linuxserver/mariadb

Here the link to my repositories:
https://github.com/Starto96/openeats
https://github.com/Starto96/openeats-web
https://github.com/Starto96/openeats-api
https://github.com/Starto96/openeats-nginx

Have a nice day

@0utl4w
Copy link

0utl4w commented Mar 3, 2021

Hi Starto96,
I managed to install openeats with your modifications in combination with the install-guide from open-eats. I run it on an raspi 3b. I also managed to create a superuser and donwloaded and installed the examples. I took a look into the DB and it contains data.
I have two problems right now.

  1. the container openeats_web_1 always stopps
  2. I can enter the website with the browser, and I see some buttons and menus, but there is no content and I cannot login with the user I created before. (see screen).

You have any ideas, what went wrong?

Thx
2021-03-03 21_43_11-News _ Open Eats

@0utl4w
Copy link

0utl4w commented Mar 3, 2021

A small addition, when the container openeats_web_1 is running, I cannot enter the web-page. The error: 403 Forbidden
nginx/1.19.6 occurs.

@saucedge
Copy link

saucedge commented Mar 3, 2021

Crap, I wish I remembered the details, but I had the same issue a while back... apologies for not being more directly helpful. But as I recall, the transient behavior of the docker web container is normal--the fact that you're able to load the page confirms that. The part that's broken seems to be the API's ability to display data from the database in the web ui. Perhaps attach to the database container and check logs for permissions related issues? Or now that I think about it, maybe I solved the issue by spinning up my own Mariadb container and forcing OpenEats to use that?

@0utl4w
Copy link

0utl4w commented Mar 3, 2021

Here is an extrace of the log of the container openeats_api_1 (maybe that helps):

(mysql.W002) MariaDB Strict Mode is not set for database connection 'default'
� �
HINT: MariaDB's Strict Mode fixes many data integrity problems in MariaDB, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/3.1/ref/databases/#mysql-sql-mode

Operations to perform:

Apply all migrations: admin, auth, authtoken, contenttypes, ingredient, list, menu, news, rating, recipe, recipe_groups, sessions, sites

Running migrations:

No migrations to apply.

Your models have changes that are not yet reflected in a migration, and so won't be applied.

Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

0 static files copied to '/code/static-files', 170 unmodified.

@daBaret
Copy link

daBaret commented Mar 4, 2021

Hi, i can confirm what saucedge said. The openeats_web_1 just builds the website and then put it in the volume of the openeats_nginx_1 container.

I think i also had one time the same problem. Can you please show me what did you put in your en_prod.list file?

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

Have a look in the attachement. Thanks for your response.
env_prod.txt

@daBaret
Copy link

daBaret commented Mar 4, 2021

mmm... i know that you should not do this but try to set:
ALLOWED_HOST=*
It should work

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

No, it's not working. I deleted all the containers and set it up agauin from scratch, but no change. What happened is, that the openeats-DB is not created automatically, shouldn't it?

@daBaret
Copy link

daBaret commented Mar 4, 2021

I'm not sure if with mariadb is possible to create automatically the database. I've create by hand because i already had one running for also other applications.
What are the logs of the api container. Does it gives error that it cannot connect to the database? Are they still the same as the one you posted before?

The thing that there is no content at the beginning is normal, I think there is a way to put example recipes. Should be written somewhere in the documentation.

What does happen if you click on the Alle Rezepte durchsuchen? Does it load something or there is just a spinning wheel?

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

When I click there a loadihg circle appears and never stops.

Here the log of the api-container:
Operations to perform:

Apply all migrations: admin, auth, authtoken, contenttypes, ingredient, list, menu, news, rating, recipe, recipe_groups, sessions, sites

Running migrations:

No migrations to apply.

Your models have changes that are not yet reflected in a migration, and so won't be applied.

Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

0 static files copied to '/code/static-files', 170 unmodified.

Starting OpenEats as root

[2021-03-04 13:32:20 +0000] [10] [INFO] Starting gunicorn 20.0.4

[2021-03-04 13:32:20 +0000] [10] [INFO] Listening at: http://0.0.0.0:8000 (10)

[2021-03-04 13:32:20 +0000] [10] [INFO] Using worker: sync

[2021-03-04 13:32:20 +0000] [12] [INFO] Booting worker with pid: 12

[2021-03-04 13:32:20 +0000] [13] [INFO] Booting worker with pid: 13

[2021-03-04 13:32:20 +0000] [14] [INFO] Booting worker with pid: 14

[2021-03-04 13:32:20 +0000] [15] [INFO] Booting worker with pid: 15

[2021-03-04 13:32:20 +0000] [16] [INFO] Booting worker with pid: 16

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

this: "Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them." changes nothing

@daBaret
Copy link

daBaret commented Mar 4, 2021

Ok this means is actually all working beside the communication between the website and the api. Can you try to delete the NODE_API_URL=http://localhost from the env_prod.list?

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

Sure, you mean just remove the blue highlighted part? And then restart the api and nginx container?

@daBaret
Copy link

daBaret commented Mar 4, 2021

you can delete also the variable and then restart all the container

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

Sorry, but no changes

@daBaret
Copy link

daBaret commented Mar 4, 2021

mmm then i really don't know.
Could you check if the containers are all on the same network?
With docker network ls you can see all your network and the docker inspect network_name you can see all the container registered on that network.

You are using the docker-prod.yml file right?

@0utl4w
Copy link

0utl4w commented Mar 4, 2021

The containers are all in the same network:
grafik

And yes, I am using the docker-prod.yml file.

Anyways, thanks a lot for your help, I appreciate it.

@daBaret
Copy link

daBaret commented Mar 4, 2021

I'm sorry it didn't work. I just post here my settings of the env_prod.list and of my docker-prod.yml. I hope it can help you

env_prod.list

# Database config
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=******
MYSQL_USER=*******
MYSQL_HOST=mariadb
MYSQL_PORT=3306

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

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

docker-prod.yml

version: '2.3'
services:
  api:
    image: starto96/openeats-api
    command: /startup/prod-entrypoint.sh
    restart: always
    volumes:
      - static-files:/code/static-files
      - site-media:/code/site-media
    env_file:
      env_prod.list
  web:
    image: starto96/openeats-web
    command: yarn start
    depends_on:
      - api
    volumes:
      - public-ui:/code/build
    env_file:
      env_prod.list
  nginx_openeats:
    image: starto96/openeats-nginx
    container_name: nginx_openeats
    command: ./start.sh
    volumes:
      - static-files:/var/www/html/openeats-static/static-files
      - site-media:/var/www/html/openeats-static/site-media
      - public-ui:/var/www/html/openeats-static/public-ui
    depends_on:
      - api
      - web
    env_file:
      env_prod.list
    restart: always
volumes:
  database:
  public-ui:
  static-files:
  site-media:
networks:
          default:
                      external:
                                    name: dockers_default

The ****** is just because i didn't want to publish username, password and key ;)
Bye

@Drudoo
Copy link

Drudoo commented Jun 15, 2021

I know this issue is old, but i wanted to post my config that works on armv7 (Pi4).

I combined the prod docker-compose files into one. This is much easier in my opinion.

version: '2.3'
services:
  api:
    image: starto96/openeats-api
    restart: always
    command: /startup/prod-entrypoint.sh
    restart: on-failure
    volumes:
      - ${PWD}/static-files:/code/static-files
      - ${PWD}/site-media:/code/site-media
    depends_on:
      db:
        condition: service_healthy
    env_file:
      env_prod.list
  web:
    image: starto96/openeats-web
    command: yarn start
    restart: on-failure
    depends_on:
      - api
    volumes:
      - ${PWD}/public-ui:/code/build
    env_file:
      env_prod.list
  db:
    image: linuxserver/mariadb:latest
    restart: always
    volumes:
      - ${PWD}/db_config:/config
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 20s
      retries: 20
    env_file:
      env_prod.list
  nginx:
    image: starto96/openeats-nginx
    command: ./start.sh
    restart: always
    ports:
      - 1008:80
    volumes:
      - ${PWD}/static-files:/var/www/html/openeats-static/static-files
      - ${PWD}/site-media:/var/www/html/openeats-static/site-media
      - ${PWD}/public-ui:/var/www/html/openeats-static/public-ui
    depends_on:
      - api
      - web
    env_file:
      env_prod.list

As for my env file, i use:

# Database config
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=root

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

# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_API_URL=https://food.domain.com
NODE_LOCALE=en

I use an external reverse proxy to point my domain (https://food.domain.com) to 192.168.10.100:1008 where 192.168.10.100 is the IP of my Pi.

Then i spin up the containers using docker-compose up -d

Whenever the images are pulled and created i run:

$ docker exec -it openeats_db_1 /bin/sh
$ mysql -uroot -proot
$ CREATE DATABASE openeats; 
$ SHOW DATABASES; 
$ exit
$ exit

The mariadb container does not have the correct database, so i enter the container, logs in, creates the database and confirms the database has been created. Then i exit mysql and finally exit the container.

Next i want to setup the database schema:

$ docker exec -it openeats_api_1 /bin/sh
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py createsuperuser

And finally i start the containers again. This step might not be needed, but i wanted to recompile the static files to make sure:

docker-compose up -d

I checked this setup on two different hosts and confirmed that it works.

I hope this helps people that have issues with running openeats on arm.

@rustymyers rustymyers added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Jun 16, 2021
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

6 participants