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:
Download or clone OpenVBX (http://www.openvbx.org/)
Add a file called
helper.php at the top level OpenVBX directory with the
content below. This will simply display the content of the config files that
the OpenVBX installer changes. (We will remove this file after installing
OpenVBX, as it exposes sensitive information.)
Create a new AppFog app and MySQL instance. Bind the MySQL instance to your app. Deploy your app to AppFog. (http://blog.appfog.com/getting-started-with- appfogs-command-line/) Make sure you start with a fresh MySQL database, don’t attempt to re-use a database from a previous installation attempt; it will not work.
Navigate to your http://YOUR-APP.aws.af.cm/helper.php.
In a separate browser window, navigate to http://YOUR-APP.aws.af.cm and run through the
OpenVBX install process. Use the database connection settings displayed by
helper.php to configure the database. You do not need to enter the port
number, just the database hostname (which was an IP address for me), database
name, username, and password. Continue through the rest of the install
process. This will initialize the database.
Once the installer has finished and you see a login prompt, refresh
http://YOUR-APP.aws.af.cm/helper.php. You will see that the installer has created
database.php config files. Copy that content, and use it to create
database.php files locally.
Redeploy your app. In theory, you should see a login prompt when you navigate to your app’s URL.
<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>
Content © 2006-2019 Rusty Klophaus