CloudFoundry PHP setup for TinyQueries
This is an application which can be used to setup TinyQueries on CloudFoundry using the PHP Build Pack.
It is an out-of-the-box implementation of TinyQueries PHP-libs v184.108.40.206 and is meant to be used together with the TinyQueries compile service to build a REST-api by only defining queries.
- Clone the app (i.e. this repo).
git clone https://github.com/wdiesveld/cf-init-tinyqueries cd cf-init-tinyqueries
- If you don't have one already, create a SQL database service. With Pivotal Web Services, the following command will create a free MySQL database through ClearDb. Currently you can either use MySQL or PostgreSQL.
cf create-service cleardb spark my-test-sql-db
- If you don't have one already, create a TinyQueries project. With Pivotal Web Services, the following command will create a free TinyQueries project through TinyQueries.
cf create-service tinyqueries free my-test-tinyqueries-project
Edit the manifest.yml file. Change the 'host' attribute to something unique. Then under "services:" change "my-test-sql-db" to the name of your SQL database service. This is the name of the service that will be bound to your application and thus available to this application. Do the same for "my-test-tinyqueries-project"
Push it to CloudFoundry.
- After the application is deployed you can use the TinyQueries IDE to create and publish queries to this application.
How It Works
When you push the application here's what happens.
- The local bits are pushed to your target. It includes the changes we made and a build pack extension for TinyQueries.
- The server downloads the PHP Build Pack and runs it. This installs HTTPD and PHP.
- The build pack sees the extension that we pushed and runs it. The extension downloads the stock TinyQueries file from GitHub, unzips it and installs it into the
htdocsdirectory. It then copies the rest of the files that we pushed and replaces the default TinyQueries files with them.
- At this point, the build pack is done and CF runs our droplet.