Starting studio with a supervisor service

If you want your studio to automatically start with some service running under the supervisor, you’ll need a couple tricks

First, the supervisor normally gets started up after your .studiorc script is sourced. So to manipulate it, you want to start the supervisor yourself during .studiorc's execution. Luckily, there’s an environment variable for disabling the built-in supervisor launch and you can set it from .studiorc:

export HAB_STUDIO_SUP=false

Then, you can use the sup-run command that’s already specially setup for the studio environment and take advantage of it passing any additional arguments through to the supervisor, like an initial service to start:

sup-run core/postgresql11

That’s it, postgres will be running (or at least starting to) when your studio user gets to their prompt. As always, use sup-log to see all service’s output.

If you need to do something with your service during .studiorc, like seed a postgres database, you’ll need to come up with some loop that waits for whatever interface you connect with to be ready.