Hadiasemi / Crypto-Tracker

0 stars 2 forks source link

Deploy Application #60

Closed jinyung2 closed 3 years ago

jinyung2 commented 3 years ago

Estimate: 2 hours

jinyung2 commented 3 years ago

Time Spent: 4 hours

Took a long time figuring out how to work with running flask applications on the linode server. Initially thought it would be easy to just spin up the flask run script, but this script is actually only intended for development purposes. It is not optimized for a production build. Found out using some kind of WSGI compliant web server is the better way to go, popular option was Gunicorn. Tried to use gunicorn in conjunction with pm2 but was unable to figure out a solution. Tried to use gunicorn by supplying the --daemon flag which did work but wanted a solution that manages the service with a bit more output (instead of having to check processes running on server). Looked at a guide from linode regarding deploying flask apps and it utulized NGINX reverse proxy alongside a program called supervisor. Set up supervisor as per instructions, ended up having to supply a command that initially fires up a bash shell followed by commands to start the venv and start the gunicorn server. Ended up working.

Todo:

jinyung2 commented 3 years ago

https://skryvets.com/blog/2018/09/20/an-elegant-solution-of-deploying-react-app-into-a-subdirectory/

Useful links for deploying react app to subdirectory of server.