-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnexus.json
53 lines (53 loc) · 1.47 KB
/
nexus.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
{
"variables": {
"bucket_name": "",
"bucket_key": ""
},
"builders": [{
"type": "amazon-ebs",
"region": "ap-northeast-1",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "amzn2-ami-hvm-2.0.*-x86_64-ebs",
"root-device-type": "ebs"
},
"owners": ["amazon"],
"most_recent": true
},
"instance_type": "t2.micro",
"ssh_username": "ec2-user",
"ami_name": "sonatype-nexus-{{timestamp}}",
"associate_public_ip_address": true,
"ssh_timeout": "5m"
}],
"provisioners": [
{
"type": "shell-local",
"inline": [
"aws s3api get-object --bucket {{user `bucket_name`}} --key {{user `bucket_key`}} downloads/nexus.tar.gz"
]
},
{
"type": "file",
"source": "downloads/",
"destination": "/tmp/"
},
{
"type": "shell",
"inline": [
"sudo amazon-linux-extras enable corretto8",
"sudo yum install -y java-1.8.0-amazon-corretto amazon-efs-utils",
"(cd /opt; sudo tar xvzf /tmp/nexus.tar.gz)",
"sudo rm -f /tmp/nexus.tar.gz",
"sudo mv /opt/nexus* /opt/nexus",
"sudo find /opt/nexus -exec chown ec2-user:ec2-user {} \\;",
"sudo find /opt/sonatype-work -exec chown ec2-user:ec2-user {} \\;",
"sudo mv /tmp/nexus.service /etc/systemd/system/",
"sudo systemctl daemon-reload",
"sudo systemctl enable nexus.service",
"java -version"
]
}
]
}