Run Symfony2 on AppFog?12 Mar 2013
TL;DR You can’t (no shell access to run commands).
I have been trying to deploy a Symfony2 application on AppFog. I tried first a PHP Hello World, it was pretty easy. Then deploying a Wordpress was a little bit more challenging as you have to automatically hook up the database to Wordpress and tell Wordpress to use S3 to host any static content (AppFog does not offer persistent storage yet). But a complete Symfony2 application is a lot harder.
Here is my checklist of things a Paas have to support in order to run a complete Symfony2 application.
I would be really interested if you have a way to go around one of these problems.
Run Symfony2 commands
With Symfony2, you absolutely need to run commands in the production environment (cache, migrations, assets, vendors, …) and there is no shell access in AppFog. I haven’t found any way to get around this.
Run post deploy hooks
Same idea as previously, there is no way to do that in AppFog yet.
Run cron jobs
web/as the Document Root
On AppFog, we can’t edit the virtual host configuration but we achieve the same goal by using URL rewritting with another
.htaccessat the root directory.
AppFog does not deploy with git but uses its own tool, af, which is similar to rsync. We can specify a
.afignorefile in the root directory that will be the equivalent of
Set the database parameters
AppFog launches the database instance at the same time we deploy and passes the database parameters into the
VCAP_SERVICESenvironment variable. So we can have a PHP config file (instead of Yaml) that reads the environment variable and save the parameters in the service container, like in the Wordpress example.
Have persistent storage for
AppFog does not offer persistent storage yet. We can use Gaufrette to use S3 as our file system. It does require to change our application code though.
Available out of the box
In AppFog, all the root directory and all subdirectories are writeable. Files are just not persistent but it doesn’t matter for those two directories.
Use root domain names
AppFog supports root domain names out of the box.
web/app.phpas front controller
AppFog is using Apache with the directive
AllowOverride Allso the standard
.htaccessis working to redirect all trafic to