How to upgrade your TRIBiQ CMS 5.x Installation
This howto describes how to upgrade your TRIBiQ CMS installation from one version to another.
Let's assume your site is called http://www.yourtribiqsite.com and you are migrating from TRIBiQ CMS version 5.0.1 to 5.0.2.
If you are able to run two concurrent Apache virtual hosts while you migrate, this is the best and safest way to migrate.
You will be able to test your new installation fully, and you should be able to make an instantaneous switch from one to another, with no downtime.
1. Get the new package
Download and unpack the latest TRIBiQ CMS package on your web server.
If possible, place this in a new directory at the same level as your existing TRIBiQ installation.
For example, if you have /var/www/tribiq-5.0.1 then make the new one /var/www/tribiq-5.0.2.
You do not need to run the TRIBiQ CMS installer.
2. Copy the siteconfigs
Look in the "siteconfigs" directory of the new installation directory and delete the the global and mysitename config files:
> cd siteconfigs/
> rm global.php
> rm mysitename.php
Now copy the config files from the existing installation into the new one. For example:
> cp -p /var/www/tribiq-5.0.1/siteconfigs/* .
3. Copy the templates
Change to your templates directory and replace the default templates with a copy of your existing templates.
> cd /var/www/tribiq-5.0.2/templates
> cp -rp /var/www/tribiq-5.0.1/templates/* .
4. Copy other stuff
If you have a custom favicon, special applications in apps, or plugins, copy these now to the new directory.
5. Create a copy database
Your existing TRIBiQ database may be called something like tribiqdb_501. You will need to duplicate this and perform an upgrade on the copy, which may be called tribiqdb_502.
(If you prefer, you can simply make a backup of your existing database, in order to avoid duplicating the database. But note that this will mean your site has some downtime while you are performing the upgrade.)
You must either create a copy database, or backup your database.
If you use the mysql console program and you have MySQL root privelige, you will do something like this:
mysql> CREATE DATABASE tribiqdb_502
-> DEFAULT CHARACTER SET utf8
-> COLLATE utf8_general_ci;
Note that you must use the UTF8 database type to get correct multiple-character set handling.
Otherwise, use whatever method is right for your system for creating a new (empty) database.
You will need to give your database user permission to access the new database, or you may prefer to create a new "user". For example:
mysql> GRANT ALL ON tribiqdb_502.* to tribiq@localhost;
Before duplcating the old database's content, you should ideally do a MySQL FLUSH TABLES to ensure recent changes are written to disk, thus reducing the risk of corruption.
To duplicate the database, you can use MySQL's mysqldump program, mysqlhotcopy, or even simply copy the database files if you have a MyISAM database.
For example, from a Un*x shell, you could use mysqldump and mysql in batch mode together, like this:
bash> mysqldump -u tribiq -ppasswd tribiqdb_501 | mysql -u tribiq -ppasswd tribiqdb_502
6. Upgrade the new copy database
Once you have the new database, you need to apply that patches.
Download the relevant patches - sequences of SQL queries - from tribiq.com. If you wish, you can copy from the website and paste them locally.
You will need to apply these queries to your new database. If you are using the mysql console, go into it now:
mysql> use tribiqdb_502
and then apply the patches:
mysql> ALTER TABLE.... (and so on)
Paste in the patches, a few at a time.
Check the response from your server. If your database is very large, some queries may take a few seconds to run.
If you see "cannot add...duplicate column" errors, don't worry; your database may already have some of the patches applied.
Apply all the database patches, up to the latest version.
7. Optional: Create a New Apache Virtual Host
If it's important for you that you have absolutely no downtime during your upgrade, it is recommended that you create a new Apache Virtual Host to point to your new TRIBiQ installation directory.
This will enable you to test your new installation before going live.
To do this you should edit your Apache virtual hosts file, this may be conf/httpd.conf or similar, depending on your Apache and OS.
Create a new Virtual Host section with a new but temporary URL, say www502.yourtribiqsite.com. This should have a DocumentRoot at your new installation directory, e.g. /var/www/tribiq-5.0.2/.
Check your config is okay and if so, restart Apache.
8. Optional: Create a temporary DNS record
If you followed step 7, you should now set up a DNS record for your temporary URL; do this before trying to access it in your browser to avoid getting the data into your cache.
How you so this will depend on your method of managing DNS. Add an A record for www502.yourtribiqsite.com.
9. Test your new installation
Provided you have set up your DNS, you can now try going to the new URL in your browser, e.g. http://www2.yourtribalsite.com.
If you skipped steps 7 and 8, then at this point you will need to rename your web directory so that Apache now points to the new installation.
For example, rename /var/www/html to /var/www/html-501. Then rename /var/www/tribiq-5.0.2 to /var/www/html. Then go to your usual URL using your web browser.
You should now see your looking familiar, but with the new version of the CMS.
You should check that all is correct and that you can log in and administrer the site normally, albeit with the new functionality.
If you followed steps 7 and 8, then when you are satisfied that all is well, you should change Apache's Virtual Hosts so that the main URL for your site points to the new directory.
Troubleshooting
You should now be able to access your site in your browser.
It will now be using the new TRIBiQ CMS version, and the new database format.
You can now edit templates if you wish, or simply change DNS to point to your new installation once you are happy all is okay.
If you run into difficulties:
- make sure you have the correct patch according to the version you are going from and to
- if you are upgrading through several versions, make sure you apply the database patches in the right order.
- if these things fail you should look for Support in the tribiq.com forums, or ask for commercial support.