Normally I make changes to the repo https://github.com/allofphysicsgraph/proofofconcept/tree/gh-pages/v7_pickle_web_interface and then run git pull
on my DigitalOcean VPS Droplet. It has been a long time since I tried running the web server locally on my laptop.
Here's the process I went through to get the web server running locally.
First I had populated the "certs" directory
/Users/username/version_controlled/allofphysicsgraph/proofofconcept/v7_pickle_web_interface/certson my laptop from the remote VPS.
Then I had to create
/Users/username/version_controlled/allofphysicsgraph/proofofconcept/v7_pickle_web_interface/.envwith the Google variables for login authentication.
In the directory on my laptop
/Users/username/version_controlled/allofphysicsgraph/proofofconcept/v7_pickle_web_interfacerunning the command
docker-compose up --build
failed. Specifically, the nginx and flask containers would start, but nginx would fail because the flask container wasn't responding. I added
restart: on-failureto the nginx section in docker-compose.yaml
That didn't solve the flask issue, but it allowed the containers to persist while I inspected the logs. Even though I couldn't enter the flask container, I could review the logs produced by gunicorn by running the command
tail -f flask/logs/gunicorn_error.logwhich showed the causal issue
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/appuser/app/wsgi.py", line 15, in <module> from controller import app File "/home/appuser/app/controller.py", line 63, in <module> from secure import SecureHeaders # type: ignore ImportError: cannot import name 'SecureHeaders' [2021-08-08 19:56:37 +0000] [11] [INFO] Worker exiting (pid: 11) [2021-08-08 19:56:37 +0000] [1] [WARNING] Worker with pid 11 was terminated due to signal 15 [2021-08-08 19:56:37 +0000] [1] [INFO] Shutting down: Master [2021-08-08 19:56:37 +0000] [1] [INFO] Reason: Worker failed to boot.Root case: In my requirements.txt I hadn't pinned the version of the Python library
secure
. According to this issue there was a recent update . I ended up pinning secure==0.2.1 in requirements.txtNow I am able to run docker-compose up
and get a web page at https://localhost/
No comments:
Post a Comment