After committing some changes, I've been deploying them using git push.
Then I'd check the pages. Some (the ones that require changes to Python code) would fail to update and I'd need to restart ssh into the remote repository and restart Gunicorn. (kill -HUP process_number, where process_number can be found using grep).
Then, if I was smart, I would check the different instantions of web pages to make sure that everything was in order.
Anyway, today I wrote a little script called deploy. I made it executable, put it in a folder called 'bin' in my home directory, and put it on the path by adding an export command to the bottom of bashrc.
Right now it just chains four commands using &&, so that each one only begins upon the successful completion of the last.
#!/bin/bash
cd /home/doug/workspace/nnumscom/nnums
git push live master && ssh django@[host_ip] 'kill -HUP [process_number]' && ./nopen
nopen is a script that opens a set of about 12 web pages on the remote website so that I can give everything a quick visual.
The nice thing is that now I can take this and improve on it over time. And, of course, I replace three processes (two of which I might forget) with one.
No comments:
Post a Comment