Open phantomdez opened 4 years ago
Sorry to see you are having problems. Can you answer two quick questions for me:
Thanks for the quick response.
Yes the UI appears. However I am not sure if all components load. I ran the commands to load some test data and none of it seems accessible. The page appears to have completed loading and when I press browse all recipes I have a circle that rotates continuously and doesn't ever stop. When I go to the login and enter my information it just sits there as if I never pressed the login button.
No I am using the URL openeats.mydomain.com [where mydomain.com is my domain name]. I have double checked that my env_prod.list has the URL for NODE_API_URL and ALLOWED_HOST
So I was looking into previous issues to see if I could find what I was experiencing and it seems that one of the containers isn't loading [or is crashing]. When I run docker ps I get the following output:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
31b5299e01ff openeats/openeats-nginx:latest "./start.sh" 21 minutes ago Up 21 minutes 0.0.0.0:8000->80/tcp openeats_nginx_1
5be5aa8f2d4b openeats/openeats-api:latest "/startup/prod-entry…" 21 minutes ago Up 21 minutes openeats_api_1
00bf9f7ec56b mariadb:5.5.64 "docker-entrypoint.s…" 21 minutes ago Up 21 minutes (healthy) 3306/tcp openeats_db_1
I seem to be missing the openeats-web component. I re-ran quick-start.py and I see it started but shortly thereafter it was gone again. Not sure where to look for where the issue is so any guidance would be appreciated.
Thanks
That's correct. The Ui container is just there to build the Ui files and then the nginx server serves them. This very much seems like an allowed hosts issue. Meaning that the the web app is not allowing requests from the UI.
Double check that ALLOWED_HOST=openeats.mydomain.com
and if you are using HTTPS, HTTP_X_FORWARDED_PROTO=true
.
you can also try setting ALLOWED_HOST=*
and see if that works
Yes I validated both and just tried again to make sure I didn't miss anything.
# Django config
API_URL=0.0.0.0:8000
API_PORT=8000
DJANGO_SECRET_KEY=<REMOVED>
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_PORT=8080
NODE_API_URL=http://openeats.my-domain.com
NODE_LOCALE=en
I have set HTTP_X_FORWARDED_PROTO to false as a test but that had the same results. The openeats-web component seems to crash as soon as I try to login or when I press browse all recipes. I installed using the docker method and changed it back to true based on the documentation reccommending it be true for the docker install.
Right now I am accessing via Http://openeats.my-domain.com:8000/
I just run into the same problem today. After a fresh install dummy recipes not showed up, and login didn't work. Everything seems fine, neither of the containers show errors, and manually checking the database show everything is ok.
In my case the problem was CORS blockage. I set up everything correctly in the env file, but CORS requests just do not get allowed. If you try to reach the site from the same machine that you run it from, than check the browser's console if block messages shows up (or simply try to log in from a different machine, if it works, than it's CORS blockage).
Possibly related: #109
@phantomdez @danielbene I just finished a pull to update the Running Without Docker markdown contents, this sounds like your database isn't getting seeded right. Check the new steps and see if that works for you.
My Previous install was via Docker so I didn't follow the Markdown instructions but was recieving that error. I tried to install without docker and I get stuck on the install dependencies as it keeps giving me errors. Going to have to retry another time but right now this has been a frustrating experience to get the app working.
Further investigation into my docker instances shows that openeats-web:latest keeps stopping but I cannot seem to understand why or how to fix it.
f3dfeabda8bd openeats/openeats-nginx:latest "./start.sh" 34 hours ago Up 34 hours 0.0.0.0:8000->80/tcp openeats_nginx_1
e3519a392f25 openeats/openeats-web:latest "yarn start" 34 hours ago Exited (0) 8 minutes ago openeats_web_1
2ce3b691776a openeats/openeats-api:latest "/startup/prod-entry…" 34 hours ago Up 34 hours openeats_api_1
bd5e95bea3ea mariadb:5.5.64 "docker-entrypoint.s…" 34 hours ago Up 34 hours (healthy) 3306/tcp openeats_db_1
I'm not sure if your problem is the same as mine, but in my case the fact that the docs claim that nginx 'will run on port 80' despite it actually being forwarded to port 8000 on the host, and the fact that NODE_API_URL actually requires the port to be specified in order to avoid CORS issues caused some confusion during the install process.
I've submitted a PR to hopefully clarify this a bit.
I have the same problem defined here by @phantomdez. Fresh install, db is populated, but the API doesn't appear to be talking to the db. Checking the db, the account doesn't have a last login stamp. I also have the following errors in the console:
/api/v1/recipe/recipes/?fields=id,slug,title,pub_date,rating,photo_thumbnail,info&limit=12:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
client.js:621 Uncaught (in promise) Error: Request has been terminated
Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.
at u.crossDomainError (client.js:621)
at XMLHttpRequest.t.onreadystatechange (client.js:703)
/api/v1/recipe_groups/course-count/:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
/api/v1/recipe_groups/cuisine-count/:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
/api/v1/rating/rating-count/:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
This looks like CORS to me. Can anyone confirm?
@danielbene After confirming CORS, how did you fix it?
@adaptiman I was unable to solve this issue by configuration, and I gave up after many attempts. The only thing that works for me is avoiding CORS situations completely by separating the host and client machines. (e.g. openeats runs on my homelab machine, and the things in the same LAN can use it without problems)
@phantomdez The web container is only generating static content. When its work finishes its stops itself. This behavior is the expected.
I have encountered CORS errors in the following situations:
Here is my working config file, maybe you will find something useful in it?
# Database config
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=root
# Django config
API_URL=0.0.0.0:8000
API_PORT=8000
DJANGO_SECRET_KEY=sdfsadfas32e98zsdvhhsnz6udvbksjdhfi4galshjfg
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=False
ALLOWED_HOST=openeats.lan
HTTP_X_FORWARDED_PROTO=true
# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_API_URL=http://openeats.lan:8000
NODE_LOCALE=en
Having an app whose host can only run on the same network as the client defeats the purpose of a Web-enabled program. You might as well be running a thick client app locally. The reason this particular project is better than the other open source recipe projects is because it runs (or rather ran) on the Web. I suggest that this CORS issue is a "show stopper" and needs to get sorted out, otherwise, this project is dead. I'm not trying to complain - just stating the facts. I will continue to see if I can get it working. Perhaps an earlier version of Django?
@adaptiman No. CORS only affect local environments, when the server, and the client uses the same IP. It has nothing to do with your scenario, webhosting should work fine. If you get the above error when trying to use webhosted openeats, than probably your config is incorrect. Please do some research before these kind of comments.
Not the same access scenario as the others mentioned here but when I set up OpenEats with Docker yesterday I also couldn't log in and noticed it was a CORS issue when looking at the console.
I have a docker VM running on a XenServer and am accessing OpenEats from my desktop. It's all on LAN. I'm only using OpenEats internally.
Thank you @KinRyuuu your configuration helped me find my problem. I realized you have to put a port on the NODE_API_URL that matches the port in API_URL. Here's my configuration in case it helps others. 192.168.1.157 is the address of the VM.
Disclosure: after avoiding Docker for years I finally installed it for this project and just jumped in without reading much Docker documentation.
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=root
# Django config
API_URL=0.0.0.0:8000
API_PORT=8000
DJANGO_SECRET_KEY=SECRET_KEY
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=False
ALLOWED_HOST=192.168.1.157
HTTP_X_FORWARDED_PROTO=true
# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_API_URL=http://192.168.1.157:8000
NODE_LOCALE=en
Also having the same issue. I get to the webpage, some things load, doesn't look like everything does because the web console outputs errors. When I attempt to login I get a CORS error in the web console and nothing appears to happen.
# Database config
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=<redacted>
# Django config
API_URL=0.0.0.0:8000
API_PORT=8000
DJANGO_SECRET_KEY=sdfsadfas32e98zsdvhhsnz6udvbksjdhfi4galshjfg
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=False
ALLOWED_HOST=freenas-docker.lan
HTTP_X_FORWARDED_PROTO=true
# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_API_URL=http://freenas-docker.lan:8000
NODE_LOCALE=en
Hi @FlexibleToast , the only difference between your configuration and mine is that I have an IP address for allowed host versus your URL, same with the NODE_API_URL.
@mgriessler correct, and I tried it both ways.
I had an issue where none of the recipes would show up and I couldn't log in. Adding an entry to the /etc/hosts and setting the NODE_API_URL to be whatever name you use to access the website worked for me. For example, if you're running the default docker prod install with an nginx proxy, you'd add an entry to the hosts (192.168.1.10 openeats.local) or a DNS A or CName (if you run a DNS server) and set the node api url to http://openeats.local:8000 . I feel the default env_list should be changed to reference port 8000 if the default install runs on port 8000.
So I am new to this application and did a clean install twice and I can't seem to get through the login.
First off I cannot seem to get the nginx proxy config to work even though I left the defaults in the config file. It doesn't seem to start. I am able to access via port 8000 which is good but when I supply my credentials that I created as per the documentation it doesn't do anything but sit there. I dont get a login error message or anything. If I try to login with the /admin then I am able to get into the Django interface.
Am I missing a step? I cannot seem to figure out where I went wrong.