Main

August 4, 2011

Checklist for moving a URL to Contao

We recently launched a redesigned website for Disability Services created with Contao. To launch the site site I needed to transfer the ds.umn.edu url from the old server to the Contao server. There were a number of steps involved in the transfer which is why I am documenting them here.

  1. Request a URL transfer from NTS by filling out DNS change form.
  2. Edit Apache config file to include statements for the new URL
  3. Restare Apache for the changes to take effect
  4. Change the website URL in Contao backend for the webroot page

In addition in our case had an alias www.ds.umn.edu that was pointing to ds.umn.edu. That alias also needed to move to the new server. I requested the change with NTS and then created a redirect in Apache configuration file to forward all requests coming to www.ds.umn.edu to go to ds.umn.edu

Website editing in Contao can be integrated with UMN Shibboleth login. In order to use Shibboleth login with the new URL, there were additional steps involved.

  1. Make sure you have SSL certificates installed on the new server for the URL that you are transferring
  2. In Apache config file include the certificate URL paths for the protected part of the site.
  3. Restart Apache for the changes to take effect
  4. Add statements for the new URL in shibboleth2.xml file
  5. Restart Shibboleth service for the change to take effect
  6. Add statements for the new URL in metadata.xml file
  7. Email the Identity Management and ask them to seed the new metadata.xml file

September 22, 2010

Configure backup of Contao sites on OIALinux server

Intro

My last few posts covered working with OIALinux server and moving Contao CMS managed websites from our unit's webserver to OIT hosted server. Next step is to set up backup of Contao websites. There are two distinct items that are necessary to back up:

  • Files that make up Contao sites
  • MySQL database that stores some the data about Contao hosted sites

By default all files in /swadm directory are backed up nightly with 30 retention period. This is done automatically without you needing to do anything.

In order to backup up MySQL however it is necessary to make regular "dumps" of the contao database so that those could be backed up.

Configure MySQL backup

From past experience I knew that configuring regular backups of MySQL can be tricky. I searched the web for the scripts that would do this for me and found AutoMySQLBackup sript. This seemed to do exactly what I needed and was easy enough to set up.

I followed the installation instruction on the AutoMySQLBackup sript page with an exception of the step 5 where you asked to place the script in /etc/cron.daily. Since swadm user doesn't have rights to /etc/cron.daily, I needed to set up crontab for swadm and configure an entry in crontab to run AutoMySQLBackup.

I found a good writeup on setting up crontab. By using this guide I set up crontab and placed an entry to run AutoMySQLBackup every day.

With MySQL dumps created and placed into /swadm/backup directory and automatic backup of all files in /swadm directory, the websites hosted by Contao are backed up.

September 21, 2010

Moving sites hosted with Contao CMS to OIALinux server

Background

We currently host 4 websites with a single install of Contao CMS. This installation of Contao was hosted from our own unit's Linux server. This article covers how I moved the four websites from our unit's server to OIT hosted Linux server. Many pointers on how to move the Contao sits were taken from the Contao documentation.

The move can be broken down into 7 steps:

  1. Create domain aliases
  2. Confige Apache httpd.conf file virtual host
  3. Copy over the files
  4. Change file ownership
  5. Copy the database
  6. Run the Contao install tool
  7. Configure the websites in Contao backend

1. Create domain aliases

Let's say that we had websites with following URLs:
  • siteA.unitname.umn.edu
  • siteB.unitname.umn.edu
  • siteC.unitname.umn.edu
  • siteD.unitname.umn.edu

I wanted to bring up the websites on the new server with different URLs. This would allow me to troubleshoot any problems with them and reduce the downtime to the production URLs. To do this, I requested 4 new DNS aliases to be assigned to the OIA Linux server from OIT Networking Services. Let's call these aliases:

  • siteA2.unitname.umn.edu
  • siteB2.unitname.umn.edu
  • siteC2.unitname.umn.edu
  • siteD2.unitname.umn.edu

Now I have URLs for my 4 websites that are all pointing to the new server.

2. Confige Apache httpd.conf file virtual host

