Running OpenVBX on AppFog

April 25, 2013


Some notes on installing OpenVBX (Twilio’s open-source, web-based phone system) on AppFog (a public cloud Platform as a Service). In theory, this approach should also work for Heroku.

The main challenge in getting OpenVBX to run on AppFog is that the OpenVBX installer appears to work out of the box on AppFog. But then, when you redeploy your app, you overwrite the config files generated by the installer, so all of the changes are lost. This is because the installer overwrites some config files.

At this point, if you turn to the OpenVBX docs, it appears that your solution is to skip the installer and instead update the sample versions of the config files. This WILL NOT WORK for two reasons: 1) it won’t create the database and 2) it won’t actually set the settings correctly, leading to some weird confounding error. In my case, I experienced an infinite redirect loop.

The actual solution is fairly simple: run through the complete installation process, let the installer properly initialize the database and generate the config files. Then, use a helper script to grab the contents of the config files, and recreate them locally.

Here is a step-by-step guide:

helper.php

<h1>Database Settings</h1>
<pre>
  <?= htmlspecialchars(getenv("VCAP_SERVICES")) ?>
</pre>

<hr />

<h1>openvbx.php</h1>
<pre>
  <?= htmlspecialchars(file_get_contents("OpenVBX/config/openvbx.php")) ?>
</pre>

<hr />

<h1>database.php</h1>
<pre>
  <?= htmlspecialchars(file_get_contents("OpenVBX/config/database.php")) ?>
</pre>

« Back