Wednesday, October 25, 2023

Thursday, October 19, 2023

letsencrypt manual certificate creation

 sudo certbot certonly  --manual -d domain name --preferred-challenges dns


create .well-known folder and create acme-server folder inside it


Use --preferred-challenges dns if dns validation are needed.


copy below cerificates

/etc/letsencrypt/live/domain/fullchain.pem

/etc/letsencrypt/live/domain/privkey.pem

Wednesday, October 18, 2023

Friday, October 6, 2023

Load testing with locust

 pip install locust

create file locustfile.py

start with locust

open web using : 

http://localhost:8089/


Sample user file:

from locust import HttpUser, task

class LoadUser(HttpUser):
@task
def load(self):
self.client.get("/sleep_30/")

Deploy Gunicorn using PM2

 Use below command:

 pm2 --name=py-api start "cd ~/code/python_tasks && source venv/bin/activate && cd api && gunicorn -k gevent app:app -b 0.0.0.0:5050 -w 2 --error-logfile /var/log/gunicorn/error.log --access-logfile /var/log/gunicorn/access.log --capture-output --log-level debug"