In order to direct these aliases to correct location on the server I configured Apache to use Name Based virtual hosts. Since all four websites are hosted with Contao, I need to create one virtual host directive for the main server URL (name.unitname.umn.edu) and second virtual host directive for the 4 sites that are served with Contao.

NameVirtualHost *:80

<VirtualHost *:80>
ServerName name.unitname.umn.edu
DocumentRoot /swadm/web
<Directory /swadm/web>
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /swadm/web/contaosites
<Directory /swadm/web/contaosites>
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
ServerName siteA2.unitname.umn.edu
ServerAlias siteB2.unitname.umn.edu siteC2.unitname.umn.edu siteD2.unitname.umn.edu
</VirtualHost>

3. Copy over the files

Next, I created a compressed file of all files and directories of contaosites folder on the old server. This is where all the files are stored that make up the four websites. I copied the compressed file to the new server and uncompressed into /swadm/web/contaosites folder.

4. Change file ownership

In order for the Contao CMS application to work all files and folder have to be owned by the user account that is used by Apache webserver. On the old server which ran Ubuntu Linux, this account was www-data. On the new server which is Red Hat, the Apache runs under a user account called apache. Changing file ownership is something that swadm user account is not allowed to do. I send an email to oialinux at umn dot edu asking them to make this change.

5. Copy the database

Created a mysql dump file (mysqldum -B contaodb) of the Contao database and imported it into the mysql database ( mysql database < contaodb.sql) on the new server. I used this MySQL tutorial for the syntax.

6. Run the Contao install tool

Next I accessed http://name.unitname.umn.edu/contaosites/contao/install.php and logged in with the install tool username and password that I had used for my initial Contao installation on the old server. The installation tool allowed me to enter my database username and password to be used by Contao CMS.

7. Configure the websites in Contao backend

Once I had configured the database connection, I could access Contao backend by going to http://name.unitname.umn.edu/contaosites/contao with my browser and log in. Once logged in I navigated to Site Structure and changed the site website root DNS for each for the site to use the new aliases.

With this all 4 websites are active with new URLs. Once I have verified that everything works properly, I can transfer the correct site URLs to the new server.

September 20, 2010

Prepping OIALinux server for Contao CMS

Contao CMS system requirements

Contao CMS requires three items for hosting:

  • Php version 5
  • Apache web server
  • MySQL database server

OIALinux server currently comes with

  • php-5.1.6
  • apache 2.2.3
  • mysql-5.0.77

All software is installed, but it needs to be configure to work so that swadm user can administer it.

Configure Apache

Apache is installed into /swadm/etc/httpd directory. However the DocumentRoot directive in httpd.conf file needs to be edited to point to a directory in /swadm space. So first, I created a new directory called web in /swadm directory. Then I edited the httpd.conf file DocumentRoot directive to point to /swadm/web .

To test my configuration I placed a file called index.html in /swadm/web and started Apache (sudo /etc/services httpd start). Then I navigated to the server URL to see if I can see the contents of the index. html file.

Configure MySQL

MySQL server is installed, but it is not configured yet. To begin configuring MySQL:

  1. First become a swadm user:
    sudo su - swadm
  2. now we need to create a directory for MySQL databases:
    mkdir /swadm/mysql
  3. Next we change the datadir value in /etc/my.cnf to point to the MySQL database directory
    sudoedit /etc/my.cnf and change the datadir value with the text editor
  4. Next we launch the MySQL service
    sudo /etc/service mysqld start
  5. Since this was the first time starting MySQL it prompted me to choose if I wanted to run a secure installation. I chose yes. The wizard configured the system database and prompted me for a MySQL root password. Now we have a working instance of MySQL.

Create a new user and database for Contao CMS

Once we have a working MySQL service we can proceed to create a user account and database for storing Contao CMS information. I used this MySQL administration guide to help me with this task.

First, I created a new database:
mysqladmin -h localhost -u root -p create bedrock
Next, I created a new user and gave it permission to the database:

