The process
- Sign up for Digital Ocean (that's a referral link which you are in no way obligated to use)
- Create a droplet (I've added my SSH key to Digital Ocean so I assign that to the droplet). I used Debian 7 x64
- Point your domain's A record at the IP address Digital Ocean assigns to your droplet.
- Log into the vps as root, create a new user and give it sudo permission,
$ adduser new_user_namethen$ visudo - In visudo find the line
root ALL=(ALL:ALL) ALLreplicate it just below and replace root with the username created above. - In your local project copy the default fabric dictionary from settings.py to local_settings.py and uncomment it
- Fill in the fabric settings
- Configure ALLOWED_HOSTS in deploy/live_settings.py, i.e.,
ALLOWED_HOSTS = ['example.com'] - Open your project's requirements.txt and add pillow to a new line (This should get automatically installed by Mezzanine but for some reason isn't)
- Run fabric
$ fab all - Go to your site in your browser
Notes
Log locations
Logs end up in /var/log/ particularly:
- nginx:
/var/log/nginx - supervisor:
/var/log/supervisor
The supervisor directory contains logs of gunicorn's stderr and stdout which would include Django errors.
Example project
The project I deployed is here, it's just vanilla Mezzanine with ALLOWED_HOSTS set and pillow added to the requirements
Example fabric dictionary
FABRIC = {
"SSH_USER": "do", # SSH username
"SSH_PASS": "", # SSH password (consider key-based authentication)
"SSH_KEY_PATH": "/Users/josh/.ssh/id_rsa.pub", # Local path to SSH key file, for key-based auth
"HOSTS": ['do.bitpl.us'], # List of hosts to deploy to
"VIRTUALENV_HOME": "/home/do", # Absolute remote path for virtualenvs
"PROJECT_NAME": "do_test", # Unique identifier for project
"REQUIREMENTS_PATH": "requirements.txt", # Path to pip requirements, relative to project
"GUNICORN_PORT": 8000, # Port gunicorn will listen on
"LOCALE": "en_US.UTF-8", # Should end with ".UTF-8"
"LIVE_HOSTNAME": "do.bitpl.us", # Host for public site.
"REPO_URL": "https://joshcartme@bitbucket.org/joshcartme/vanilla_mezz", # Git or Mercurial remote repo URL for the project
"DB_PASS": "abc123", # Live database password
"ADMIN_PASS": "abc123", # Live admin user password
"SECRET_KEY": SECRET_KEY,
"NEVERCACHE_KEY": NEVERCACHE_KEY,
}