Getting started with sMash on a Virtual Private Server
It took less than an hour to get this blog up and running on WebSphere sMash on a Virtual Private Server, starting from nothing at all. Here’s how you can get started too:
.
1. Rent a Virtual Private Server
A number of hosting companies offer cheap VPS solutions, such as Linode or Slicehost. There are loads of comparison sites out there to help you pick one. I went for the Linode 360, mainly because it was recommended by a friend (thanks Saket!).
For about £15.00/month, you get a decent system which is permanently online… and you can essentially do anything you like to it. This is refreshing compared to shared-hosting environments, where shell access is unavailable or heavily restricted, and software installations are controlled by the provider.
.
2. Set up Your Environment
Linode (and presumably other services too) provide a slick dashboard from which you can configure and monitor your virtual server.
You can start by choosing from a selection of OS images, which will be installed in seconds without requiring any interaction on your behalf. Next, you can quickly set a public key in the dashboard and SSH right into your virtual box.
It’s then up to you to configure your environment as you please. I simply created a non-root user and installed a few packages using apt-get, including unzip, MySQL and Java.
.
3. Install sMash
Installing sMash is trivial:
- Download sMash from projectzero.org
- If necessary, transfer it to your virtual system (e.g. using sFTP).
- Unzip it.
- Add the zero directory to your path.
Done!
.
4. Secure AppBuilder
AppBuilder is a sMash web app that allows you to create, build and manage other sMash web apps.
You don’t have to use AppBuilder if you don’t want to (you can use the command-line interface and whichever text editor you prefer), but it provides some nifty visual tooling which is definitely worth playing with.
We need to do a spot of configuration to be able to access AppBuilder remotely. In particular, we don’t want anyone to be able to create and edit apps on our VPS, so we need to secure it. Here’s how:
- Go to you AppBuilder directory, e.g.:
cd zero/installed/appbuilder
- Create a new user for AppBuilder. You can do this by running the this command and following the prompts:
zero user
- Run the following command, which will generate a random secret key for you:
zero secretkey
- Edit zero/installed/appbuilder/config/zero.config to allow access from any ip address, but to restrict access to your authenticated user. Here’s what my config file looks like:
## Disable localhost restriction
/config/http/ipAddress = "*"
## enable security for the application
@include "security/enableSecurity.config"
## authentication type is BasicAuth
@include "security/basicAuthentication.config"
## ***** Use your own secret key here. *****
## You can get one by running the "zero secretkey" CLI command in your app directory.
/config/security/secretKey = "GnokLNQooWA1ieff2kiXtw=="
## ***** Replace username as appropriate. *****
## You can manage users by running the "zero user" CLI command in your app directory.
@include "security/authorization.config" {
"users" : ["username"]
}
- Start AppBuilder by running:
appbuilder open
Done! You can now access AppBuilder on your virtual system’s ip address on port 8070. You will be prompter to login with the user account you created above.
.
5. Get Busy!
You can now access AppBuilder and start building sMash apps! You could build an app from scratch, or start off from one of the sample apps.
You can also install PHP apps you know and love like WordPress and Drupal. If you’re using MySQL with your PHP app, remember to add the mysql-connector-java dependency to your app’s ivy.xml. If you miss this out, your PHP app won’t be able to communicate with the database.
<dependency name="mysql-connector-java" org="mysql" rev="[5.0.0.0,6.0.0.0["/>
Lastly, if your sMash app is going to be a low traffic blog (like this one), you might want to consider tweaking the ZSO recycling options to avoid the JVM idling out between every single visit to your site.
.
6. Further Resources
- For more info on building apps in sMash, check out the developer guide.
- Keep an eye on the projectzero.org blog for news & tutorials (including lots of videos!)
- Don’t hesitate to post on the projectzero.org forum if you have any questions or feedback!


