I'm not sure what method/plugin/CLI tools you are using for deployment to Cloud Foundry, but if you're using the Cloud Foundry Integration plugin, this may help.
I was able to deploy 2 separate apps bound to 2 different instances of MySQL services. The key info here is the "binding" of the services to your deployed app. It's possible that you've bound both your apps to one service. If you're using the CFI plugin, issue a cf-apps
and it will list your apps and what services they are bound to
+-------------+----+---------+--------------------------+--------------------+
| Application | # | Health | URLs | Services |
+-------------+----+---------+--------------------------+--------------------+
| app1 | 1 | RUNNING | app1.cloudfoundry.com | mysql-3xxxxxx |
+-------------+----+---------+--------------------------+--------------------+
| app2 | 1 | RUNNING | app2.cloudfoundry.com | mysql-exxxxxx |
+-------------+----+---------+--------------------------+--------------------+
If your apps are indeed bound to the same service, just do the following with the CFI plugin
- remove the incorrectly bound app
- issue a cf-create-service service-you-want
- take note of the service name of the newly created app
re-deploy your second app and bind to the new service you just created
grails prod cf-push --services=your-new-service-name-xxxx
NOTE: when you deploy, the CLI tool may ask you to optionally bind to the other service (the first app's service), which you don't want, so you'll need to answer appropriately. I'm not sure why it does that even when you've explicitly passed in the
--services
argument with the service you want.
Anyway, it's all in the docs and if you're not using the CFI plugin - IMHO you should - it's pretty awesome plugin.