How to set up a development instance
There are four possible instances in the FSP development environment:
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.).
To bring up a new instance of a development environment, follow these steps:
- 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.
- Get the database password from the current settings for the selected development environment (e.g. in dev1/sites/dev1.freestateproject.org/settings.php).
- 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
- 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):
svn export $FSPSVN/trunk
- 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
- 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).
- Note where the current folder link points to:
ls -l ~/public_html/dev1
- Move the appropriate folder link to point to the new code:
ln -s ~/public_html/dev_stuff ~/public_html/dev1
- 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