Git Product home page Git Product logo

Comments (12)

RyanNoelk avatar RyanNoelk commented on July 20, 2024

My brain is a bit fryed, so I'll leave a quick response now and give a lot more details tomorrow.

  • Yes you should be using this repo. I created it so I could spin up separate repos for each piece of code (ui, api, nginx, etc...) as I add more features and to reduce confusion about cloning the old repo.

  • Whenever you try and run docker-compose be use to add the -f flag of (docker-compose -f docker-prod.yml). If you run docker-compose without this then docker will try and build images from your local file system and think you are using the dev version. (Thinking about this more now, I should probably remove that from this repo or at least make thedefault docker file a production ready copy.)

  • do you mind doing a docker ps to see what containers are running?

from openeats.

RyanNoelk avatar RyanNoelk commented on July 20, 2024

The API also doesn't have bash anymore (you'll need to use sh)
docker-compose -f docker-prod.yml run --rm api sh

I'll fix this in the docs tomorrow ^^

from openeats.

rustymyers avatar rustymyers commented on July 20, 2024

Here's the docker ps -a output for the relevant containers.

docker ps -a
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS                    PORTS                         NAMES
34d9b5f435fe        openeats/openeats-nginx    "./start.sh"             12 hours ago        Up 12 hours               80/tcp                        openeats_nginx_1
d792e753b8e4        openeats/openeats-web      "npm start"              12 hours ago        Up 12 hours                                             openeats_web_1
d2b7d7a4b088        openeats/openeats-api      "/startup/prod-ent..."   12 hours ago        Up 12 hours                                             openeats_api_1
3d7536988e3a        mariadb                    "docker-entrypoint..."   12 hours ago        Up 12 hours (healthy)     3306/tcp                      openeats_db_1

Thanks for the update on the bash to sh change. I was able to run the manage.py commands. Had a couple warnings but seems like it was successful.

./manage.py loaddata news_data.json
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1423: RuntimeWarning: DateTimeField News.pub_date received a naive datetime (2010-10-10 13:32:47) while time zone support is active.
  RuntimeWarning)
Installed 1 object(s) from 1 fixture(s)
/code # ./manage.py loaddata recipe_data.json
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1423: RuntimeWarning: DateTimeField Recipe.pub_date received a naive datetime (2011-05-21 07:35:32) while time zone support is active.
  RuntimeWarning)
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1423: RuntimeWarning: DateTimeField Recipe.update_date received a naive datetime (2011-05-21 07:35:32) while time zone support is active.
  RuntimeWarning)

from openeats.

RyanNoelk avatar RyanNoelk commented on July 20, 2024

So I went through the docs (with the few edits described above) to setup a new instance.

env_prod.list

# 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=localhost
HTTP_X_FORWARDED_PROTO=true

# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_PORT=8080
NODE_API_URL=http://localhost:7000
NODE_LOCALE=en

docker-prod.override.yml

version: '2.3'
services:
  nginx:
    ports:
      - "7000:80"

Command line steps

Last login: Mon Feb  5 16:09:35 on ttys003
$ cd code/OpenEats/
$ cp docs/samples/sample_docker_prod_override.yml docker-prod.override.yml
$ cp docs/samples/sample_env_file.list env_prod.list

// changed prod config here

