Menu

How to install it

Zitec COM Bogdan Grigore

General considerations

CodePax must be installed on every environment you want to control. In case your application has one instance on a dev server and another one on a staging server, CodePax needs to be deployed for both of them.

Usually CodePax is placed under an alias such as yourapp.dev.domain.com/codepax/. A good practice is to use the .htaccess file inside public dir to restrict the access based on the incoming IP addresses. Beside that you can employ a HTTP basic auth to further restrict the access.

CodePax need the following applications and tools to work:
1. a web server, like: Apache, Nginx, IIS, etc
2. a Subversion command line client (SlikSvn works well for Windows)
3. PHP 5.2 or higher
4. the following PHP extensions must be enabled depending of the set-up options you want to follow:
- PDO_mysql - in case database versioniong is enabled and you use MySQL
- PDO_pgsql - in case PostgreSQL is your database of choice
- SqlSrv - a driver actively maintained by Microsoft http://msdn.microsoft.com/en-US/library/cc296152(v=sql.90).aspx
- Zip extension - in case you want to use the "preserve test data" functionality under the Database versioning
5. you need a Subversion user with read-write access for the repo you will be using
6. rename config.sample.php to config.php (the file is under /src/application/config/) and fill in the appropriate constants by following the inline code comments


Database versioning

In order to benefit of the database versioning system, you need to make one time configurations on every environment you plan to use CodePax.

Staging (STG)
This should be the first one to start with.
1. manually synchronize the PROD database with the one on STG. The most important is to have the latest database structure on STG.
2. generate the versioning table by running /utils/generate_db_versions_table.php

Windows considerations


Configuring the project

Below you will find the necessary steps you must take in order to setup CodePax for your project:

STG

  • The database from the PROD server is dumped and then uploaded on the STG server

  • From the CodePax root run the script /utils/generate_db_versions_table.php

  • The code is switched on the trunk(only if it this hasn't been done before this)

  • The necesary folder structure is created. Apache or the web server provider of your choosing must be given write rights to these folders:
    /project_root/DB_VERSIONING_DIR/baselines/
    /project_root/DB_VERSIONING_DIR/change_scripts/
    /project_root/DB_VERSIONING_DIR/data_change_scripts/
    /project_root/DB_VERSIONING_DIR/test_data/

DB_VERSIONING_DIR is a constant definded in the CodePax config.

  • A test data file must be created at this location: /project_root/DB_VERSIONING_DIR/test_data/data.sql . If time is short, the test data file can be created as an empty file but it is mandatory it exists.

  • Using the SVN client of your choosing, add and commit these folders to your project. An explanatory message should be used like "created directory structure for DataBase versioning"

  • From the CodePax root run the script: /utils/generate_baseline.php

  • A tag with the content is created.

PROD

  • From the CodePax root run the script: /utils/generate_db_versions_table.php

  • The first entry in the table is entered manually, with baseline 1.0.0 (INSERT INTO z_db_versions (major,minor,point,script_type,date_added) VALUES(1,0,0,1, NOW()))

  • A switch to the tag above will be performed

DEV

  • From the CodePax root run the script: /utils/generate_db_versions_table.php

  • The first entry in the table is entered manually, with baseline 1.0.0 (INSERT INTO z_db_versions (major,minor,point,script_type,date_added) VALUES(1,0,0,1, NOW()))


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.