packer.io is a utility which builds automated machine images.
Packer can be used to support a variety of builders such as Amazon AMIs
, Docker images
, Google Cloud images
, VirtualBox
etc... all from a single configuration.
The utility is highly configurable and can also accept different provisioners such as chef
or puppet
or simply shell
scripts.
This repo contains the configuration required to build images of Pelias services, for use in production and development environments.
see: https://www.packer.io/docs/install/index.html
# linux example:
# download and extract
$ wget https://releases.hashicorp.com/packer/1.0.2/packer_1.0.2_linux_amd64.zip
$ unzip packer_1.0.2_linux_amd64.zip
# place the binary somewhere on your path
$ echo $PATH
$ sudo mv packer /usr/local/bin/
# packer is installed
$ packer
many of the chef scripts in this repo are maintained by external organizations, the code is 'linked' using the git submodule
command.
$ git submodule update --init --recursive
$ git submodule foreach git pull
$ git submodule add https://github.com/redguide/nodejs.git chef/cookbooks/nodejs
you can remove a module by following these directions.
use foodcritic
to display potential errors in your cookbooks:
$ foodcritic chef/cookbooks
see: https://www.packer.io/docs/templates/user-variables.html
you will need to create a file which holds your global build variables:
note: this file is ignored by git, you must enters your AWS credentials here
$ cat config/globals.json
{
"aws_region": "us-east-1",
"aws_access_key": "",
"aws_secret_key": ""
}
note: you can specify more than one variable file, these will be auto merged before running the template
$ packer build -var-file config/globals.json templates/base.json
see: https://www.packer.io/docs/templates/user-variables.html
you can override any default variables using the -var
flag on the CLI:
$ packer build \
-var-file config/globals.json \
-var 'aws_instance_type=m3.xlarge' \
templates/base.json