[prompt]$ mysql -h localhost -u root -ppassword
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.41

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> USE mysql;
mysql> SHOW TABLES;
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv |
| db |
| func |
| host |
| tables_priv |
| user |
+-----------------+
mysql> INSERT INTO user (Host, User, Password, Select_priv) VALUES ('', 'Dude1', password('supersecret'), 'Y');
mysql> FLUSH PRIVILEGES; - Required each time one makes a change to the GRANT table
mysql> GRANT ALL PRIVILEGES ON bedrock.* TO Dude1;
mysql> FLUSH PRIVILEGES; - Required each time one makes a change to the GRANT table
mysql> quit

Now we have a user account and a database that we can use for Contao CMS.

Install a Php plugin

Contao requires two additional extensions to be installed and enabled in PHP:
  • mbstring
  • SOAP

To enable these, send an email to oialinux at umn.edu and ask them to install it for you.

Now our environment is set up to install Contao.

July 29, 2010

Steps to implement UMN web template in Contao CMS

Overview

University of Minnesota has created a web template that features UMN header and footer . This template is becoming a requirement for all UMN domain websites by the end of 2010. The template code that is provided is includes the necessary css, javascript, and html files and is the easiest to implement if the website is created in Dreamweaver or another HTML editor. University Technology Training Center offers a class on implementing the UMN web template with Dreamweaver. If the website is not edited by simply a text editor, but rather with a web content management system, then implementing the UMN template can be more challenging. This article shows how to implement the UMN web template with Contao CMS (formerly known as TYPOlight).

Steps to implement UMN templates in Contao CMS

  1. Install Contao according to documentation: http://www.contao.org/documentation.html . Do not install the demonstration site.
  2. Download UMN web templates from http://www.webdepot.umn.edu/templates.php
  3. Upload Web template files to /contao_root/tl_files/umn_template
  4. Import UMN template CSS files into Contao:

    1. With the browser enter Contao admin interface (http://yourdomain/contao)
    2. Login
    3. Create a new theme under themes. Provide a theme name and theme author's name. For Folders select umn_template, for templates folder templates/umn_template folder (you have to create /templates/umn_template folder in Contao Templates area before hand).
    4. For the theme that you created, click on CSS icon, and then CSS import
    5. Import all css files that come with the UMN template
    6. Change the print style sheet to only apply to print and not all.
    7. Edit the CSS files to direct them to correct asset location (When css files get imported, they are re-created in the root folder of your site, but assets (images etc) are still in /contao_root/tl_files/umn_template .
    8. You may benefit from installing CSSeditor extension (note, does not work in Contao v2.9RC1 yet)
    9. Edit directives where it is pointing to images
  5. Create front end modules for the header:

    1. Create a new Custom HTML module and call it UMN header
    2. Copy everything between <!-- * BEGIN TEMPLATE HEADER (MAROON BAR)* --> and <!--END UofM TEMPLATE HEADER--> from index_2.7.3.html.
    3. Remove the last </div> tag. This </div> would otherwise close the wrapper div.
    4. Change the path to the Search image to tl_files/umn_2.7.3/assets/img/search_button.gif
  6. Create front end module for the footer:

    1. Create a new Custom HTML module and call it UMN footer
    2. Copy everything between <!-- * BEGIN TEMPLATE FOOTER--> and <!--END UofM TEMPLATE FOOTER--> from index_2.7.3.html
  7. Create a custom Contao template to work with your layout:

    1. In Contao back end, click on Templates, then New Template
    2. Choose fe_page.tpl for the template and umn_template as a target folder.
  8. Add <div class="container_12" id="bg273"> to the fe_page.tpl page, under <div id="container"> statement (not sure if we need to add another closing div tag because of this. Seems to work fine without it)
  9. Create a page layout that includes the modules:

    1. Include the header and indicate header height (UMN Template header and campus links are 85 pixels wide)
    2. Include the footer and indicate footer height
    3. Choose the number of columns
    4. Select the style sheets.
    5. Change the order of style sheets to be: 1. reset, 2. Text, 3. Template, 4. Optional, 5, print.
    6. Select the custom layout that you created
    7. Add <script type="text/javascript" src="tl_files/umn_2.7.3/lib/js/searchfield.js"></script> in the head section of the fe_page.tpl file to enable the search javascript here. Please note that this javascript conflicts with some of the mootools javascript such as image slimbox and possibly others.