This repository has been archived by the owner on Mar 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpacker-graphite.json
135 lines (131 loc) · 5.29 KB
/
packer-graphite.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
This is my source version of the packer-graphite build. It contains
comments which are stripped out of the file before it's fed to the
Packer.io build process. There should also be an graphite.json file
in this directory. That file is the same as this one, sans comments.
If you want to run the build, but don't have the strip-json-comments
program installed, you should build it using the graphite.json file.
*/
{
"variables": {
/* Below variables are hard-coded for this project */
"graphite_version": "0.9.10",
"packer_graphite_version": "0.1.0",
/* If you fork this project, you'll probably want to change this variable */
"packer_graphite_repo": "http://github.com/ksclarke/packer-graphite",
/* Below variables should be supplied by the vars.json file */
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"aws_security_group_id": "{{env `AWS_SECURITY_GROUP_ID`}}",
"aws_region": "{{env `AWS_REGION`}}",
"aws_instance_type": "{{env `AWS_INSTANCE_TYPE`}}",
"aws_source_ami": "{{env `AWS_SOURCE_AMI`}}",
"aws_virtualization_type": "{{env `AWS_VIRTUALIZATION_TYPE`}}",
"digitalocean_image": "{{env `DIGITALOCEAN_IMAGE`}}",
"digitalocean_api_token": "{{env `DIGITALOCEAN_API_TOKEN`}}",
"digitalocean_region": "{{env `DIGITALOCEAN_REGION`}}",
"digitalocean_size": "{{env `DIGITALOCEAN_SIZE`}}",
"server_admin_email": "{{env `PACKER_GRAPHITE_EMAIL`}}",
"server_host_name": "localhost",
"packer_build_name": "{{env `PACKER_GRAPHITE_BUILD_NAME`}}",
"docker_user": "{{env `DOCKER_USER`}}",
"automatic_os_security_updates": "false",
"automatic_os_reboot": "false",
/* These passwords will be autogenerated if left empty */
"graphite_admin_password": "",
"graphite_secret_key_password": ""
},
"builders": [
/* Two supported builders at this point: amazon-ebs and docker */
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
/* Below should be the actual ID, not the group name */
"security_group_id": "{{user `aws_security_group_id`}}",
"region": "{{user `aws_region`}}",
"associate_public_ip_address": "true",
/* Make sure the next three values are compatible */
"source_ami": "{{user `aws_source_ami`}}",
"instance_type": "{{user `aws_instance_type`}}",
"ami_virtualization_type": "{{user `aws_virtualization_type`}}",
/* Build scripts are Ubuntu-specific at this point so the user is fixed */
"ssh_username": "ubuntu",
"tags": { "OS_Version": "Ubuntu", "Release": "Graphite {{user `graphite_version`}}" },
/* Brand our newly created AMIs so that we can easily identify them */
"ami_name": "{{user `packer_build_name`}} Graphite [{{timestamp}}]",
"ami_description": "A Graphite deployment built with Packer.io"
},
{
"type": "docker",
"image": "ubuntu:14.04",
"commit": "true",
"pull": "true"
},
{
"type": "digitalocean",
"api_token": "{{user `digitalocean_api_token`}}",
/* Ubuntu's last LTS release, 14.04 */
"image": "{{user `digitalocean_image`}}",
"region": "{{user `digitalocean_region`}}",
"size": "{{user `digitalocean_size`}}",
"droplet_name": "graphite-{{user `server_host_name`}}",
"snapshot_name": "{{user `packer_build_name`}} Graphite [{{timestamp}}]"
}
],
"provisioners": [
/* Only non-Docker builds need an initd/service script; Docker users supervisord */
{
"type": "file",
"except": ["docker"],
"source": "scripts/carbon-cache-initd.sh",
"destination": "/tmp/carbon-cache"
},
/* The Graphite installation / configuration options common to all build artifacts */
{
"type": "shell",
"environment_vars": [
"SERVER_ADMIN_EMAIL={{user `server_admin_email`}}",
"GRAPHITE_SECRET_KEY={{user `graphite_secret_key_password`}}",
"GRAPHITE_ADMIN_PASSWORD={{user `graphite_admin_password`}}"
],
"scripts": [
"scripts/setup-base-system.sh",
"scripts/install-graphite.sh",
"scripts/configure-apache.sh"
]
},
/* Non-Docker builds use initd/service, run cron to check for updates, etc. */
{
"type": "shell",
"except": ["docker"],
"environment_vars": [
"PACKER_GRAPHITE_REPO={{user `packer_graphite_repo`}}",
"SERVER_HOST_NAME={{user `server_host_name`}}",
"SERVER_ADMIN_EMAIL={{user `server_admin_email`}}",
"AUTOMATIC_OS_SECURITY_UPDATES={{user `automatic_os_security_updates`}}",
"AUTOMATIC_OS_REBOOT={{user `automatic_os_reboot`}}"
],
"scripts": [
"scripts/modify-landscape.sh",
"scripts/configure-carbon-cache.sh",
"scripts/configure-base-system.sh"
]
},
/* Only Docker needs supervisord to manage what's run within the container */
{
"type": "shell",
"only": ["docker"],
"script": "scripts/install-supervisor.sh"
}
],
"post-processors": [
/* We tag the generated Docker image to give it a more user-friendly name */
{
"type": "docker-tag",
"only": ["docker"],
"repository": "{{user `docker_user`}}/packer-graphite",
"tag": "{{user `packer_graphite_version`}}"
}
]
}