Skip to content

Instantly share code, notes, and snippets.

@robrocker7
Created December 19, 2012 22:53
Show Gist options
  • Save robrocker7/4341319 to your computer and use it in GitHub Desktop.
Save robrocker7/4341319 to your computer and use it in GitHub Desktop.

Production Setup Notes

Architecture

The production environment is broken out into a few directories

versions
    myxer
    vx.x.x
production
settings.py
  • versions - hosts the versioned archives of the myxer github repository
  • production - symlink to the live version of the myxer codebase
  • settings.py - production environment settings

Steps to Launch New Version

Pull From Github

cd /var/www/myxer.com/versions/myxer
git pull origin master

First we need to pull the latest iteration of the site before we can archive it out

Iterate Version Number & Archive

mkdir ../vx.y.z
git archive master | tar -xC ../vx.y.z

Increment the version number according to the release tag in git or use the following iteration rules.

Iteration Rules:

  • x: Major Version - Generally only changes for large codebase changes.
  • y: Database Change Version - If you push an update that changes the database increment this.
  • z: Bug Fix Version - If you're pushing a bug fix or feature that doesn't change the database increment this.

Symlink settings.py & Collect Static

cd ../vx.y.z/myxer/settings
ln -s /var/www/myxer.com/settings.py local.py
cd ../../ && python manage.py collectstatic

All the settings are pulling from the common.py however the common.py looks for a file called local.py to include environment specific settings.

It is good practice to not store senensitve setting information inside the repository. This is the reasoning behind symlinking to settings.py to local.py where settings.py is outside of the myxer codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment