Last but not least : how to use pm2 to manage your website ...
You'll notice from the previous stages that in order to keep your website online, you have to keep the terminal which executed the following command open (and don't do anything with it) :
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:2024
To let this command being handled automatically, you can use pm2, that can be installed using the following link : https://pm2.io/docs/runtime/guide/installation/.
Then start the website using
pm2 start "gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:2024" --name testapi
and you can see if everything runs well with the command :
pm2 ls
🔔 If you want to restart the website (for instance, after an update on the TestAPI code with a
git pull), just typepm2 restart.