Installing a Custom Site from Launchpad
In this tutorial, we will install a custom iHRIS Manage 4.0 site hosted on Launchpad. We will bazaar to download the code as well as discuss the basics on how to modify the code on Launchpad. We are assuming that you are using an Ubuntu Linux machine.
Our first goal is to install the iHRIS Suite 4.0. Then we will download the CSSC's iHRIS Manage Customizations. Next we will create the database and finally we will install the site in our web-server.
Launchpad First Steps
First you should create an account on Launchpad if you not have already done so. We will refer to this account as LAUNCHPAD_USER.
Since we will want to contribute to the code, we will need to create a ssh public key on your Ubuntu machine to add to Launchpad:
sudo apt-get install openssh-client ssh-keygen -t rsa
When prompted, press Enter to accept the default file name for your key. Next, enter then confirm a password to protect your SSH key.
Your key pair is now stored in ~/.ssh/id_rsa.pub (public key) and ~/.ssh/id_rsa (private key). Now you need to upload the public portion of your SSH key to Launchpad. To do this, open in your web browser:
https://www.launchpad.net/~LAUNCHPAD_USER
You will see a place that says SSH Keys with an exclamation point (!) in a yellow circle next to it. Click on the (!) scroll down until you see Add an SSH Key and a text box. We will paste our public key into this text box. To do so type in a terminal:
gedit ~/.ssh/id_rsa.pub
you can now copy the contents of gedit (the public key) into the text box in the web browser. Now simply click on the button Import Public Key
For every computer/account that you use you will need to repeat these steps to create and import a public key.
Bazaar First Steps
First we need to make sure the Bazaaar (bzr) version control software is installed:
sudo apt-get install bzr bzrtools
You may wish to read the five minute tutorial at this point. You should also let bzr know how you are:
bzr whoami "Your Name <your@email.add.ress>"
Join the iHRIS Team
Launchpad uses "teams" to control who can modify code it stores under bazaar.
If you wish to make modifications to the CSSC Customizations, you should join the ihris+cssc team.
If you are working on a joint project, but not the CSSC's customizations, you should create a team in Launchpad and add yourself to it as well as the team intrahealth+informatics. For example, you could create the team ihris+tanzania.
Downloading iHRIS
We will now download the iHRIS Suite from Launchpad using bzr (as opposed to the release tar.bz2 files) to get practice using bazaar.
Below, I will assume that there is only one user using the system, or at least only one user that should be modifying files in iHRIS. This is probably not the "recommended" way of doing things though.
Changing Permissions
We want to make sure we can easily modify files under /var/lib/iHRIS without having to use sudo all the time.
sudo mkdir -p /var/lib/iHRIS sudo chown -R `whoami`:`whoami` /var/lib/iHRIS
Release Code
Now we want to get the iHRIS Suite 4.0 release code from launchpad.
mkdir -p /var/lib/iHRIS/lib/4.0 cd /var/lib/iHRIS/lib/4.0 bzr branch lp:i2ce/4.0 I2CE bzr branch lp:ihris-common/4.0 ihris-common bzr branch lp:ihris-manage/4.0 ihris-manage bzr branch lp:textlayout/4.0 textlayout
These branches will always contain the latest release code.
Development Code
If you wish to work with the development code instead, you should do this:
mkdir -p /var/lib/iHRIS/lib/4.0-dev cd /var/lib/iHRIS/lib/4.0-dev bzr branch lp:i2ce I2CE bzr branch lp:ihris-common ihris-common bzr branch lp:ihris-manage ihris-manage bzr branch lp:textlayout textlayout
These branches will always contain the main development code, which may or may be working at a particular time.
Downloading CSSC's Customizations
Create a directory for Sites
First we will create a directory that will hold all the sites we have on our system.
mkdir -p /var/lib/iHRIS/sites/
We have two choices on how to download the CSSC Customizations. One possibility to download it to install it, but do not want to make any code modifications. The other possibility is to download the code and have it setup to modify the customizations.
Download CSSC Customizations for no Modifications
We can download the CSSC customizations to our site directory by doing:
cd /var/lib/iHRIS/sites bzr branch lp:~ihris+cssc/ihris-manage/4.0-central cssc-central-4.0
You can still make modifications to the code, but they do not automatically get put back to launchpad once you commit.
Download CSSC Customizations for Modification
We can download the CSSC customizations to our site directory by doing:
cd /var/lib/iHRIS/sites bzr checkout lp:~ihris+cssc/ihris-manage/4.0-central cssc-central-4.0
To see why we are doing a checkout instead of a branch, read this. To make sure everything is working OK, you should make sure the following succeeds:
cd /var/lib/iHRIS/sites/cssc-central-4.0 bzr commit -m "test commit" --unchanged
Creating the Database
We will create a database called `cssc_central_4_0` as follows:
mysql -u root -p mysql> CREATE DATABASE `cssc_central_4_0`; mysql> GRANT ALL PRIVILEGES ON `cssc_central_4_0`.* TO cssc@localhost identified by 'PASSWORD';
you should change PASSWORD to be the password you want.
Installing on the Web Server
Let us suppose we want to access the site at the URL:
http://localhost/iHRIS/cssc-central
Linking the Site
First we will need to link to our customized site under '/var/www' as follows:
sudo mkdir -p /var/www/iHRIS sudo ln -s /var/lib/iHRIS/sites/cssc-central-4.0/pages /var/www/iHRIS/cssc-central
Setting the Database
We will need to specify the database and database user/password we are using. To do so:
mkdir -p /var/lib/iHRIS/cssc-central/local cp /var/lib/iHRIS/cssc-central/config.values.php /var/lib/iHRIS/cssc-central/local/config.values.php gedit /var/lib/iHRIS/cssc-central/local/config.values.php
Look for the the following variables and set their values:
Variable Name | Value |
---|---|
$i2ce_site_i2ce_path | /var/lib/iHRIS/lib/4.0/I2CE |
$i2ce_site_database | cssc_central_4_0 |
$i2ce_site_database_user | cssc |
$i2ce_site_database_password | PASSWORD (the password you set above) |