Deployment to Platform-as-a-Service (PaaS)
Cloud computing providers offer their services according to several fundamental models.
PaaS provisions more than just a virtual box but rather a complete runtime environment. Regarding Cloud-Foundry we saw following pros and cons.
built-in failover support
monitoring and health check on application level, if application fails to respond, new node will be spawned
very easy scaling
no vendor lock-in, we can migrate to different cloud-foundry supported vendor if needed (for example appfog or mopaas, others: http://core.cloudfoundry.org/listings)
no or very little persistent disk storage (so deployed applications mustn’t have file system access)
maybe they rise the price – like all the others
according to developers of this solution cloud foundry core it’s still in the beta stage, but there are other cloud foundry providers that claim to have stable and ready solution (like appfog.com)
Needed changes for cloud-deployment
As of the temporary/ephemeral filesystem on PaaS model and only being able to deploy only a ‘war’ file, this means that external configuration has to be stored inside war file also. We can however use environment variables. So we decided that all module configuration properties files are stored inside war file.
Deployment to Cloud-Foundry
Deployment to CF can be done via the cf which is Cloud Foundry’s command line interface. It is a ruby-gem so you need to install ruby for it. You can use cf to deploy and manage applications running on most Cloud Foundry based environments, including CloudFoundry.com.
$ cf target https://api.run.pivotal.io Setting target to https://api.run.pivotal.io... OK $ cf login Email> firstname.lastname@example.org Password> ******* $ cf push
We also used Domain-Mapping in our setup. A Cloud Foundry instance defines a default domain that is available to all internal CF spaces (for example development, staging or production). In the Pivotal-hosted instance of Cloud Foundry, the
cfapps.io domain is automatically mapped to all spaces in all organizations. In our setup we needed to map one of our clients registered domains to one of our own spaces in Cloud Foundry.
$ cf map-domain --space development example.com
Monitoring options with CF
You have access to basic informations about the application instances. It contains information like Instance ID, CPU usage, Memory usage, Disk usage, Uptime, State (ie. Running, Stopped and Flapping (alternating between being “up” and “down”)).
Through the console you have access to:
standard output log and and standard error output logs for instances
instance-related events such as ‘out of memory’ or module configuration errors
Through the CloudFoundry services you can provide high end monitoring support, with use of external tools (ie. https://newrelic.com). In order to make it work one would need to introduce some code changes and add a library that would allow to monitor the application health.