Deployment Instruction - serenapotts/lifeforachild GitHub Wiki

Create a release branch

Checking out code, make sure it builds correctly, all tests should pass. Create a release branch:

git co -b release-20150415
git push origin release-20150415

Build a Staging artefact

To build, please do the following:

  • Modify database.properties, update the database config to point to staging
  • Modify web.xml, update all reference to lifeforachild to lifeforachild-staging
  • Run mvn clean install to build the war file

Build for Production

It is recommended to take the war in staging, modify configuration and deploy to Production. The reason is staging has been tested by users.

Steps:

  • Copy the staging war to a ~/installs/release-yyyymmdd
  • Go to that directory: cd ~/installs/release-yyyymmdd
  • Create a temp directory: mkdir temp-war
  • Go to that directory: cd temp-war
  • Expand the war: jar xvf ../lifeforachild-staging.war
  • Modify database.properties: point to Production
  • Modify web.xml: update all lifeforachild-staging to lifeforachild (in vi: %s/-staging//g)
  • Create the war: jar cvf ../lifeforachild.war .
  • Copy the newly created war into the right Tomcat/webapps directory.

Future Plan

As you can see, the steps above is quite manual and error prone. We should create both staging and production artefacts as part of the build.

Configuration should be on the server, we can pass in an environment variable to say which environment it is. The war file should be the same in Staging and Production, as the testing artifact should be the one that will be deployed to Production.