Steps with explanations to set up a server using:
- virtualenv
- Django
- nginx
- uwsgi
# Build dependencies for OpenResty. | |
sudo apt-get install build-essential libpcre3-dev libssl-dev libgeoip-dev | |
# Install standard Nginx first so that you get the relevant service scripts installed too | |
sudo apt-get install nginx | |
# If you want to access Postgres via Nginx | |
sudo apt-get install libpq-dev |
This example is based on having a cascading setup, where you have a single master, a single "primary" slave, and cascading slaves which are being replicated from the primary slave. For an example of this setup, check out http://bartek.im/blog/2012/12/04/postgresql-92-streaming-primer.html
On the existing master, if accessible, stop postgres.
$ sudo service postgresql stop
And better to be safe than sorry. We can't have two masters running. (I only use this in an automated script. If you're doing this manually, you'd know if it was shutoff)
$ kill -9 `sudo cat /var/lib/postgresql/9.2/main/postmaster.pid | head -n 1` &> /dev/null