Packaging Your Squeak/Pharo Image for Deployment

Table of Contents:

There are two schools of thought, as far as preparing a Smalltalk image for deployment to a remote server:
1) Start with a minimal clean image, and only load the libraries and classes that you’re actually using to run your application.
2) Take your development image, and strip out unnecessary applications, GUIs, and the development environment itself

The first method is slightly more difficult but very rewarding, especially if you’re going to go the Continuous Integration route (via Hudson/Jenkins), because it requires you to know exactly which packages you’re using, what they depend on, the load order, and so on. We will explore this approach in later posts.

For this tutorial, though, we’ll use method #2, with help from the Preparing for Deployment chapter of the Seaside book.

Things to Remove for Deployment

  1. The Developer Toolbar
  2. All the default applications (except our Hello World one).

First off, what is the Developer Toolbar? It’s the dev mode menu that Seaside automatically inserts at the bottom of your applications, to help you with configuration, session resetting, and so on, and it looks like this:

seaside_dev_toolbar

You definitely want to disable it when deploying your application to a production type server. Fortunately, the code that unregisters all of the extraneous default applications (see below) also removes the dev toolbar.

First, unregister all applications with Seaside (to view the list of the applications that are installed, pull up http://localhost:8080/browse)

WADispatcher default handlers do: [ :each | 
   WADispatcher default unregister: each ]. 

Next, re-register our Hello World app, since that’s what we actually want to deploy:

WAAdmin register: RHelloWorldComponent 
  asApplicationAt: 'helloworld'

Now, double-check that our application is running on our localhost server at http://localhost:8080/helloworld, and that the others (such as /config or /browse, aren’t).

The last step is to save the image. I recommend the Save As route, so as not to overwrite your development image — left-click on the Pharo desktop to bring up the World menu, select Save As:

seaside_world_menu
And pick a name for the new image, such as:

seaside_save_image_as

Now your image is ready to be shipped to a remote server for deployment.