I'm writing a custom build pack for Cloud Foundry to run a third-party application over which I have no control. This application (C/C++) executes code defined in metadata (configuration). It also hosts a JRE so that it can interact with Java code. The application does not communicate over HTTP. It instead uses a proprietary protocol to send messages to it.
To utilize Cloud Foundry's routing and elastic scaling, I'm writing a Java web application whose purpose is to:
- Listen on
$PORTfor incoming HTTP requests - Forward HTTP requests to the application using its protocol
I understand that it's not best practice to execute multiple processes within a container, but, is there a way of specifying multiple commands to execute in parallel and have Cloud Foundry:
- Forward each process's output
- Monitor if any child process dies and restarts the whole container if it happens
- Gracefully shuts down all the processes when scaling down/stopping/restarting, etc.