chiefwigms / picobrew_pico

MIT License
149 stars 63 forks source link

nginx/1.14.2 502 Bad Gateway #286

Closed Rudder2 closed 3 years ago

Rudder2 commented 3 years ago

I haven't turned on my Z or PI for a while as I'm having trouble getting ingredients. I need to find an online suppler because my local brew supplier is flaking out. This weekend I'm going to try to order from https://www.austinhomebrew.com/. All on-line sources are double what my local supplier was so it hurts my sole to order from them.

I booted the PI to have a 502 Bad Gateway nginx/1.14.2 error when I try to access the PI from my computer. Here is my status:

pi@raspberrypi:~ $ systemctl status rc.local ● rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled) Drop-In: /usr/lib/systemd/system/rc-local.service.d └─debian.conf /etc/systemd/system/rc-local.service.d └─ttyoutput.conf Active: active (exited) since Fri 2021-04-16 14:18:16 EDT; 8min ago Docs: man:systemd-rc-local-generator(8) Process: 271 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

Apr 16 14:17:47 raspberrypi rc.local[271]: app/main/session_parser.py Apr 16 14:17:47 raspberrypi rc.local[271]: app/static/support/tilt/tilt.md Apr 16 14:17:47 raspberrypi rc.local[271]: app/templates/index.html Apr 16 14:17:47 raspberrypi rc.local[271]: Please commit your changes or stash them before you merge. Apr 16 14:17:47 raspberrypi rc.local[271]: Aborting Apr 16 14:18:16 raspberrypi systemd[1]: Started /etc/rc.local Compatibility. Apr 16 14:18:17 raspberrypi rc.local[271]: Traceback (most recent call last): Apr 16 14:18:17 raspberrypi rc.local[271]: File "server.py", line 1, in Apr 16 14:18:17 raspberrypi rc.local[271]: from app import create_app, socketio Apr 16 14:18:17 raspberrypi rc.local[271]: ImportError: cannot import name 'create_app' from 'app' (/picobrew_pico/app/init.py)

Thank you in advance for your help.

tmack8001 commented 3 years ago

@Rudder2 looks like you have a few files that are in conflict with your associated git remote repo.

Could you please resolve those conflicts and see if the error persists?

FYI which git sha are you on? git status and git rev-parse HEAD

Rudder2 commented 3 years ago

@tmack8001 Could this be because we manually downgraded my repo to get my Z brewing again?

tmack8001 commented 3 years ago

Maybe, though don't see why that would relate to throwing an exception occurring while importing a known method in the app/init.py file

Apr 16 14:18:17 raspberrypi rc.local[271]: ImportError: cannot import name 'create_app' from 'app' (/picobrew_pico/app/init.py)
sickchilly commented 3 years ago

FYI, if I update to 81031f3, I also get a nginx 502 error and can't access the server. Reverting to a5cd339 restores things. However, I'm not seeing any obvious reason for it in the logs. Did anything change with the nginx configuration?

tmack8001 commented 3 years ago

Hrm, nginx config hasn't changed programmatically yet. I'm looking to do this in https://github.com/chiefwigms/picobrew_pico/pull/285

tmack8001 commented 3 years ago

@sickchilly I might have found something that is causing it. One minute (not sure why this would happen nor not be caught by our CI tests)

Nope was just my secondary dev machine having a messed up environment. Things are running just fine on both my Mac (python starts up successfully) and on my dev Pi (custom OS configurations to get additional network logging). I gave away my other pre-setup vanilla "picoPi" setup to a local... Need to grab another microsd card or now just do away with my TiltPi image and run another.

tmack8001 commented 3 years ago

@sickchilly Michael is also running this Sha on a out of the box Pi no problem 🤔 as he posted about the Tilt image last night, https://m.facebook.com/groups/Picobrewers/permalink/2912504015695240/

sickchilly commented 3 years ago

Interesting... it appears the latest update may not be happy with my iSpindel session in progress: Before a5cd339 pi@picobrew:/picobrew_pico $ systemctl status rc.local -n 100 ● rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled) Drop-In: /usr/lib/systemd/system/rc-local.service.d └─debian.conf /etc/systemd/system/rc-local.service.d └─ttyoutput.conf Active: active (running) since Fri 2021-04-16 15:23:09 MDT; 1h 20min ago Docs: man:systemd-rc-local-generator(8) Process: 1907 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS) Tasks: 1 (limit: 881) CGroup: /system.slice/rc-local.service └─1926 python3 server.py 0.0.0.0 8080

