-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpacker.json
189 lines (172 loc) · 5.45 KB
/
packer.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"do_api_key": "{{env `DIGITALOCEAN_API_KEY`}}",
"do_client_id": "{{env `DIGITALOCEAN_CLIENT_ID`}}"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-west-2",
"source_ami": "ami-6aad335a",
"instance_type": "m1.small",
"ssh_username": "ubuntu",
"ami_name": "inboxapp-server {{timestamp}}"
},
{
"type": "digitalocean",
"snapshot_name": "inboxapp-server {{timestamp}}",
"api_key": "{{user `do_api_key`}}",
"client_id": "{{user `do_client_id`}}"
},
{
"type": "vmware-iso",
"iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.3-server-amd64.iso",
"iso_checksum": "61d5e67c70d97b33c13537461a0b153b41304ef412bb0e9d813bb157068c3c65",
"iso_checksum_type": "sha256",
"boot_wait": "5s",
"http_directory": ".",
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{ .Name }} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- ",
"<enter>"
],
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"ssh_wait_timeout": "30m",
"ssh_username": "vagrant",
"ssh_password": "vagrant"
},
{
"type": "virtualbox-iso",
"iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.3-server-amd64.iso",
"iso_checksum": "61d5e67c70d97b33c13537461a0b153b41304ef412bb0e9d813bb157068c3c65",
"iso_checksum_type": "sha256",
"guest_os_type": "Ubuntu_64",
"boot_wait": "5s",
"http_directory": ".",
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{ .Name }} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- ",
"<enter>"
],
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"ssh_wait_timeout": "30m",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"virtualbox_version_file": ".vbox_version",
"ssh_username": "vagrant",
"ssh_password": "vagrant"
},
{
"type": "docker",
"image": "ubuntu:12.04",
"export_path": "inboxapp_docker.box.tar"
}],
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 30",
"mkdir -p ~/.ssh"
]
},
{
"type": "file",
"source": "./ssh/config",
"destination": "~/.ssh/config"
},
{
"type": "file",
"source": "./ssh/id_rsa",
"destination": "~/.ssh/id_rsa"
},
{
"type": "file",
"source": "./ssh/id_rsa.pub",
"destination": "~/.ssh/id_rsa.pub"
},
{
"type": "file",
"source": "./ssh/known_hosts",
"destination": "~/.ssh/known_hosts"
},
{
"type": "shell",
"only": ["amazon-ebs", "digitalocean"],
"inline": [
"sudo apt-get update -y ",
"chmod 600 ~/.ssh/id_rsa",
"chmod 600 ~/.ssh/id_rsa.pub",
"chmod 600 ~/.ssh/known_hosts",
"ssh-add",
"ssh -vT [email protected]",
"sudo apt-get install git -y",
"git clone [email protected]:inboxapp/inbox.git ~/inbox",
"cd ~/inbox && sudo -E /bin/sh ./setup.sh"
]
},
{
"type": "shell",
"only": ["virtualbox-iso", "vmware-iso"],
"inline": [
"echo 'vagrant' | sudo -E -S apt-get update -y ",
"chmod 600 ~/.ssh/id_rsa",
"chmod 600 ~/.ssh/id_rsa.pub",
"chmod 600 ~/.ssh/known_hosts",
"echo 'vagrant' | sudo -E -S ssh-add",
"ssh -vT [email protected]",
"echo 'vagrant' | sudo -E -S apt-get install git -y",
"git clone [email protected]:inboxapp/inbox.git ~/inbox",
"cd ~/inbox && echo 'vagrant' | sudo -E -S /bin/sh ./setup.sh"
]
},
{
"type": "shell",
"only": ["docker"],
"inline": [
"set -e",
"export DEBIAN_FRONTEND=noninteractive",
"apt-get -y install python-software-properties",
"add-apt-repository 'deb http://archive.ubuntu.com/ubuntu precise universe'",
"apt-get update -y ",
"chmod 600 ~/.ssh/id_rsa",
"chmod 600 ~/.ssh/id_rsa.pub",
"chmod 600 ~/.ssh/known_hosts",
"apt-get install -y openssh-client openssh-server",
"apt-get install -y git",
"apt-get install -y dialog",
"sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config",
"sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config",
"echo '\nStrictHostKeyChecking no\n' >> /etc/ssh/ssh_config",
"eval `ssh-agent -s`",
"ssh-add ~/.ssh/id_rsa",
"echo 'Ready to clone from git ...'",
"git clone [email protected]:inboxapp/inbox.git ~/inbox",
"apt-get update -y",
"sleep 10",
"cd ~/inbox && /bin/bash ./setup.sh"
]
}
],
"post-processors": [{
"type": "vagrant",
"except": ["docker"],
"output": "inboxapp_{{.Provider}}.box",
"keep_input_artifact": true
}]
}