I am writing some bootstrapping scripts to manage downloading a bunch of data from s3, creating a postgres db, dumping the data into it. Dependencies are on s3cmd and postgres being available from your local package manager.
The idea behind these scripts is largely to guide someone new to the project in setting up their machine with the right data in the right location. Where they need to get access keys and other credentials (from me by magic secure pixie delivery, not in source control), I want them to know what they need and where to plug these things into the script where possible. It's about getting a smart person up and running quickly, avoiding many manual steps etc. I don't need to go full, all-out puppet - happy to make the script stop with a message "Now go and install foreman".
The fact I am concerned with databases etc. is more to do with the nature of our current project. It's a technique I have used/seen used in the past to set up AWS permissions, local dev servers and the like. I originally saw the idea from a presentation by Github about some of their dev practices which I cannot find now. An example here: https://github.com/github/developer.github.com/blob/master/script/bootstrap
The pain I am currently experiencing is with scripting. These scripts normally start out as shell scripts, but become progressively more complicated as you start to do stuff like check whether files exist, programs are installed, services are running etc. I have lost count of the number of times that I have googled "bash test whether a file exists". This is only the pain spent writing the scripts, maintaining them is another problem. As application developers, we don't spend a whole lot of time writing bash scripts and as a language it's not the easiest to get your head around when it comes to error handling/flow control/environment vars etc. I have lost count of the amount of scripts that badly report errors, fail to exit with the right codes or similarly irritate me.
Has anyone solved this problem in a way other than "learn the language"? I think maybe I am looking for a set of primitive commands I could use for bootstrapping script purposes that let me use the only flow control that makes sense to me in bash land:
package-available --name="postgres,s3cmd"
service-running --name="postgres" --fail-message="Postgres is not running!"
file-exists /tmp/something-important --fail-message="You need to have the something-important file - contact your local friendly AWS person"
What would separate these from just a straight up "ps aux | grep bar" or "which foo" is that they would a) fail with nice messages that tell the expert user what has happened and b) be a bit more explanatory in the script oh and c) works across different environments
Of course I am basing this on staying with shell scripting, rather than moving up to ruby or Rake or something. Would prefer to keep to shell scripts which tend to stay pretty neutral - both for humans and for operating systems.
Is this a crazy idea? Does anything exist that solves the problem of writing better bootstrap scripts?
If I understand correctly you want something like capistrano or even better mina http://nadarei.co/mina/ to setup your box? or puppet/chef?