$ ./quick-start.py
OpenEats quick setup script
==================
Downloading Images
==================
latest: Pulling from openeats/openeats-api
81033e7c1d6a: Already exists
9b61101706a6: Already exists
35b21c1a8b97: Already exists
4856f5aeeec4: Already exists
ce9545e7847c: Already exists
d80e481d51ac: Pull complete
323e818db968: Pull complete
a10b47587185: Pull complete
856a3a0ea4fa: Pull complete
b34e7bb85300: Pull complete
7983213fcba9: Pull complete
176f830e10c8: Pull complete
Digest: sha256:04198c7383dc94ab4058e600df3e7eb92808dff7c4148e5334bdbcc393c98f1c
Status: Downloaded newer image for openeats/openeats-api:latest
latest: Pulling from openeats/openeats-web
88286f41530e: Already exists
d0e8a23136b3: Already exists
5ad5b12a980e: Already exists
2242b3b62e20: Pull complete
b4893a8ec42b: Pull complete
1590df062bc4: Pull complete
Digest: sha256:7eb6e2bff808c777b9678122a3886a50a021bf7a2bdac0520db293a1b9e84a89
Status: Downloaded newer image for openeats/openeats-web:latest
latest: Pulling from openeats/openeats-nginx
550fe1bea624: Pull complete
d421ba34525b: Pull complete
fdcbcb327323: Pull complete
bfbcec2fc4d5: Pull complete
f4e477831a50: Pull complete
78eb27264cdb: Pull complete
9860c8d10396: Pull complete
363d5e15560b: Pull complete
Digest: sha256:d4d6a1a981bb132b82ad8bf2dcfce02d310986a65aaad80b856249a4e07753db
Status: Downloaded newer image for openeats/openeats-nginx:latest
==================
Starting OpenEats
==================
Creating the DB. This may take a minute...
Creating network "openeats_default" with the default driver
Creating openeats_api_1   ... done
openeats_db_1 is up-to-date
Creating openeats_web_1   ... done
Creating openeats_web_1   ...
Creating openeats_nginx_1 ... done
App started. Please wait ~30 seconds for the containers to come online.



$ docker ps
CONTAINER ID        IMAGE                            COMMAND                  CREATED              STATUS                        PORTS                NAMES
a1370569611f        openeats/openeats-nginx:latest   "./start.sh"             12 seconds ago       Up 11 seconds                 0.0.0.0:80->80/tcp   openeats_nginx_1
11e1a75402f9        openeats/openeats-web:latest     "npm start"              13 seconds ago       Up 12 seconds                                      openeats_web_1
266b56e00951        openeats/openeats-api:latest     "/startup/prod-entry…"   14 seconds ago       Up 13 seconds                                      openeats_api_1
2ec095a2afd6        mariadb                          "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   3306/tcp             openeats_db_1


$ docker-compose -f docker-prod.yml run --rm --entrypoint 'python manage.py createsuperuser' api
Starting openeats_db_1 ... done
Username (leave blank to use 'root'): ryan
Email address:
Password:
Password (again):
Superuser created successfully.

$ docker-compose -f docker-prod.yml run --rm api sh
Starting openeats_db_1 ... done
/code # ./manage.py loaddata course_data.json
Installed 4 object(s) from 1 fixture(s)
/code # ./manage.py loaddata cuisine_data.json
Installed 9 object(s) from 1 fixture(s)
/code # ./manage.py loaddata news_data.json
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1423: RuntimeWarning: DateTimeField News.pub_date received a naive datetime (2010-10-10 13:32:47) while time zone support is active.
  RuntimeWarning)
Installed 1 object(s) from 1 fixture(s)
/code # ./manage.py loaddata recipe_data.json
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1423: RuntimeWarning: DateTimeField Recipe.pub_date received a naive datetime (2011-05-21 07:35:32) while time zone support is active.
  RuntimeWarning)
/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py:1423: RuntimeWarning: DateTimeField Recipe.update_date received a naive datetime (2011-05-21 07:35:32) while time zone support is active.
  RuntimeWarning)
Installed 31 object(s) from 1 fixture(s)
/code # ./manage.py loaddata ing_data.json
Installed 15 object(s) from 1 fixture(s)
/code # exit

This all worked for me. Hitting localhost:7000 gives me the UI with the correct api results. Through here are a few notes:

  • I wasn't using a domain name for this, just my localhost.
  • The env file:
    • The secrets and passwords are not changed from the examples (you should ofc change these).
    • NODE_API_URL=http://localhost:7000 - This needs to be what the UI needs to call to get to the UI from your browser. There are rules in the nginx config that will route this to the api when calling /api. So if your UI is served from http://my.domain.com/the/super/path, then thats what this value should be.

from openeats.

RyanNoelk avatar RyanNoelk commented on July 20, 2024

Now on to your specific config.

  • First you won't be able to call the api directly because the ports are not exposed in production. Meaning the only way to get to the api is via the nginx proxy. So if you are trying to see if the api is working try http://10.0.1.10:7000/admin
  • Second NODE_API_URL=http://myers.isa-geek.org looks like it needs to be changed to NODE_API_URL=http://myers.isa-geek.org/openeats. If your domain is routing everything through /openeats, then the api needs to be called from that. The way you currently have it, the UI will try and call the api at http://myers.isa-geek.org/api/... when it should be calling via http://myers.isa-geek.org/openeats/api/...
  • Third, once you get the UI and API to work, there might be some issues with routing due to the UI routing on the base domain. There are some sections in the UI code that will try and do a redirect to, for example, /browse/. This will lead to http://myers.isa-geek.org/openeats/news/ -> http://myers.isa-geek.org/browse/. But we can address this issue once everything else is working.

