How to set up a development instance

Architecture

There are four possible instances in the FSP development environment:

  1. dev.freestateproject.org
  2. dev1.freestateproject.org
  3. dev2.freestateproject.org
  4. dev3.freestateproject.org

Each of these points to a folder link (note: not a folder, but a link that can point to folders) in the /home/freestat/public_html directory on the development server, and this folder link is named after the development instance (i.e. dev, dev1, ....). Each of these instances is also associated with a unique database named after the instance (freestat_dev, freestat_dev1, ...), and a unique user with the same name as the database.

An anonimized copy of the production database is copied to the development environment once a week, to /home/freestat/anondb/fsp_anon.sql.gz. This copy can also be generated at will when required. On the development server, an hourly cron batch processes any fresh copies of this file into four files ready to be loaded into any of the development databases (named dev.sql, dev1.sql, etc.).

Procedure

To bring up a new instance of a development environment, follow these steps:

  1. Pick one of the four development environments. Check with the FSP IT mailing list if anyone else is using it. For the following steps we assume that the dev1 environment was chosen.
  2. Get the database password from the current settings for the selected development environment (e.g. in dev1/sites/dev1.freestateproject.org/settings.php).
  3. Reload the database from the latest anonymized production database copy (note that the password will be requested):
    cat ~/anondb/dev1.sql | mysql -u freestat_dev1 freestat_dev1 -p
  4. Export from the source repository the branch of code that will be used in this environment into the public_html folder. E.g. if the trunk will be used (see the source control topic for the value of $FSPSVN):
    cd ~/public_html
    svn export $FSPSVN/trunk
  5. There will be a folder named "~/public_html/trunk". Rename that to something unique, in order that it will not be overwritten by another developer:
    mv trunk dev_stuff
  6. Set the database password in the new copy of the code to the correct password for the dev environment (in ~/public_html/dev_stuff/sites/dev1.freestateproject.org/settings.php).
  7. Note where the current folder link points to:
    ls -l ~/public_html/dev1
  8. Move the appropriate folder link to point to the new code:
    rm ~/public_html/dev1
    ln -s ~/public_html/dev_stuff ~/public_html/dev1
  9. Remove the folder that the folder link pointed to previously (e.g. old_dev1), unless it needs to be kept around for some purpose:
    rm -rf ~/public_html/old_dev1

Submitted by liber_tas on May 1, 2008 - 9:03am.