kizniche / ttn-tracker

Download GPS data transmitted to The Things Network for live display on a map
https://kylegabriel.com/projects/2019/04/lorawan-tracker-and-mapper.html
62 stars 17 forks source link

ngnix 502 Bad Gateway #11

Closed aberridg closed 3 years ago

aberridg commented 3 years ago

I'm really excited by the prospect of running this app! However, when following the instructions, I get a 502 bad gateway error on ngnix.

I'm using Raspbian 10 (buster)

Any thoughts as to what I might try?

N.b. I had to update the main Dockerfile to reference python3.6 or python3.7 to be able to build the docker image (as reported in another issue elsewhere). I tried python 3.6 and python 3.7 - same results.

Thanks!

kizniche commented 3 years ago

Fixed in latest commit.

Teku16 commented 2 years ago

I have the same issue after just following the posted instructions with a fresh install on a clean version of Raspberry Pi OS 11. NGINX 502 Bad Gateway

It appears that the ttn-tracker_flask_app container is restart-looping as running docker ps results in:

CONTAINER ID   IMAGE                   COMMAND                  CREATED          STATUS                        PORTS                                                                      NAMES
7571cf55d60d   ttn-tracker_nginx       "/docker-entrypoint.…"   14 minutes ago   Up About a minute             0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   nginx
4bba4ecc1ac3   ttn-tracker_flask_app   "gunicorn -w 1 --wor…"   14 minutes ago   Restarting (3) 1 second ago                                                                              flask_app
sjnaylor59 commented 1 year ago

I have the same issue with a fresh install of rpi OS 11. The log file shows the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
    super().init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/project/flask_app/app.py", line 8, in <module>
    from flask import Flask
  File "/usr/local/lib/python3.7/site-packages/flask/__init__.py", line 14, in <module>
    from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/usr/local/lib/python3.7/site-packages/jinja2/__init__.py)
sjnaylor59 commented 1 year ago

Fixed by updating requirements file: Flask == 2.1.0 see SO: https://stackoverflow.com/questions/71718167/importerror-cannot-import-name-escape-from-jinja2