ucladevx / Bmaps-Backend

Documentation and source code for public events/locations APIs.
http://github.com/ucladevx/Bmaps-Backend/
MIT License
6 stars 2 forks source link

WSGI using uWSGI, Nginx, and supervisor. #152

Closed wfehrnstrom closed 4 years ago

wfehrnstrom commented 4 years ago

These changes should fix how we previously ran the backend with flask's dev server, which was never meant for that purpose. Now we run with nginx, and uWSGI serves flask's content via a pass in our nginx config. This should be more scalable. However, there is still the issue of root mode execution of these scripts (we should execute our supervisor processes with a user account to the maximum extent possible because this lessens the possibility of an RCE attack). We cannot currently run uWSGI as a user account because doing so means that ntlk is unable to create directories needed during a dynamic download within the backend, but this should be worked around.

Kimeiga commented 4 years ago

Holy shit this is amazing but again why are there hundreds of commits haha

wfehrnstrom commented 4 years ago

I don't know! also, it's failing right now because of UTF8 encodings. I'll figure it out.

On Wed, Dec 11, 2019 at 4:04 AM Hakan Alpay notifications@github.com wrote:

Holy shit this is amazing but again why are there hundreds of commits haha

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ucladevx/Bmaps-Backend/pull/152?email_source=notifications&email_token=ACPZVPM5CSC6DXQ4EMC2UCDQYBKCFA5CNFSM4JYS4B72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGRW3NA#issuecomment-564358580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPZVPJUT6OO3BX3I3YAOLDQYBKCFANCNFSM4JYS4B7Q .

Kimeiga commented 4 years ago

I don't know! also, it's failing right now because of UTF8 encodings. I'll figure it out. On Wed, Dec 11, 2019 at 4:04 AM Hakan Alpay @.***> wrote: Holy shit this is amazing but again why are there hundreds of commits haha — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#152?email_source=notifications&email_token=ACPZVPM5CSC6DXQ4EMC2UCDQYBKCFA5CNFSM4JYS4B72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGRW3NA#issuecomment-564358580>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPZVPJUT6OO3BX3I3YAOLDQYBKCFANCNFSM4JYS4B7Q .

thanks man lemme know if I can help in any way

Kimeiga commented 4 years ago

image looks like another alpine linux error as the offending code is located in /code. Not sure.

This is a screenshot from the log of the prod server dry run

wfehrnstrom commented 4 years ago

image looks like another alpine linux error as the offending code is located in /code. Not sure.

This is a screenshot from the log of the prod server dry run

I think what's going on here is that the encrypted .env file contains some non utf8 characters in its output and thus, this docker-compose parsing step is failing. The parsing script is a codec, called by environment.py .