This is a collection of tools we built to drive Packer, greatly simplifying Packer configuration. Designed to be invoked from the working directory of a Nubis project this tool will consume project.json and ultimately build a series of AMIs relating to the project.
- Fork this repository
- Install the Dependencies
- Setup your secrets/variables.json file following these instructions
- Put nubis-builder in your path
- Run nubis-builder build from the project's working directory.
Install the AWS CLI tool. You can install it by following the instructions at the top of this page, For Mac and Linux users you can simply:
pip install awscli
Homebrew users:
brew install awscli
We use jq to munge JSON data from within Bash. From the jq site:
jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.
You can install it by following the instructions on the download page.
Homebrew users:
brew install jq
Debian / Ubuntu users:
apt-get install jq
Packer (from Hashicorp) is the image building tool we use to build the Nubis system images.
Built in Go, it's a simple .zip file to download with static binaries in it. No dependencies or installation pain. Simply follow the instruction here.
Homebrew users (requires Caskroom, brew install caskroom/cask/brew-cask
):
brew install packer
Librarian puppet is only necessary if you will be building base images. If you do not know what I am talking about than this step is unnecessary for you.
To install librarian-puppet follow the instructions here.
While this step is not mandatory, it sure is convenient to have the nubis-builder tools on your path. You can do this one time by:
PATH=/path/to/your/clone/of/nubis-builder/bin:$PATH
You can make this automatic on login by adding it to the bottom of your bashrc file:
echo "PATH=/path/to/your/clone/of/nubis-builder/bin:$PATH" >> ~/.bashrc
Of course in both of these examples you will need to change /path/to/your/clone/of to the actual path on your system.
If you are following the walkthrough or working on an existing project you can stop here. If you are setting up a new project from scratch, continue reading.
- Set up nubis-builder according to the quick start instructions
- Check out the nubis-skel project as a quick skeleton
- Adjust project.json to suit your needs.
{
"variables": {
"project_name": "",
"project_description": "",
"project_version": "0.1",
"source_ami_project_name": "",
"source_ami_project_version": "",
"automatic_version_bump": "1",
"automatic_version_verify": "1",
"builders": ["amazon-ebs-amazon-linux", "amazon-instance-amazon-linux"]
}
A short human readable single word description of your project, such as nubis-base. Amazon's tag restrictions are applicable.
A blob of text describing your project, such as "MediaWiki server".
Your project's version. If you use automatic_version_bump or automatic_version_verify it must consist of two whole numbers separated by a decimal, such as 1.0 or 2.24.
Your project's source AMI name. You will want to set this to "nubis-base" in most cases, which will build your project using the latest available base AMI.
List of builders to use when building your project. See the officially supported builders
You can optionally pin the source AMI to a specific version. Should not include source project name.
Automatically bump the version for each build. If your project_version is at 1.0 it will be incremented to 1.1 before the build kicks off.
Query the Amazon AMI registry and verify that there is not already a build with your version number. This can help save you some time, because you won't discover namespace collisions until the end of the build process.
Browse through the directory tree to see additional documentation for specific portions of the project.
Please file a GitHub issue and document your problem, it would be helpful to include the output of nubis-builder with --verbose and optionally --keep-json, and quote the relevant portions of the constructed json file in your issue.