Contrib: Sakai Installer
Lead(s): Maarten van Hoof
DescriptionThe Sakai Installer project started as an experiment by Edia in running Sakai off a USB stick. We wanted to find a way to make it easier for people to give Sakai a try and at the same time we wanted something to hand out during the Amsterdam Sakai conference in 2007 that would make people notice us. I think I can say we succeeded in both.
The version that we're now open sourcing is an updated version of the one that we created the Sakai on a USB stick with. That USB stick contained an installer that does two things: it check for and installs a Java JRE and it starts a demo version of Sakai that is placed on the stick alongside the installer. Once started, Sakai runs entirely from the stick. The database is HSQLDB, which is stored on the stick itself. That means you can start Sakai from the stick, create users, sites, resources etc and than plug the stick into a different computer and find Sakai in the exact state that you left it in.
The source for the Sakai installer is in contrib: https://source.sakaiproject.org/contrib//sakai-installer/
How it works
The installer code was written using NSIS (Nullsoft Scriptable Install System), a professional open source system to create Windows installers. You can donwload it from http://nsis.sourceforge.net and get the Eclipse plugin from http://eclipsensis.sourceforge.net/index.shtml. It isn't actualy an installer at all, as we'll see shortly. The Java JRE is compiled into the installer, which is the way things are normally done with NSIS. We used JRE rather than the JDK because the JRE can be installed silently (by the NSIS installer, that is) and because we didn't have a lot of space on the USB stick. As it turns out, you can use the JRE as a server VM by just adding a dll to the JRE installation, which is what we do.
Sakai itself is not compiled into the installer (again because we didn't have enough space on the stick) but placed in a directory on the stick, alongside the installer. The installer simply calls start-sakai.bat in that directory. So as we said earlier, the usb installer isn't really an installer, it is just an executable that calls the start script of a Sakai demo version after verifying that Java is present and the JAVA_HOME variable has been set correctly.
Placing Sakai alongside the installer rather than comiling it into the installer itself has a number of advantages. Firstly, we can start Sakai from the stick rather than installing it somewhere in Program Files, which makes it completely portable. Second, we can modify Sakai in any way we like before 'shipping' the stick. In the original version that was handed out on the Amsterdam Sakai Conference, for example, we added the Skin Manager and the Maps tool and added out own skin. To make Sakai start faster, we ran Sakai once to expand all the war file. To save space on the stick, we then removed the original war files.
The disadvantage of having Sakai run from the USB stick was that it starts very slowly. I guess that on a more recent USB stick it would be faster, but Sakai isn't exactly starting up faster now than back when we used 2.3.1 for the Sakai stick.
Building Sakai on a USB stick
This assumes you are using Eclipse. If you don't, you can use the IDE that comes with NSIS.
- Install NSIS from http://nsis.sourceforge.net and the eclipse plugin by following the directions at from http://eclipsensis.sourceforge.net/index.shtml
- Download the source from https://source.sakaiproject.org/contrib/sakai-installer/trunk
- Download the latest Sakai demo version. Unzip that to the build directory, renaming the directory containing the Sakai demo version (unzipped as sakai-demo-x.x.x) to 'sakai'
- Optionally, start the Sakai demo version to expand the war files (saves time at next startup) and to make any changes that you want.
- Compile src/sakai_usb.nsi. That will create build/start-sakai-usb.exe
- Compile src/stop_sakai_usb.nse. That will create build/stop-sakai-usb.exe.
- Copy the contents of the build directory to a USB stick
- Start Sakai from the USB stick by running start-sakai-usb.exe. Stop Sakai by running stop-sakai-usb.exe
The first page of the Sakai on a USB stick installer.
The options page.
The last page; Sakai starting on the background.
Where this project could go
First of all, anybody can modify the code and the Sakai version on the stick to create a Sakai on a USB stick of their own. There are just a few script files that you can just browse through to find out how to change texts, graphics and Sakai version.
More interesting would be to create a proper installer. One that checks your Java version as the current one does and then goes on to install Sakai on your own computer to a location of your choice. That would actually be very easy to do, because it is the way that NSIS scripts usually work. Calling the Sakai startup script from the installer, as the USB stick version does, was the hard part.
Another option is to offer a couple of pre-configured Sakai instances. Like a typical instance for a high school, a typical collaboration environment or an OSP instance. This could be achieved very easily using different HSQL databases: the installer would allow the user to choose between these types and place the correct HSQL database in the installation directory.
An entirely open issue is building an installer that will work on Mac or Linux. NSIS can't do that as far as I know, so it would require a different setup entirely.