[Tutorial] Running Wappler projects on Cloud Foundry

Cloud Foundry is a cross-cloud enabler that is used by a number of banks and insurance companies, that is slowly being replaced by Kubernetes and other container technology that caught-in better. I don’t expect anyone to ever have to use it and to some extend I would not encourage it unless it is an imposed constraint, and if you find yourself in such a predicament, this is a small tutorial that will hopefully get through the main obstacles.

  • You’ll need to put a copy of your entire production on a separate folder - this will be your production folder where you will make changes and push them to CF. Remove the .wappler folder from this folder.

  • Remove any .htaccess, they will create errors 500 on your application instance(s). Whatever you were trying to enforce with it will need to be achieved via env variables.

  • You’ll need to change your connection file (dmxConnect\modules\Connections) and put either your environment variables from CF or hardcode the database credentials.

  • Assuming your are using PHP /MySQL, your MySQL microservice will probably be locked to strict mode and some queries will fail. In order to workaround this, you’ll have to modify dmxConnectLib/lib/db/Connection.php and append after line 76:

$this->pdo->exec("set session sql_mode = ''");
  • You’ll need to create a .bp-config folder and create a php/php.ini.d/php.ini folders and file. Your ini file should contain these extensions for Wappler to connect:
  • You’ll probably have a lib folder in your wappler project. This will not be pushed as CF already creates a similar folder. You’ll need to default its LIBDIR to something else. We do this by creating an options.json file at the root of your .bp-config folder with:
{ "LIBDIR":"library" }

(any other name will do).

  • You should be okay now, join your org, create a space, etc… and push your app with a CF command:
cf push appname -b php_buildpack -m 256M

Good luck!