This app implements a very simple blogging app to showcase our a9s MySQL service on CloudFoundry. It is based on Ruby on Rails 5.1. The most interesting part is most likely the manifest which is used to give the CF CLI information about your app. Please this page for more information.
Register on paas.anynines.com to obtain an account which allows you to push your app. After, you created the account and targeted (cf target ...) the desired org/space, execute the following steps (this create a small MySQL service instance):
cf create-service a9s-mysql101 mysql-single-small mysql1
... <wait for service to be created> ...
cd <path to>/a9s-mysql-app
... edit the manifest.yml and replace the name of the service in the 'services:' field ...
cf push
This uses the mysql-single-small plan for a small, non-replicated MySQL server. Use the following command to find out which plans are available:
cf marketplace -s a9s-mysql101
If you push/start the app before the service is available, it will fail because it assumes a MySQL database server to be available.
# start MySQL
docker run --name mariadb -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mariadb:10.1
# install app dependencies and start the server
bundle
bundle exec rake db:setup
bundle exec rails s
Open http://localhost:3000/ in your browser.