Preparing a test environment

If you create a test environment - to perform an upgrade before you upgrade your live environment - you can:

  • Test that after upgrading you can log into OpenX and see all of your data.
  • Evaluate bug fixes and new features.
  • Test that the delivery of creatives works after the upgrade.

    This is recommended when, for example, evaluating OpenX's beta releases.

To test in a test environment:

Creating a Testing Environment

To set up a testing environment:

  • Decide on a server to host your testing environment.
  • Ideally, this server will permit you to host your testing environment using a different IP address to your live environment. This will allow you to:
  • Use your testing environment to ensure that the upgrade process works correctly;
  • Test that after upgrading, you can log into OpenX and see all of your data;
  • Evaluate bug fixes and new features; and
  • Test that the delivery of creatives works after the upgrade.
  • If the server your live environment is on has, or can have, multiple IP addresses, then it is perfectly acceptable to host both the live and testing environments on different IP addresses on this server.
  • However, if you do not have access to a separate server to set up a testing environment, or if your current server cannot have multiple IP addresses, you can still create a testing environment on the same server using named virtual hosts. You will simply not be able to test the delivery of creatives from your testing enviroment without using new tag or modifying your existing tags. This is all explained below.
    • On your live environment server, create a backup of your live environment database:
      mysqldump -u root -p live_openx_database > live_openx_database_backup.sql

    • If necessary, copy the live environment database backup to the server where you will be creating your testing environment.
    • On the testing environment server, create a new database to host your testing environment.
    • "Restore" your live environment database into the new testing environment database. For example, if you are using MySQL:
      mysql -u root -p testing_openx_database < live_openx_database_backup.sql

    • Set up a new IP-based or name-based host on your web server for your testing environment.
      • If you are creating a new IP-based host for the test environment, set up the site name (i.e. the URL of the site) to be the same as your live environment. For example, in Apache you might have:
        # Live OpenX Site
        <VirtualHost 10.0.0.25:80>
            ServerAdmin  me@example.com
            DocumentRoot /var/www/html/openx-live
            ServerName   openx.example.com
        </VirtualHost>
        
        # Testing OpenX Site
        <VirtualHost 10.0.0.26:80>
            ServerAdmin  me@example.com
            DocumentRoot /var/www/html/openx-testing
            ServerName   openx.example.com
        </VirtualHost>
        
      • If you are creating a name-based host you will need to use a new site name (i.e. URL) for your site. So if, for example, you had your live environment set up as "openx.example.com", you might create "testing.example.com".
        # Live OpenX Site
        <VirtualHost 10.0.0.25:80>
            ServerAdmin  me@example.com
            DocumentRoot /var/www/html/openx-live
            ServerName   openx.example.com
        </VirtualHost>
        
        # Testing OpenX Site
        <VirtualHost 10.0.0.25:80>
            ServerAdmin  me@example.com
            DocumentRoot /var/www/html/openx-testing
            ServerName   testing.example.com
        </VirtualHost>
        
  • In the new directory for your new site, place a copy of the code of your existing live environment.
    • If you created a name-based host for your test environment:
      • Edit the OpenX configuration file(s) in the testing environment so that the URLs match the new URLs of the testing environment (that is, change all "openx.example.com" instances in the configuration file(s) to be "testing.example.com"):
        [webpath]
        admin                               = testing.example.com/www/admin
        delivery                            = testing.example.com/www/delivery
        deliverySSL                         = testing.example.com/www/delivery
        images                              = testing.example.com/www/images
        imagesSSL                           = testing.example.com/www/images
        
      • Edit the database details to point to your testing environment database:
        [database]
        type                                = mysql
        host                                = localhost
        port                                = 3306
        username                            = root
        password                            = password
        name                                = testing_openx_database
        persistent                          = false
        mysql4_compatibility                = false
        protocol			    = tcp
        

    Checking the Testing Environment

    Once you have logged into your testing site, it may help to customise the UI in some way (e.g. by changing the colours of the installation). This will make it immediately obvious upon logging in whether you are using the testing environment or the live environment, and reduce any chance of confusion.

    IP Based Testing Environments

    If all of your zones are using JavaScript ot iFrame delivery, when you have created a testing environment with the same URL as your live environment but a different IP address:

    • On your desktop computer, configure your host file to point the URL of the current live ad server to the new testing domain.
      N.B. When one or more zones are using XML-RPC delivery, the host file entry must also be changed on the web server(s) hosting the XML-RPC site. This will allow those sites to fetch ads from the OpenX server in the testing environment.
    • You can now go to the URL you normally use to access OpenX, log onto the OpenX testing environment, and ensure that it works.
    • You can also visit your normal website and check that delivery of creatives still works.
      While the host file is set up, you will not be able to access your live environment. You will need to remove the host file entry from your desktop computer to be able to do this.

    Name-Based Testing Environments

    If you have created a testing environment with a different URL to your live environment:

    • On your desktop computer, configure your host file to point the URL of the testing environment to the IP address the site runs on.
    • You can now go to the testing environment URL, log onto the OpenX testing environment, and ensure that it works.
    • If you want to test the delivery of creatives you will need to generate new tags. Alternatively, you can tag copies of your existing tags from your live site and edit them so that the URL used in the tags is from the testing site.

    Upgrading the Testing Environment

    Once your testing environment has been created and is working correctly, you can now test the upgrade of OpenX.

    Download the latest version of OpenX and follow the upgrade instructions - but perform the upgrade on your testing environment.

    Once the upgrade is completed, you can return to the Checking the Testing Environment section above and repeat your testing, to ensure that the upgrade has worked correctly.

    Upgrading the Live Environment

    When you are satisfied that the upgrade of OpenX has worked, and you are happy to upgrade your live setup, you can now repeat the upgrade process with your live site.

    Don't forget to backup your live environment database before you upgrade, just in case!