Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ainoya/packer-terraform-pool

Packer/Terraform template for creating https://github.com/mookjp/pool AMI
https://github.com/ainoya/packer-terraform-pool

Last synced: about 21 hours ago
JSON representation

Packer/Terraform template for creating https://github.com/mookjp/pool AMI

Awesome Lists containing this project

README

        

Pool Starter Kit on AWS
=================

Packer/Terraform launch configuration for [mookjp/pool][mookjp].

Overview
---------

```
.
├── 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
```

Prerequisites
-------------

### Tool requirements

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.

Tasks
------

- `rake ami`: build pool ami with packer
- `rake plan`: plan terraform configuration
- `rake apply`: launch pool instance (provided by `terraform apply`)

Configuration variable
-------------------------

Before execute tasks above, you must specify the variables for pool and aws environment below(see the head part of `Rakefile`);

```ruby
@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'
}
```

[mookjp]: https://github.com/mookjp/pool