Apr 16 15:23:05 picobrew systemd[1]: Starting /etc/rc.local Compatibility... Apr 16 15:23:09 picobrew systemd[1]: Started /etc/rc.local Compatibility. Apr 16 15:23:40 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 15:23:40 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 15:23:40 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 15:23:43 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 15:32:21 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 15:32:21 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 15:32:21 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 15:32:24 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 16:34:17 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 16:34:17 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 16:34:17 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 16:34:19 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found

After 81031f3 pi@picobrew:/picobrew_pico $ systemctl status rc.local -n 100 ● rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled) Drop-In: /usr/lib/systemd/system/rc-local.service.d └─debian.conf /etc/systemd/system/rc-local.service.d └─ttyoutput.conf Active: active (exited) since Fri 2021-04-16 15:23:09 MDT; 1h 22min ago Docs: man:systemd-rc-local-generator(8) Process: 1907 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

Apr 16 15:23:05 picobrew systemd[1]: Starting /etc/rc.local Compatibility... Apr 16 15:23:09 picobrew systemd[1]: Started /etc/rc.local Compatibility. Apr 16 15:23:40 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 15:23:40 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 15:23:40 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 15:23:43 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 15:32:21 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 15:32:21 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 15:32:21 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 15:32:24 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 16:34:17 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 16:34:17 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 16:34:17 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 16:34:19 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 16:43:40 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 16:43:40 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 16:43:40 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 16:43:42 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 16:44:06 picobrew rc.local[1907]: ifconfig: option -l' not recognised. Apr 16 16:44:06 picobrew rc.local[1907]: ifconfig:--help' gives usage information. Apr 16 16:44:06 picobrew rc.local[1907]: xargs: ipconfig: No such file or directory Apr 16 16:44:08 picobrew rc.local[1907]: /bin/sh: 1: pinout: not found Apr 16 16:45:02 picobrew rc.local[1907]: Traceback (most recent call last): Apr 16 16:45:02 picobrew rc.local[1907]: File "server.py", line 16, in Apr 16 16:45:02 picobrew rc.local[1907]: app = create_app(debug=True) Apr 16 16:45:02 picobrew rc.local[1907]: File "/picobrew_pico/app/init.py", line 76, in create_app Apr 16 16:45:02 picobrew rc.local[1907]: initialize_data() Apr 16 16:45:02 picobrew rc.local[1907]: File "/picobrew_pico/app/main/routes_frontend.py", line 692, in initialize_data Apr 16 16:45:02 picobrew rc.local[1907]: iSpindel_sessions = load_active_iSpindel_sessions() Apr 16 16:45:02 picobrew rc.local[1907]: File "/picobrew_pico/app/main/routes_frontend.py", line 627, in load_active_iSpindel_sessions Apr 16 16:45:02 picobrew rc.local[1907]: 'date': active_iSpindel_sessions[uid].created_at or None, Apr 16 16:45:02 picobrew rc.local[1907]: AttributeError: 'iSpindelSession' object has no attribute 'created_at'

tmack8001 commented 3 years ago

Yeah looks like there is an inconsistency between PicoFerm, iSpindle and Tilt models in code that produce that.

If you give me a bit I can fix this after the 5yo goes down tonight after family movie night.

Rudder2 commented 3 years ago

