This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathpcfdev-base.json
164 lines (160 loc) · 7.18 KB
/
pcfdev-base.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
{
"variables": {
"version": "0",
"cpus": "4",
"memory": "4096",
"disk_size": "60",
"eula_url": "",
"security_group_id": "",
"subnet_id": "",
"vpc_id": "",
"ssh_keypair_name": "",
"ssh_private_key_file": ""
},
"builders": [
{
"type": "amazon-ebs",
"region": "us-east-1",
"source_ami": "ami-6012160a",
"instance_type": "c4.2xlarge",
"ami_name": "pcfdev-base-v{{user `version`}}",
"ami_description": "{{user `eula_url`}}",
"associate_public_ip_address": false,
"security_group_id": "{{user `security_group_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"vpc_id": "{{user `vpc_id`}}",
"ssh_keypair_name": "{{user `ssh_keypair_name`}}",
"ssh_private_key_file": "{{user `ssh_private_key_file`}}",
"ami_block_device_mappings": [{
"device_name": "/dev/sda1",
"volume_type": "gp2",
"volume_size": "{{user `disk_size`}}",
"delete_on_termination": true
}],
"launch_block_device_mappings": [{
"device_name": "/dev/sda1",
"volume_type": "io1",
"iops": "1800",
"volume_size": "{{user `disk_size`}}",
"delete_on_termination": true
}],
"ssh_username": "ubuntu",
"ssh_timeout": "20m",
"tags": {"Name": "v{{user `version`}}", "License":"{{user `eula_url`}}"}
},
{
"type": "virtualbox-iso",
"headless": true,
"vm_name": "pcfdev-base-v{{user `version`}}",
"guest_os_type": "Ubuntu_64",
"disk_size": "{{user `disk_size`}}000",
"ssh_username": "vcap",
"ssh_password": "vcap",
"iso_url": "https://pcfdev.s3.amazonaws.com/artifacts/ubuntu-14.04.4-server-amd64.iso",
"iso_checksum": "2ac1f3e0de626e54d05065d6f549fa3a",
"iso_checksum_type": "md5",
"http_directory": "preseed",
"ssh_timeout": "20m",
"shutdown_command": "echo vcap | sudo -S shutdown -P now",
"format": "ova",
"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=pcfdev ",
"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>"
],
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}" ],
[ "modifyvm", "{{.Name}}", "--memory", "{{user `memory`}}" ],
[ "modifyvm", "{{.Name}}", "--natdnshostresolver1", "on" ],
[ "modifyvm", "{{.Name}}", "--nic1", "nat" ],
[ "modifyvm", "{{.Name}}", "--paravirtprovider", "minimal" ]
]
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo vcap | {{ .Vars }} sudo -E -S sh -c '{{ .Path }}'",
"inline": [
"apt-get -y install software-properties-common",
"add-apt-repository -y ppa:brightbox/ruby-ng",
"echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list",
"wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -",
"apt-get -y update",
"apt-get -y --force-yes dist-upgrade",
"apt-get -y update",
"apt-get -y upgrade sudo",
"echo 'vcap ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers",
"# vvv TODO: instead of doing this, use (or build) a stemcell for PCF Dev vvv",
"sed -i 's/^GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cgroup_enable=memory swapaccount=1\"/' /etc/default/grub",
"# ^^^ TODO: instead of doing this, use (or build) a stemcell for PCF Dev ^^^"
]
},
{
"type": "shell",
"only": ["virtualbox-iso"],
"execute_command": "{{ .Vars }} sudo -E sh -c '{{ .Path }}'",
"inline": [
"apt-get install -y dkms",
"mount -o loop /home/vcap/VBoxGuestAdditions.iso /mnt",
"sh /mnt/VBoxLinuxAdditions.run --nox11",
"umount /mnt",
"apt-get install -y open-vm-tools"
]
},
{
"type": "shell",
"only": ["amazon-ebs"],
"execute_command": "{{ .Vars }} sudo -E sh -c '{{ .Path }}'",
"inline": [
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do sleep 1; done",
"ln -sf /usr/bin/mawk /usr/bin/awk"
]
},
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E sh -c '{{ .Path }}'",
"inline": [
"apt-get -y install curl unzip zip sysstat vim",
"apt-get -y install libruby2.1 ruby2.1",
"apt-get -y install linux-generic",
"apt-get -y install aufs-tools",
"apt-get -y install libgcrypt20 libgcrypt20-dev",
"apt-get -y install postgresql-client-9.4",
"apt-get -y install nginx",
"service nginx stop",
"update-rc.d -f nginx remove",
"for version in $(ls /lib/modules); do apt-get install -y linux-image-extra-$version; done",
"curl -L 'https://cli.run.pivotal.io/stable?release=linux64-binary&version=6.25.0&source=github-rel' | tar -C /usr/local/bin -xz",
"curl -L 'https://github.com/cloudfoundry-incubator/routing-api-cli/releases/download/2.6.0/rtr-linux-amd64.tgz' | tar -C /usr/local/bin -xz",
"mv /usr/local/bin/rtr-linux-amd64 /usr/local/bin/rtr",
"curl -L 'https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz' | tar -C /usr/local -xz",
"ln -sf /usr/local/go/bin/go* /usr/local/bin/",
"curl -o /usr/local/bin/veritas -L https://github.com/pivotal-cf-experimental/veritas/releases/download/latest/veritas",
"chmod +x /usr/local/bin/veritas",
"curl -o /usr/local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64",
"chmod +x /usr/local/bin/jq"
]
}
],
"post-processors": [
{
"type": "shell-local",
"only": ["virtualbox-iso"],
"inline": ["ls $PWD/*/*.ova"],
"keep_input_artifact": true
},
{
"type": "vagrant",
"only": ["amazon-ebs"],
"output": "pcfdev-base-{{.Provider}}-v{{user `version`}}.box",
"keep_input_artifact": true
}
]
}