Showing posts with label gunicorn. Show all posts
Showing posts with label gunicorn. Show all posts

Monday, December 8, 2014

Better deployment

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.

Monday, November 24, 2014

Reloading

I have Django running under Gunicorn under NginX on a digital ocean installation that I had set up out of the box.  After upgrading Django to 1.7, I wanted to do a quick test that I hadn't broken anything.

So I tweaked the settings and found that nothing had changed.  Restarted nginX and nothing changed.  Finally I went to Gunicorn.

As mentioned here, you "gracefully reload" using the command

$ kill -HUP masterpid

But that means you have to find out what masterpid is.

Here's one way to find out, given here:

$ pstree -ap|grep gunicorn

look for the number on the top toward the left.