Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deployment for small teams using Git & Phing

Deployment for small teams using Git & Phing

Before Heroku we had to build our own servers! This talk looks at using Phing to build and deploy code from Git

Aaron Bassett

July 07, 2010
Tweet

More Decks by Aaron Bassett

Other Decks in Technology

Transcript

  1. GIT COMMANDS ✓ init ✓ clone ✓ branch ✓ checkout

    ✓ status ✓ add ✓ commit ✓ merge ✓ pull ✓ push
  2. public static bool IsNotEmpty(string value) { return !IsEmpty(value); } public

    static bool IsEmpty(string value) { return !IsNotEmpty(value); } git blame
  3. THE BASICS git clone [email protected]:aaronbassett/TMU-Example.git git branch HelloWorld git checkout

    HelloWorld # Make changes to files git status git add filename.ext git commit -m ‘Commit message’ git checkout master git merge HelloWorld git pull git push origin master
  4. XML

  5. # Django settings for techmeetup project. from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

    import os TECHMEETUP_DIR = os.path.dirname(__file__) DEBUG = False TEMPLATE_DEBUG = DEBUG APPEND_SLASH = False ADMINS = ( # Add yourself homeboys! ('Oli Kingshott', '[email protected]'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'dev.db' DATABASE_USER = '' DATABASE_PASSWORD = '' DATABASE_HOST = '' DATABASE_PORT = ''
  6. # Django settings for techmeetup project. from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

    import os TECHMEETUP_DIR = os.path.dirname(__file__) DEBUG = False TEMPLATE_DEBUG = DEBUG APPEND_SLASH = False ADMINS = ( # Add yourself homeboys! ('##ADMIN-NAME##', '##ADMIN-EMAIL##'), ) MANAGERS = ADMINS DATABASE_ENGINE = '##DB-ENGINE##' DATABASE_NAME = '##DB-NAME##' DATABASE_USER = '##DB-USER##' DATABASE_PASSWORD = '##DB-PASS##' DATABASE_HOST = '##DB-HOST##' DATABASE_PORT = '##DB-PORT##'
  7. <?xml version="1.0" encoding="UTF-8"?> <project name="example" basedir="." default="start"> <target name="start" depends="populate-config"

    description="Let's go."> <echo>Starting build...</echo> </target> <target name="get-admin" description="Get project Admin values."> <propertyprompt propertyName="admin.name" defaultValue="admin" promptText="Enter the admin's name" /> <propertyprompt propertyName="admin.email" defaultValue="[email protected]" promptText="Enter the admin's email" /> </target> <target name="get-db" depends="get-admin" description="Get database login values."> <input propertyname="db.engine" validargs="sqlite3,postgresql,mysql,oracle" defaultValue="sqlite3"> What database engine do you want to use? </input> <propertyprompt propertyName="db.name" promptText="Enter database name" /> <if> <not><isset property="db.name" /></not> <then> <fail message="You must enter a database name!" /> </then> </if> <propertyprompt propertyName="db.user" promptText="Enter database user" /> <if> <not><isset property="db.user" /></not> <then> <fail message="You must enter a database user!" /> </then> </if> <propertyprompt propertyName="db.password" promptText="Enter database password" /> <if> <not><isset property="db.password" /></not> <then> <fail message="You must enter a database password!" /> </then> </if>
  8. <propertyprompt propertyName="db.host" defaultValue="localhost" promptText="Enter database host" /> <propertyprompt propertyName="db.port" defaultValue=""

    promptText="Enter database port" /> <if> <not><isset property="db.port" /></not> <then> <property name="db.port" value="" /> </then> </if> </target> <target name="populate-config" depends="get-db" description="Create the config file."> <echo>Writing settings file</echo> <reflexive> <fileset dir="./"> <include name="settings.py" /> </fileset> <filterchain> <replacetokens begintoken="##" endtoken="##"> <token key="ADMIN-NAME" value="${admin.name}" /> <token key="ADMIN-EMAIL" value="${admin.email}" /> <token key="DB-ENGINE" value="${db.engine}" /> <token key="DB-NAME" value="${db.name}" /> <token key="DB-USER" value="${db.user}" /> <token key="DB-PASS" value="${db.password}" /> <token key="DB-HOST" value="${db.host}" /> <token key="DB-PORT" value="${db.port}" /> </replacetokens> </filterchain> </reflexive> </target> </project>
  9. # Django settings for techmeetup project. from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

    import os TECHMEETUP_DIR = os.path.dirname(__file__) DEBUG = False TEMPLATE_DEBUG = DEBUG APPEND_SLASH = False ADMINS = ( # Add yourself homeboys! ('Aaron', '[email protected]'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'mysql' DATABASE_NAME = 'dev.db' DATABASE_USER = 'tmu-dev' DATABASE_PASSWORD = 'this should be masked' DATABASE_HOST = 'localhost' DATABASE_PORT = ''