Using Stackato for PHP Applications in a Private PaaS

I like new shiny things.  I think this is a full blown addiction at this point, and thanks to a lot of great people and companies in and around the PHP community, test driving the latest and greatest software is never more than a few clicks away.  On top of that addiction, I am also inherently lazy.  That’s not exactly true…I guess the best way to describe it is that I lament “maintenance mode”.  You know what I am talking about.  Maintenance mode is what happens when the new app you are building is done and deployed, and only requires your attention for routine tasks (routine is just a nice word for mundane, really).  Yuk.

One of the sore spots I have where technical debtinfrastructure debt or any other kind of debt is concerned is the environment where apps run.  I know I have apps that have little issues lurking about, I am clear on that.  They may not reveal themselves today, tomorrow, or the next month, but eventually I will have to fix something & I am fine with that.   What I am not fine with is another developer’s app on the same stack blowing up the server, the database, or even my app because their code is a shambles.  That to me is unacceptable, and the fear of it is simply maddening.

Inside the corporate firewall though, this is all to common.  There is one server hosting a multitude of small apps, all of them right next to each other, and it’s like a powder keg waiting to go off.  So, now it is settled, I want to stay inside the corporate firewall, but I want each application isolated from the next, and by the way, there is no budget for any of this.  I posted about three PaaS providers a while back, and started thinking that what I really needed was PaaS, but I needed to be able to host the PaaS environment inside a corporate LAN.  Off to search the web.

Surprisingly, there were not just a ton of viable results in that search.  Even more surprising…hard to find one with a “download here” button.  No matter how I searched though, one company & product kept popping up:   Stackato by ActiveState.  The words “Free Micro Cloud” were a very encouraging sign.  So let’s take this thing for a spin and see just how easy it is…

Installing Stackato

Once you head over the download page for Stackato, you have a few options.  I wanted the on-premise solution so, I hit the link for download under free micro cloud.  Fortunately for me, I use Virtualbox and they have a pre-built virtual machine ready for download as well as options for vSphere, VMWare, and KVM.  That’s a very good sign for me.  Having this prepackaged and ready to go as a virtual machine should make this process pretty simple.  You do have to fill out a short form, but there is no registration or anything, so it didn’t feel overly intrusive.  It’s a 1.5Gb download, so you have some time to read the manual while you download.  The upside is that you get the Documentation link on the download confirmation page.  The downside…you would think installation would be at the top of the documentation, but it’s closer to the bottom, under Server Configuration.  It is only there that you find that the recommended version of VirtualBox is 4.1.  Now is that only 4.1 or >= 4.1?  I am running 4.2… and really that info should have been available prior to download, but ok I am already committed, so let’s see what happens.

Ok, now it is downloaded.  I could give you screenshots of the process to import the VM into VirtualBox.   But if you follow the instructions from ActiveState to the letter, you should not have a problem.  They are very self-explanatory, and the process to import the VM went off without a hitch.  I started the VM and Stackato (running on Ubuntu) started right up.  Once startup is done, there is a local address e.g. https://stackato-spm5.local given on the VM display that you can navigate to.  Caution: it is a self-signed certificate, so you need to accept that to keep moving on.  You get prompted to create a cloud administrator account as shown below.

Screen Shot 2013-03-17 at 9.36.03 AM

Your First App

Stackato has 40 or 50 apps you can deploy right from their console, such as Drupal, CakePHP, Jenkins, WordPress, etc.  If you want to deploy your own app, you have to install the Stackato Command Line Client, and the link to do that is provided on the console.  I would recommend that you put the console app somewhere in your path, or add its location into your path, just to make life easy.

From there deployment is pretty easy. Again, no need for screeshots, just go to the /docs/deploy/index.html page for your Statckato VM and everything you need to know is there.  Target the server  using the stackato target <server name> command,  login to the staccato server from the command line with  stackato login , and then deploy your app using the stackato push  command, which requires you to answer a few questions, but generally works as shown below.

Screen Shot 2013-03-17 at 9.49.26 AM

You can make life easier by including a .yml file in your app called stackato.yml to set the type of environment (e.g. PHP), document root, services to use, urls to map to the location, environment variables, etc.  As a very simple example:

There are also all kinds of options for hooks, versioning, ignoring certain files or directories, the list goes on.   The end result is an app deployed on a PHP 5.3 platform running under Apache.

Getting Connected

As you can see, I went ahead and bound MySQL to my app, but there were also options for several other services too.  Connecting to the database service from Stackato is relatively easy and is documented pretty well in the language specific deployment for PHP in the Stackato online documentation.  Basically, the information is stored in an element of the $_SERVER array.  There is also a complete set of details for all services in JSON format under the “VCAP_SERVICES” environment variable.

Other Features

Just a quick browse through the documentation indicates that there is some decent flexibility for controlling the apps and the environment:

  • Custom, per-app php.ini files
  • Changing the document root
  • Creating persistent sessions through an environment variable
  • Worker applications
  • Crons
  • Environment Variables


All in all, the whole set up is pretty simple.  From the time I clicked download until the time I had my app up and running in its most basic form took only about 38 minutes, and as I said, that included the 1.5Gb download time.  Granted I did’t go back and reconfigure database connections and deploy the data to MySQL, but that would have been about 20 minutes max.  To me, this is pretty easy, and I like the flexibility and information that the management console gives.

Now to decide what to use it for… At the very least, I am going to run it as a place to push apps I want to test, and I can see where this can have a place in our production environment, especially as somewhere to host a lot of our smaller, special-purpose applications, where we want to get up and running quickly without risking existing infrastructure.

It seems to be a good app thus far.  It is also well documented, though I think the organization of the docs could flow a little better.  Overall, if you want PaaS and you want to keep it inside your network, Stackato may have something to offer you.  I don’t work for them, never met them, and if it was a terrible app,  I’d be just as apt to write about that too. However in this case, ActiveState seems to have positioned themselves pretty well with this product, and they done a good job making it easy to get and start using with relative ease.


, , , ,

Comments are closed.