Deploy new work from development

You should never change the production files or database scheme directly. Instead, make all such changes on the development server and then deploy them in a controlled fashion. The key elements to deployment are:

  • Pre-tested Change. Any changes you make to the system have already been tested in a simulated production environment. (The best way to do this is with a pre-production environment. That is, a change is tested in dev, and then tested in a recent clone of production. This will be documented here in the future.)

  • Version-Controlled Change. When you make a change to production, you are confident that you are getting exactly the change you want and nothing more or less.

  • Rollback. If anything goes wrong, there is a very-low-risk, very fast way to restore the system to its state before the change.

(THIS PARAGRAPH AND THE THINKING BEHIND IT ARE STILL A WORK IN PROGRESS.) For OpenACS 4.5, we will draw a line between the file system and the database. We'll assume that we can change the filesystem freely without affecting the database. So, any change that doesn't change the database schema can be effected by changing the file system, and we can safely roll back these changes simply be changing the filesystem back. Changes that do affect the database should go through OpenACS's package mechanism, which has provisions and standards for controlled change of the database without data loss. In short, Files through CVS, database through APM

Deploy a major change through APM

  1. Install the tutorial package

    This step assumes that you have put the package file in /tmp.

    1. Click the Load a new package from a URL or local directory link

    2. For Path:, enter /tmp/tutorialapp-0.1d.apm and click Load

    3. Click Install

    4. Click Next -->

    5. Click Main Site

  2. Mount the tutorial package in the site map

    (TEMP WORKAROUND because the install package doesn't run the database script - psql -f /web/openacs-prod/packages/tutorialapp/sql/postgresql/tutorial-create.sql openacs-prod):
    1. Click Package Manager.

    2. Click the new sub folder link on the Main Site line.

    3. Type tutorial and click New.

    4. Click the new application link on the tutorial line.

    5. Type Tutorial where it says untitled, choose Tutorial App from the drop-down list, and click New.

Deploy a minor change through CVS

  1. Go back to the development server and make a minor change.

    cd /web/openacs-dev/www
    emacs index.adp
    

    Change some of the text on the page.

  2. Verify the change by browsing to http://yourserver:8000 and looking at your change.

  3. Add the change to cvs.

    cvs commit -m "" index.adp
    cvs tag -F current index.adp
  4. Test the change on the preproduction server . (INCOMPLETE - document how to set up a preproduction server.) This example assumes that the old version is the original installation, and the date is 01 January 2003. From a root shell:

    su - nsadmin
    cd /web
    cvs export -r current -d openacs-20030101 openacs
    svc -d /service/openacs-pre
    rm openacs-pre
    ln -s openacs-20030101 openacs-pre
    svc -u /service/openacs-pre
    exit
    

    Browse to http://yourserver:8000 and test.

  5. If everything tests okay, deploy to production.

    svc -d /service/openacs-prod
    mv openacs-prod openacs-prod-lastgood
    mv openacs-20030101 openacs-prod
    svc -u /service/openacs-prod
    exit
    
  6. If something goes wrong, you can reverse the changes via:

    svc -d /service/openacs-prod
    mv openacs-prod openacs-prod-newbad
    mv openacs-prod-lastgood openacs-prod
    svc -u /service/openacs-prod
    
Symlinks break the backup tar command, so this should be changed. Should also detail how to set up a preproduction service.
Add a comment
Last modified: Fri May 07 10:04:29 CDT 2004