1
votes

We want to start a project using spring and mongodb and finally want to deploy it on cloudfoundry. There will be three different applications which should be binded to a mongodb service i.e. all three applications need access to the mongodb database. Now we want to develop locally (without actually deploying to the cloud) using local mongodb and tomcat,...) since this way we get better debug capabilities, hot deployment, etc... (is this even possible with cloudfoundry?) How can i configure my spring applications in a way that they are using the locally installed mongodb when deployed locally and are binded to the cloudfoundry mongodb service wen deployed in cloudfoundry? Is this even a good idea to develop/deploy locally and deploy to the cloud at the end?

regards

1

1 Answers

1
votes

The envisioned development model for Cloud Foundry based applications is using a so called Micro Cloud Foundry for your local development needs, which currently/usually is a virtual machine (VM) based single node but otherwise complete Cloud Foundry installation 'in a box'.

  • The only downside of this approach is that (by default) you always need to resort to remote debugging techniques (even when developing locally/offline) rather than e.g. the change code and reload browser approach many dynamic language developers are used to enjoy.
    • Whether or not this matters largely depends on your development process, but it is probably fair to say that this approach favors more elaborate/mature coding techniques based on unit tests, continuous integration etc. - given you specified Java/Spring as your target language/framework you should be well prepared for this ...

Cloud Foundry endpoint targeting

Once you have such a VM in place, you simply need to switch the target Cloud Foundry endpoint and deploy to either one in an otherwise identical fashion, i.e. the Cloud Foundry runtime automatically takes care of binding to the respective services as usual, see e.g. Targeting Cloud Foundry:

Target Cloud Foundry in the Cloud:

prompt$ vmc target api.cloudfoundry.com

Target a standalone a Micro Cloud Foundry running on your local virtual machine:

prompt$ vmc target api.<domain>.cloudfoundry.com

Micro Cloud Foundry variations

Most Cloud Foundry vendors offer a custom variation of such a Micro Cloud Foundry VM, e.g.: