Packer/Terraform launch configuration for mookjp/pool.
.
├── Rakefile # Rake tasks for generate ami, pool instance with using packer/terraform
├── ami-id # [generated file]AMI id generated by packer
├── discovery_url #[generated file]Discovery url generated by `https://discovery.etcd.io`
├── packer # packer configuration directory
│ ├── core.json.erb
│ └── provisioners
│ └── coreos-init.sh
└── terraform # terraform configuration directory
├── core.tf
├── plan # [generated file]
├── terraform.tfstate # [generated file]
└── userdata
├── pool-userdata.yaml # [generated_file] cloud-config for coreos
└── pool-userdata.yaml.erb # userdata template for pool instance
This kit needs the following commands;
- rake
- Terraform
- Packer
- jq
If you don't have these tools, the script ./install-tools.sh
may be helpful for installation.
rake ami
: build pool ami with packerrake plan
: plan terraform configurationrake apply
: launch pool instance (provided byterraform apply
)
Before execute tasks above, you must specify the variables for pool and aws environment below(see the head part of Rakefile
);
@access_key = ENV['AWS_ACCESS_KEY_ID']
@secret_key = ENV['AWS_SECRET_ACCESS_KEY']
@region = ENV['AWS_DEFAULT_REGION']
@subnet_id = ENV['AWS_PACKER_SUBNET_ID']
@security_group_id = ENV['AWS_PACKER_SG_ID']
@packer_ssh_private_ip = ENV['PACKER_SSH_PRIVATE_IP']
@tfvars = {
sg_id: ENV['TF_SG_ID'],
region: ENV['TF_REGION'] || ENV['AWS_DEFAULT_REGION'],
subnet_id: ENV['TF_SUBNET_ID'],
}
@pool = {
max_containers: ENV['MAX_CONTAINERS'] || 10,
preview_repository_url: ENV['PREVIEW_REPOSITORY_URL'] || 'http://github.com/mookjp/flaskapp.git',
pool_base_domain: ENV['POOL_BASE_DOMAIN'] || 'pool.dev',
github_bot: ENV['GITHUB_BOT'] || 'false'
}