User Tools

Site Tools


eg-252:deployment

Deploying Your Drupal Website

Dr Jobling has made some notes on the procedure to adopt in order to move your Drupal web site from the staging server on the private ICCT network to the deployment server on eespectre.swan.ac.uk.

Preparations

Before you move the web site there are a few things that have to be done on your staging server. These instructions assume that you are logged into your staging machine as administrative user icct, you are using the XAMPP system installed in /opt/lampp, that Apache and MySQl are running (sudo /opt/lampp/lampp start), that http://localhost/ is the XAMPP control page, and you have installed and configured Drupal to run as http://localhost/drupal. Adjust the instructions if your configuration is different.

Step 1: Turn off Clean URLs

Login to http://localhost/drupal as the administrator (user 1) and use the administration control panel to disable Clean URLs. This will enable you to be able to administer your Drupal web site when it is brought up on eespectre.

Step 2: Export Your Drupal Database

  1. Open phpMyAdmin (http://localhost/phpmyadmin) and select the drupal database.
  2. Use the export option to create a copy of the database as an SQL query file.
  3. Select the option to create a gzipped file (drupal.sql.gz)
  4. When prompted save the result to your ~icct/Desktop.

Step 3: Make a tar archive of your Drupal directory

Follow the following script to create a tar archive of your Drupal installation (includes all uploaded files, themes and modules, and maintains file permissions):

cd /opt/lampp/htdocs/drupal
tar cvfz ~icct/Desktop/my-drupal-site.tar.gz .

Set Up on the Deployment Host

Your group's web site will be hosted on server eespectre.swan.ac.uk as a user directory according to the following naming convention:

For this to work, Dr Jobling will need to create a user account for each group and a MySQL database for your Drupal site. The user account will be alpha2010, bravo2010, charlie2010 etc. The database will be drupal_a2010, drupal_b2010, drupal_c2010, etc, and the user name will be the same as for your user account (the passwords should probably not be the same). This step will be done by Dr Jobling from the Engineering PC network using the putty SSH client and http://eespectre.swan.ac.uk/phpMyAdmin. When you are ready for this step, please liaise with Dr Jobling so that you can choose a password for your user account and the drupal database. Once this step is complete, you can perform the rest of the deployment yourself from your staging host.

Deploying Your Drupal Site

Step 4: Deploy the Database

  • Open phpMyAdmin on eespectre (http://eespectre.swan.ac.uk/phpMyAdmin); login using the user name and drupal database password that Dr jobling set up for you in the previous step.
  • Select the drupal_* database that is visible to you.
  • Use import to upload your SQL data from your Desktop into your new database on eespectre.

Step 5: Upload and Deploy Your Drupal Site

For this step you will use scp to copy your archived Drupal site to eespectre, and ssh to login to eespectre and complete the installation. Once this step is complete you can continue to use these tools to upload modules and themes, etc, or you can use putty and an FTP client (I recommend FileZilla used in sFTP mode).

You should note that on eespectre, your Drupal site will be unpacked in directory ~/public_html. This directory should have been created for you when your group's account was created by Dr Jobling. It is this directory that is served as /~group2008 from the web server.

  • Copy your archived Drupal site using the command scp ~icct/Desktop/my-drupal-site.tar.gz group2008@eespectre.swan.ac.uk:public_html (you will be prompted to enter your password at this point).
  • Use ssh to login to your account on eespectre and unpack your drupal site:
icct@icct-host:~/Desktop$ ssh group2008@eespectre.swan.ac.uk
(password)
group2008@eespectre:~$ cd ~/public_html
group2008@eespectre:~/public_html$ tar xvfz my-drupal-site.tar.gz 

You now have to make a couple of edits to your Drupal settings files.

  1. Edit ~/public_html/sites/default/settings.php to change database URL to match youe new account settings.
  2. Edit ~/public_html/sites/default/settings.php to make new Drupal compatible with clean URLs. To do this you'll need to uncomment the setting for the base URL for your site and change the entry to /~group2008.

Step 7: Go to your Deployed Drupal Site

If all has gone well, you should be able to access your deployed Drupal web site at http://eespectre.swansea.ac.uk/~group2008. Even better you can now administer this site from any machine. You just need a web browser and a web connection!

You should now be able to re-enable smart URLs and continue to add users and content.

To install new themes and modules you can use either scp or an FTP client to upload modules and thmes to your new site, or you can ssh into your account on eespectre and download modules and themes directly into ~/public_html using wget. Even better, you own the installation directory so there's no need to use sudo to make configuration changes anymore.

Some Additional Tips

If you are going to customize your themes, create a site-specific themes directory (mkdir ~/public_html/sites/all/themes) copy the theme to be customized the theme from the ~/public_html/themes directory to the ~/sites/all/themes directory.

If you want to administer your Drupal site from a windows machine, acquire a copy of putty (ssh client) and FileZilla (free open source FTP client).

If you need to make changes to the PHP and CSS code for theming and site configuration, investment of some time to learn one of the vi or emacs editors will repay your investment. Both editors are available on eespectre and both have online tutorials:

  • for vi type vi to launch vi then type :help tutor to run the tutorial;
  • for emacs type emacs to start the editor then Ctrl-h t to run the tutorial.

Both editors are light-years ahead of nano for serious code editing, both are also available for windows, and both work in an terminal window and so are accessible from within an ssh session.

For those of you who like to watch, there's a series of Screencasts on using vim (which is the version of vi that's installed in most linuxes and is available for windows).

eg-252/deployment.txt · Last modified: 2011/01/14 12:45 by 127.0.0.1