@Rudder2 looks like you have a few files that are in conflict with your associated git remote repo. Could you please resolve those conflicts and see if the error persists? FYI which git sha are you on? git status and git rev-parse HEAD pi@raspberrypi:/picobrew_pico $ git status On branch master Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded. (use "git pull" to update your local branch)

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)

    modified:   .github/workflows/python-app.yml
    modified:   .gitignore
    modified:   Dockerfile
    modified:   README.md
    modified:   app/__init__.py
    modified:   app/main/__init__.py
    modified:   app/main/config.py
    modified:   app/main/frontend_common.py
    modified:   app/main/model.py
    modified:   app/main/recipe_parser.py
    modified:   app/main/routes_devices.py
    modified:   app/main/routes_frontend.py
    modified:   app/main/routes_iSpindel_api.py
    modified:   app/main/routes_pico_api.py
    modified:   app/main/routes_picostill_api.py
    modified:   app/main/routes_server.py
    modified:   app/main/routes_support.py
    modified:   app/main/routes_tilt_api.py
    modified:   app/main/routes_zseries_api.py
    modified:   app/main/routes_zymatic_api.py
    modified:   app/main/session_parser.py
    modified:   app/main/still_polling.py
    modified:   app/main/tilt.py
    modified:   app/main/units.py
    modified:   app/static/css/main.css
    modified:   app/static/js/base_recipe.js
    modified:   app/static/js/ferm_graph_socketio.js
    modified:   app/static/js/iSpindel_graph.js
    modified:   app/static/js/iSpindel_graph_socketio.js
    modified:   app/static/js/index.js
    modified:   app/static/js/pico_recipe.js
    modified:   app/static/js/still_graph.js
    modified:   app/static/js/still_graph_socketio.js
    modified:   app/static/js/still_history.js
    modified:   app/static/js/tilt_graph.js
    modified:   app/static/js/tilt_graph_socketio.js
    modified:   app/static/js/tilt_history.js
    modified:   app/static/js/zseries_recipe.js
    modified:   app/static/js/zymatic_recipe.js
    modified:   app/static/support/legacy/kegsmarts/KegSmarts_Troubleshooting.pdf
    modified:   app/static/support/legacy/pico-s/Pico_Troubleshooting.pdf
    modified:   app/static/support/legacy/zymatic/Zymatic_Troubleshooting.pdf
    modified:   app/static/support/pico-c/PicoC_Troubleshooting.pdf
    modified:   app/static/support/pico-pro/Pico_Troubleshooting.pdf
    modified:   app/static/support/picoferm/PicoFerm_Troubleshooting.pdf
    modified:   app/static/support/picostill/PicoStill_Troubleshooting.pdf
    modified:   app/static/support/tilt/Instructional-Videos.md
    modified:   app/static/support/tilt/Server_Devices-old.png
    modified:   app/static/support/tilt/Server_Devices.png
    modified:   app/static/support/tilt/tilt.md
    modified:   app/static/support/z-series/Z_Troubleshooting.pdf
    modified:   app/templates/brew_history.html
    modified:   app/templates/devices.html
    modified:   app/templates/ferm_history.html
    modified:   app/templates/iSpindel_history.html
    modified:   app/templates/index.html
    modified:   app/templates/navbar.html
    modified:   app/templates/new_pico_recipe.html
    modified:   app/templates/new_zseries_recipe.html
    modified:   app/templates/new_zymatic_recipe.html
    modified:   app/templates/pico_recipes.html
    modified:   app/templates/still_history.html
    modified:   app/templates/tilt_history.html
    modified:   app/templates/zseries_recipes.html
    modified:   app/templates/zymatic_recipes.html
    modified:   config.example.yaml
    modified:   requirements.txt
    modified:   scripts/pi/00-run-chroot.sh
    modified:   scripts/pi/picobrew.com.conf
    modified:   scripts/pi/post-git-update.sh
    modified:   scripts/python/scan_tilt.py
    modified:   tests/functional/test_index.py
    modified:   tests/functional/test_recipes.py
    modified:   tests/functional/test_sessions.py
    modified:   tests/unit/test_recipe_import.py
    modified:   tests/unit/test_session_parser.py

