This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgo-server-demo-packer.json
124 lines (124 loc) · 4.23 KB
/
go-server-demo-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
{
"variables": {
"gocd_version": "",
"instance_type": "c5.large",
"region": "{{env `REGION`}}",
"extra_ami_region_to_copy_to": "{{env `EXTRA_AMI_REGION_TO_COPY_TO`}}",
"openjdk_url": "https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz",
"jre_path": "/usr/local/jre"
},
"builders": [
{
"type": "amazon-ebs",
"region": "{{user `region`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "amzn-ami-hvm-*-x86_64-gp2",
"root-device-type": "ebs"
},
"owners": ["137112412989"],
"most_recent": true
},
"ami_groups": "all",
"ami_regions": ["{{user `extra_ami_region_to_copy_to`}}"],
"instance_type": "{{user `instance_type`}}",
"ssh_username": "ec2-user",
"ami_name": "GoCD Demo {{user `gocd_version`}}",
"tags": {
"GoCD-Version": "{{user `gocd_version`}}",
"Name": "GoCD Demo {{user `gocd_version`}}"
},
"snapshot_tags": {
"GoCD-Version": "{{user `gocd_version`}}",
"Name": "GoCD Demo {{user `gocd_version`}}"
}
},
{
"type": "virtualbox-iso",
"virtualbox_version_file": ".vbox_version",
"headless": false,
"guest_os_type": "RedHat_64",
"disk_size": 40000,
"iso_url": "http://ftp.jaist.ac.jp/pub/Linux/CentOS/7.3.1611/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso",
"iso_checksum": "71a7aa147877b413497cdff5b1e0aa5bc0c9484f",
"iso_checksum_type": "sha1",
"boot_command": [
"<tab> net.ifnames=0 biosdevname=0 text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos-7.0-x86_64/ks.cfg<enter><wait>"
],
"boot_wait": "5s",
"http_directory": "http",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2" ]
],
"shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p"
},
{
"type": "vmware-iso",
"headless": true,
"guest_os_type": "centos-64",
"disk_size": 40000,
"iso_url": "http://ftp.jaist.ac.jp/pub/Linux/CentOS/7.3.1611/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso",
"iso_checksum": "71a7aa147877b413497cdff5b1e0aa5bc0c9484f",
"iso_checksum_type": "sha1",
"boot_command": [
"<tab> net.ifnames=0 biosdevname=0 text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos-7.0-x86_64/ks.cfg<enter><wait>"
],
"boot_wait": "5s",
"http_directory": "http",
"tools_upload_flavor": "linux",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"vmx_data": {
"memsize": "2048",
"numvcpus": "2",
"vhv.enable": "TRUE"
},
"shutdown_command": "echo 'vagrant' | sudo -S /sbin/halt -h -p"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo yum update -y",
"sudo yum install -y git mercurial subversion openssh-clients bash wget",
"sudo yum remove -y java-1.7.0-openjdk",
"sudo mkdir -p {{ user `jre_path` }} && wget {{ user `openjdk_url` }} -O java11.tar.gz && sudo tar -xf java11.tar.gz -C {{ user `jre_path` }} --strip 1 --exclude \"jdk*/lib/src.zip\" --exclude \"jdk*/include\" --exclude \"jdk*/jmods\"",
"echo 'PATH=$PATH:{{ user `jre_path` }}/bin' | sudo tee -a /etc/profile",
"sudo wget -q https://download.gocd.io/gocd.repo -O /etc/yum.repos.d/gocd.repo",
"sudo yum install -y go-server go-agent",
"sudo yum clean all",
"rm java11.tar.gz"
]
},
{
"type": "file",
"source": "config",
"destination": "/tmp"
},
{
"type": "file",
"source": "db",
"destination": "/tmp"
},
{
"type": "shell",
"inline": [
"sudo cp -a /tmp/config/. /etc/go",
"sudo cp -r /tmp/db /var/lib/go-server/",
"sudo chown -R go:go /etc/go /var/lib/go-server/db",
"sudo chmod 770 /etc/go",
"sudo chmod 775 /var/lib/go-server/db"
]
}
]
}