System provisioning using BASH (for Debian/Ubuntu based systems)
System (single machine focused) provisioning tool using BASH scripting to install required system packages.
NOTE: Bashinate is most definitely a work in progress, and I would only recommend the truly fearless of heart even try using it now :)
Let's look at a simple example of how I personally use bashinate.
Firstly, get a linux box up and running (Ubuntu / Debian variants are probably best supported at the moment) to the point that you can
ssh into the box.
For instance, if you are using vagrant to create a local development machine you might do something like:
vagrant init precise64vagrant upvagrant ssh
In my own use cases, I tend to run bashinate from the
/opt folder so I can keep bashinate managed apps localized. By default, bashinate will place all code into a folder called
/opt/local if running as root, or in the
~/.bashinate/install folder if running as a normal user.
So for the sake of convenience, lets head into the
/opt folder and create a simple text
recipe file there. Unsurprisingly I'm going to ask bashinate to install node and nginx for me:
# initialise versionsuse nginx 1.4.1use node 0.10.20# bootstrap www -> /opt/local/wwwclone https://bitbucket.org/DamonOehlman/nginx-bootstrap.git www# install stuff based on defined versions (overrides will be accepted also)# NOTE: installs are localized (/opt/local/nginx/1.4.1 /opt/local/node/0.10.20)nginxnode# install an npm packagenpm install -g deploy# exec a command rather than running a scriptletexec sudo -u git $NODE_PATH/bin/deploy init simple /home/git/projects/test# install an upstart script for nginxupstart nginx# restart the nginx serviceexec service nginx restart
NOTE: At present you need a trailing line for the input recipe to work.
wget bashinate and make it executable:
[sudo] wget -O bashinate[sudo] chmod a+x bashinate
Now, simply run bashinate and send your recipe to the
stdin of bashinate. In my case, I'm going to run the command as root to ensure my applications get installed into
sudo ./bashinate < recipe
If everything is working, you should see a whole lot of console output and eventually bashinate will finish.
You should now have the following folders under
You will notice that both node and nginx have been installed into version specific directories. I believe this is important as it allows you to have two versions of system software present on the one machine and write your application startup scripts to suit.
To install bashinate, you can use the following command in your home directory:
wget -O bashinate && chmod a+x bashinate
This will provide you the ability to run bashinate from the command-line:
If all is well bashinate should report a version number to you.
I recently needed to rebuild my desktop linux machine to match my shiny new laptop running XMonand and all the cool new things. For an "in anger" use case of bashinate, I decided that I would specify my system layout using bashinate and build the machine using only bashinate.
If you want to provision a system like mine, then you could run the following command on a fresh linux install (after installing bashinate as per the above instructions):
wget -O - | ~/bashinate