Reputation: 520
When I connect to a datasource that is bound to a CloudFoundry app (service) I use the following command to open an SSH tunnel that allows me to connect to it.
ssh -L 55432:example-service-uri.amazonaws.com:5432 example-service
This works fine as long as the service is up and running. However, there are cases in which the datasource could actually be the problem for a service to not be able to reboot. When the service reboots / shuts down, the tunnel connection is also dropped consequently. The worst-case scenario would now be a state in which the service can not boot due to an inconsistency on the current datasource and no possibility of creating a tunnel to that database to fix the issue.
There is a workaround by simply binding the datasource to another functioning service. But this seems kind of hacky.
I understand that it this will be designed like this on purpose and in an ideal scenario I would not even have to make changes to my datasource at all. However, I would like to know if there is a nice way of connecting to a services datasource even when the service itself is down.
Upvotes: 0
Views: 66
Reputation: 15041
I think @LBA's answer is going to be the correct one here, because it gives you interactive access to your service, but I wanted to throw in one more possibility.
Cloud Foundry Tasks might also be a way for you to interact with your service and make the adjustments that you require. While it wouldn't give you a shell or interactive UI to talk to your service, you could write and run scripts that achieve the same thing.
https://docs.cloudfoundry.org/devguide/using-tasks.html
Tasks are a way to run a short-lived operation in an application container on the platform. The classic example of a task is running database migrations. Tasks can also be combined with cron
or some scheduler to run periodic batch jobs or other scheduled tasks.
The reason I mentioning tasks is because while tasks are associated with an application (they share the same droplet), they run independently of the actual application so it doesn't matter if the application is started, stopped or crashing. As long as the app has staged, you can run the task.
Hope that helps!
Upvotes: 1
Reputation: 4089
To my understanding there's no other way but creating some 'proxy-app' which has a binding to your service and which allows you an access.
Just as an example see how Swisscom PaaS (an official Cloud Foundry service provider) is proposing how to migrate a DB service to another in this article
Upvotes: 1