Hope this helps!

from openeats.

rustymyers avatar rustymyers commented on July 20, 2024

Ok, I was able to get it working using localhost following the setup guide. I can reach the site using localhost:7000 and the api admin using localhost:7000/admin. Visiting http://10.0.1.10:7000 loads the web files but does not load any recipes and http://10.0.1.10:7000/admin returns a Bad Request (400).

I'm unable to get it to work using NODE_API_URL=https://myers.isa-geek.org/openeats (I forgot it should be https).

I've got env_prod.list set to the following:

# 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=localhost
HTTP_X_FORWARDED_PROTO=true

# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_PORT=8080
NODE_API_URL=https://myers.isa-geek.org/openeats
NODE_LOCALE=en

When I visit the page I get an error GET https://myers.isa-geek.org/bundle.js net::ERR_ABORTED myers.isa-geek.org/:22. It seems to be looking for the <!-- Core JS Bundle --> but can't find it?

EDIT: I should also mention that my nginx proxy is now pointing to localhost:7000:

location /openeats/ {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_pass http://localhost:7000;
        }

from openeats.

RyanNoelk avatar RyanNoelk commented on July 20, 2024

The reason your domain isn't working is because the index is trying to get the bundle from /bundle.js not /openeats/bundle.js. I'm looking at the code now to see what it takes to change this. See: https://github.com/open-eats/openeats-web/blob/master/public/index.html#L22

Getting the IP working, you might need to add that to the allowed hosts. Right now I only have it able to accept one host. That can easily be changed here. For now go ahead and try: ALLOWED_HOST=10.0.1.10.

from openeats.

rustymyers avatar rustymyers commented on July 20, 2024

Thanks for looking into this. I was able to update the env_prod.list to allow access over the IP address by using:
ALLOWED_HOST=10.0.1.10
NODE_API_URL=http://10.0.1.10:7000

from openeats.

RyanNoelk avatar RyanNoelk commented on July 20, 2024

I fixed the issue with multiple allowed hosts here: open-eats/openeats-api#1

It's basically the same, but if there is a comma, it will treat it like a new host. IE, 1.2.3.4,5.6.7.8

from openeats.

ajh13 avatar ajh13 commented on July 20, 2024
# 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=localhost
HTTP_X_FORWARDED_PROTO=true

# Node config
NODE_ENV=production
NODE_URL=localhost:8080
NODE_API_URL=http://localhost:8000
NODE_LOCALE=en

I am getting this error message from my db container:
9:06:28 35 [Warning] Access denied for user 'root'@'localhost' (using password: NO)

Not sure how to fix it, I tried the steps in this thread.

from openeats.

RyanNoelk avatar RyanNoelk commented on July 20, 2024

That message is is a dead lead. Meaning that it doesn't mean anything. I need to remove it.

This thread is quite old so some things in here may not work as described anymore.

What specifically isn't working for you?

  • Are you trying to run this in prod or dev mode? Looks like dev based on ur config file
  • If you are using prod what's in your docker-prod.override.yml

from openeats.

wattsra avatar wattsra commented on July 20, 2024

Sorry to open this thread up again. I am struggling to get my server working on the LAN. I am sure it must be something to do with the API URL. but can't fathom what is wrong. I will paste my current env_prod.list below.

The default set-up worked fine, but I am trying to set it up with LAN access. With this below set-up I am able to access the home page which renders, but no data is pulled in. Also when I try to go to http://192.168.1.143:8000/admin/ I get a "Bad Request (400)".

# Database config
MYSQL_DATABASE=openeats
MYSQL_ROOT_PASSWORD=##REMOVEDPASS##

# 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=192.168.1.x
HTTP_X_FORWARDED_PROTO=true

# Node config
NODE_ENV=production
NODE_URL=192.168.1.x:8080
NODE_API_URL=http://192.168.1.x:8000
NODE_LOCALE=en

Any help would be greatly appreciated.

from openeats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.