Adding shell scripts. Package dependency of job? Collocated job?

26 views
Skip to first unread message

Mark Rushakoff

unread,
Jul 25, 2013, 12:38:55 AM7/25/13
to bosh...@cloudfoundry.org
We have some shell scripts that we want available on our jobs that BOSH manages.  We successfully made a package containing the shell scripts and we were able to add it to the packages of a job spec and it deployed correctly.  However, this is only the first step in making the scripts useful.  There are two things we are struggling with.

First, we still need a way to add the bin directory of our scripts on the PATH of a user who has `bosh ssh`ed to the machine.  Ideally we would ensure that ruby is on the path as well, as some of our scripts call ruby scripts.  We have no idea where to begin with this one.

The other problem is that because the scripts are in a package that is a dependency of the job, we can't update the scripts without redeploying the whole job.   This is a production system, so we don't want to bring jobs down and back up if it's easily avoided.  We think that we may be able to create a new job with our scripts as the dependency and then collocate that job with our important, real jobs.   That way, redeploying the "scripts" job should only effectively update the script files.  However, this seems to loop back into our first problem where we want to ensure that the scripts are available on the default PATH.

We considered just putting a "bootstrap" script on the jobs that would download the scripts from the internet, but we are not guaranteed that our jobs will have internet access.

Because we would like to easily update the scripts, we don't want to put the scripts in the stemcell either.

Has anyone been in a similar situation? Is there an easy or obvious way to solve the problem we're facing?

Thanks,
Mark

Matthew Boedicker

unread,
Jul 25, 2013, 1:05:12 AM7/25/13
to bosh-dev
Is there any way to do what these scripts do over ssh? It seems like it would be easier to manage them if they didn't have to be deployed, especially if they will change a lot.

If it is general purpose functionality maybe it could be incorporated into the agent and exposed in bosh itself.

Dr Nic Williams

unread,
Jul 25, 2013, 1:31:08 AM7/25/13
to bosh...@cloudfoundry.org, bosh-dev
In bosh-gen (as an example of a pattern that I codified) some helper scripts are generated into each job. They are duplicates of other jobs, but it allowed them to be independently edited (if necessary) whilst developing the job.

If they are common scripts then perhaps they can be converted into a package after that (or the ideas Matt just mentioned)

Also look at what bosh-gen generates for how it creates $PATH and other env vars for each job. Perhaps some ideas in there for what you're trying to do?
--
Dr Nic Williams
Stark & Wayne LLC - the consultancy for Cloud Foundry
http://starkandwayne.com
+1 415 860 2185
twitter: drnic
Reply all
Reply to author
Forward
0 new messages