Untracked files: (use "git add ..." to include in what will be committed)

    app/__pycache__/
    app/main/__pycache__/
    app/recipes/zseries/HopHeads_Chocolate_Porter.json
    app/recipes/zseries/HopHeads_IPA_#1-3_With_First_Wart_&_Whirlpool.json
    app/sessions/brew/archive/20201107_141710#30aea4c737ec#a3d193b1732e40df9dcb9782578cfba2#Irish_Red#6.json
    app/sessions/brew/archive/20201107_185451#30aea4c737ec#81ec608411cf4db2b988cdb8e0d9b88b#RINSE#0.json
    app/sessions/brew/archive/20201116_003902#30aea4c737ec#16905411092745ca99d242ccb1733c39#RACK#3.json
    app/sessions/brew/archive/20201117_130353#30aea4c737ec#3e389a23eae4461590ddc8737ba6d530#Tangerine_Wit_Pico#6.json
    app/sessions/brew/archive/20201117_194639#30aea4c737ec#19751f20185045e1b981c7cd80bea45b#RINSE#0.json
    app/sessions/brew/archive/20201121_212619#30aea4c737ec#dd9e3fb9f04340c6a1f8b1d225f9ec23#RACK#3.json
    app/sessions/brew/archive/20201121_220012#30aea4c737ec#f836bbc8910d49fb8037818b8cc7a34b#RACK#3.json
    app/sessions/brew/archive/20201124_124236#30aea4c737ec#a88c210d85404928935e784416f4b238#PicoZ_Sasion#6.json
    app/sessions/brew/archive/20201124_212118#30aea4c737ec#8f85dca1f373482f833a32286665dc5b#RINSE#0.json
    app/sessions/brew/archive/20201209_232017#30aea4c737ec#135c0f455a224ac785ce0d265d553777#RACK#3.json
    app/sessions/brew/archive/20201215_203329#30aea4c737ec#d2a925d6a4c5405593886cc6f84a272b#Double_IPA#6.json
    app/sessions/brew/archive/20201216_115305#30aea4c737ec#59302198487d42e79879d9b2179545ce#RINSE#0.json
    app/sessions/brew/archive/20201216_200128#30aea4c737ec#a8380c1411fb4f9fbb1bd870bdbfc6a6#CLEAN#1.json
    app/sessions/brew/archive/20201221_002841#30aea4c737ec#139606472e504c7fadc0fbc71b9884ce#RACK#3.json
    app/sessions/brew/archive/20201224_172505#30aea4c737ec#f10cc6d5e9214d5d8f8f0de9cb02a21d#HopHeads_Pico_Pale_Ale#6.json
    app/sessions/brew/archive/20201224_234847#30aea4c737ec#6129b6ff07ef42f081edfa46b731f6a0#RINSE#0.json
    app/sessions/brew/archive/20201230_220141#30aea4c737ec#dee7453b94b646eaa4020307cbea8601#RACK#3.json
    app/sessions/brew/archive/20201231_115134#30aea4c737ec#4de9cbc697e5419e823cf86c6d9d8e09#HopHeads_IPA_with_First_Wort_Hop#6.json
    app/sessions/brew/archive/20201231_181331#30aea4c737ec#3fec68537800435ab1038a7073ea2f65#RINSE#0.json
    app/sessions/brew/archive/20210106_120134#30aea4c737ec#d63f558becb148538e32a90037804191#HopHeads_Chocolate_Porter#6.json
    app/sessions/brew/archive/20210108_010939#30aea4c737ec#48321c54a2b24a7d93a7184e0a6205ac#RACK#3.json
    app/sessions/brew/archive/20210115_121010#30aea4c737ec#27d8592a29664f569a2c42cc27570c5f#CLEAN#1.json
    app/sessions/brew/archive/20210115_174247#30aea4c737ec#2c5a8b7ade5742c7bfd83330a78426b3#HopHeads_IPA_%231-3_With_First_Wart_&_Whirlpool#6.json
    app/sessions/brew/archive/20210116_001310#30aea4c737ec#c50c1370c3244efe9aa57414fa4a7906#RINSE#0.json
    app/sessions/brew/archive/20210119_005823#30aea4c737ec#b0a3d3a667364643b54cafcf44fa8b87#RACK#3.json
    app/sessions/brew/archive/20210122_155511#30aea4c737ec#326692fdd6bf47baaead129c5c67db7c#HopHeads_IPA_%231-3_With_First_Wart_&_Whirlpool#6.json
    app/sessions/brew/archive/20210122_222245#30aea4c737ec#2770f362d25442709eaa1a7e17451ea7#RINSE#0.json
    app/sessions/brew/archive/20210124_000727#30aea4c737ec#95a969e9cece4a3c9958bbc8b5b6ccd0#RACK#3.json
    app/sessions/brew/archive/20210203_135431#30aea4c737ec#080a961289e44746983b592ed82e4941#RACK#3.json
    app/sessions/brew/archive/20210205_143233#30aea4c737ec#38c3f390bec343d0af23d62e283caa98#HopHeads_IPA_%231-3_With_First_Wart_&_Whirlpool#6.json
    app/sessions/brew/archive/20210205_210606#30aea4c737ec#fa16f2418fbb436cb2f116d564351393#RINSE#0.json
    app/sessions/brew/archive/20210321_230629#30aea4c737ec#1ba121189f2c453da24aa29cc084c3bb#RACK#3.json
    app/sessions/ferm/archive/20210107_135619#60019456b24d.json
    app/sessions/ferm/archive/20210123_164833#60019456b24d.json
    app/sessions/ferm/archive/20210213_234753#60019456b24d.json
    config.removed.yaml
    config.yaml
    config.yaml.bk

no changes added to commit (use "git add" and/or "git commit -a")

pi@raspberrypi:/picobrew_pico $ git rev-parse HEAD a5cd339607f53376ea1c5fecf1c92606e55d3c84

Rudder2 commented 3 years ago

Could you please resolve those conflicts and see if the error persists? @tmack8001 Not sure how to resolve the conflicts.

sickchilly commented 3 years ago

My 502 issue was resolved by bc8c33a. Now on d5d74ec with no further issues.

Rudder2: cd /picobrew_pico sudo git reset --hard d5d74ec805bafa249edd54e939f0653057a69a01 sudo sudo systemctl restart rc.local

Those three commands will force you to the latest release.

Rudder2 commented 3 years ago

@sickchilly @tmack8001 It's back up. The commit fixed the issue. Man the server looks different than it did 2 months ago.