Automate the deployment and update of flask projects

I have written an flask application myself, which has been successfully deployed and launched. Using uwsgi and nginx
1. My practice is to have a private code base on github. After each local development, the code is updated to the remote library
2. Then log in to the server, and the code base of the project on the server is initially cloned from the remote library, so you need to git pull,
3 every time you need to update the code. Then I need to enter the virtual environment of this project and run uwsgi-- relaod uwsgi.pid
so that I can really complete the update
I would like to ask if there is any better way for you gods

.

< H1 > briefly explain the train of thought < / H1 > < H2 > the first step is to create a git remote repository on the server < / H2 >
cd /home/username
mkdir -p repositories/projectname.git
cd repositories/projectname.git
git init --bare .
< H2 > the second step is to write post-receive ( Git Hooks ) automatic deployment script on the server < / H2 >
touch /home/username/repositories/projectname.git/hooks/post-receive
chmod +x /home/username/repositories/projectname.git/hooks/post-receive

more complex logic may actually be required. Here is only an explanation

-sharp!/bin/bash
/usr/bin/git --work-tree=/var/www/projectname --git-dir=/home/username/repositories/projectname.git checkout -f
/home/username/.virtualenvs/virtualenvname/bin/python /home/username/.virtualenvs/virtualenvname/bin/uwsgi --reload /path/to/uwsgi.pid

remarks : user username must have / var/www/projectname directory read and write permissions

< H2 > step 3, add a remote warehouse locally < / H2 >
cd /path/to/projectdir
git remote add production username@myhostname:/home/username/repositories/projectname.git
-sharp 
git push production master
-sharp post-receive

you can use Jenkins, if you want to use a mature solution, but you need to deploy Jenkins, on a server that takes up a little bit of memory. A simpler solution can use GitHub webhooks, and then write a flask application specifically used to update the service. There is only one interface to perform the task of shutting down the service, updating the code, running the test, and restarting the service. Call commands directly with os.system or subprocess.call.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b845-4d13d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b845-4d13d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?