Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Deployment in the Cloud! Tareque Hossain
Pony in the Cloud
Deployment Strategy <ul><li>Cloud computing hosts (in our case Amazon EC2) supports dynamic instantiation of servers, whic...
Deployment Strategy Continued <ul><li>Advantages of deployment time retrieval of project specific packages are: </li></ul>...
Deployment Tools <ul><li>At PBS we use the following tools for deployment: </li></ul><ul><ul><li>fabric, a Python library ...
Deployment Procedure I <ul><li>Instantiate a new server on the cloud (no details) </li></ul><ul><li>Apache, MySQL, Python,...
Shell Bootstrap Code if  [ -e fabfile.py ];  then if  ! command -v virtualenv &>/dev/null;  then sudo easy_install virtual...
Deployment Procedure II <ul><li>Fabric looks for fabfile.py in the project root folder </li></ul><ul><li>fabfile.py contai...
Fabric Code <ul><li>Let us look at the fabric code. </li></ul>
Questions? <ul><li>This presentation is available at: www.codexn.com </li></ul><ul><li>Sample bootstrap.sh & fabfile.py ar...
Nächste SlideShare
Wird geladen in …5
×

Django Deployment

A presentation on django project deployment & update strategies. Presented at django-NOVA meetup on April 2nd, 2010

Ähnliche Bücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen

Ähnliche Hörbücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen
  • Als Erste(r) kommentieren

Django Deployment

  1. 1. Deployment in the Cloud! Tareque Hossain
  2. 2. Pony in the Cloud
  3. 3. Deployment Strategy <ul><li>Cloud computing hosts (in our case Amazon EC2) supports dynamic instantiation of servers, which provides us the opportunity to maximize automation </li></ul><ul><li>To utilize the benefit, we automate our deployment 100% </li></ul><ul><li>Key software packages become part of Amazon Machine Image (AMI) e.g. MySQL, Apache, mod_wsgi, global Python runtimes, setuptools, search engines, version control systems etc. </li></ul><ul><li>All project specific packages are retrieved and installed at the time of deployment </li></ul>
  4. 4. Deployment Strategy Continued <ul><li>Advantages of deployment time retrieval of project specific packages are: </li></ul><ul><ul><li>Ability to obtain most up to date package (with bug fixes) </li></ul></ul><ul><ul><li>Minimize machine image size </li></ul></ul><ul><ul><li>Use of public package distribution services (more clouds!) </li></ul></ul><ul><li>But there are disadvantages: </li></ul><ul><ul><li>Public package distros don’t have guaranteed uptime </li></ul></ul><ul><ul><li>Vulnerable to new bugs </li></ul></ul><ul><ul><li>Security issues </li></ul></ul>
  5. 5. Deployment Tools <ul><li>At PBS we use the following tools for deployment: </li></ul><ul><ul><li>fabric, a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks </li></ul></ul><ul><ul><li>virtualenv, a tool to create isolated Python environments </li></ul></ul><ul><ul><li>pip, a tool to install Python packages, a replacement of easy_install </li></ul></ul><ul><ul><li>git, the version control system we primarily use </li></ul></ul><ul><li>Also involves writing some shell script </li></ul>
  6. 6. Deployment Procedure I <ul><li>Instantiate a new server on the cloud (no details) </li></ul><ul><li>Apache, MySQL, Python, setuptools & Git installed </li></ul><ul><li>Check out project from git, and switch to project directory </li></ul><ul><li>Execute a shell script bootstrap.sh , which we include in the dist folder of our projects, which does the following: </li></ul><ul><ul><li>Install virtualenv if not already present </li></ul></ul><ul><ul><li>Create a virtual environment for the deployment tools (since different projects might depend on different versions) </li></ul></ul><ul><ul><li>Install fabric </li></ul></ul>
  7. 7. Shell Bootstrap Code if [ -e fabfile.py ]; then if ! command -v virtualenv &>/dev/null; then sudo easy_install virtualenv fi rm -Rf .ve.boot~/ virtualenv .ve.boot~/ .ve.boot~/bin/easy_install -q http://git.fabfile.org/cgit.cgi/fabric/snapshot/ fabric-0.9b1.tar.gz .ve.boot~/bin/ fab local bootstrap rm -Rf .ve.boot~/ else echo &quot;You must run this from your projects root directory.&quot; fi
  8. 8. Deployment Procedure II <ul><li>Fabric looks for fabfile.py in the project root folder </li></ul><ul><li>fabfile.py contains necessary server profiles & utility functions: </li></ul><ul><ul><li>bootstrap, a function that accepts a server profile as argument and sets up the projects virtual environment </li></ul></ul><ul><ul><li>deploy, checks for deployment revision, which in our case is git tag, accepts revision number as input & updates the project </li></ul></ul><ul><ul><li>bootstrap_on_demand, a function that performs bootstrap only if the project environment is out of date </li></ul></ul>
  9. 9. Fabric Code <ul><li>Let us look at the fabric code. </li></ul>
  10. 10. Questions? <ul><li>This presentation is available at: www.codexn.com </li></ul><ul><li>Sample bootstrap.sh & fabfile.py are available for download </li></ul>

×