talkit bank 서비스 안정화를 위한 운영 전환 2 - Gunicorn

in hive-161316 •  19 hours ago  (edited)



안녕하세요. 가야태자 @talkit 입니다.

@etainclub (78)admin 10 hours ago 
python 기반 서버로 FastAPI를 추천합니다. 앞에 Gunicorn과 Nginx를 붙여서 많이 서비스하더라구요.

Django는 너무 무거울 거고, FastAPI가 좋을거 같습니다!

어제 @etainclub님께서 조언을 주셨습니다.

Gunicorn과 서비스를 하겠다고 잠정적인 결론을 내고 있었는데 이타인님의 조언으로 한번더 확정하게 되었습니다.

어제 또 서비스가 뻣었네요 ^^

NginX는 고려하지 않고, Gunicorn 부터 먼저 해보도록 하겠습니다.

if __name__ == "__main__":
    context = (
        "/etc/letsencrypt/live/talkitbank.whd.kr/fullchain.pem",
        "/etc/letsencrypt/live/talkitbank.whd.kr/privkey.pem"
    )    
    app.run(host="0.0.0.0", port=443, debug=True, ssl_context=context)
# Flask 실행 코드 수정
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5700, debug=True)

소스코드 상에서 ssl관련 옵션을 제외하고, 기존 포트인 5700번으로 변경 했습니다.

gunicorn --certfile=/etc/letsencrypt/live/talkitbank.whd.kr/fullchain.pem \
         --keyfile=/etc/letsencrypt/live/talkitbank.whd.kr/privkey.pem \
         -w 8 -b 0.0.0.0:443 app:app

오늘은 수동으로 서비스를 해보도록 하겠습니다.

pip install gunicorn

실행하려고 하는데 패키지를 설치 안했습니다. T.T

내일 글에서 리눅스의 시스템서비스로 등락하는 방법을 적도록 하겠습니다.

감사합니다.


Write Once, reward forever via EverSteem app

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Upvoted! Thank you for supporting witness @jswit.