-
Notifications
You must be signed in to change notification settings - Fork 4
/
apache-tomcat.json
60 lines (54 loc) · 1.73 KB
/
apache-tomcat.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
{
"variables": {
"tomcat_version": "7.0.103"
},
"provisioners": [
{
"type": "shell",
"inline": [
"echo -n 'Waiting for network...'",
"while ! $(systemctl --quiet is-enabled network-online.target); do sleep 1; done && echo 'FINISHED'",
"echo -n 'Waiting for cloud-init...'",
"cloud-init status --wait &>/dev/null && echo 'FINISHED'"
],
"only": [ "lxd" ]
},
{ "source": "apache-tomcat-{{user `tomcat_version`}}.tar.gz", "destination": "/tmp/apache-tomcat-{{user `tomcat_version`}}.tar.gz", "type": "file" },
{
"type": "shell",
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
],
"inline": [
"apt-get update",
"apt-get -y install openjdk-8-jdk-headless",
"apt-get clean",
"useradd -c 'Apache Tomcat' -d / -M -r -s /usr/sbin/nologin -U tomcat",
"tar xzf /tmp/apache-tomcat-{{user `tomcat_version`}}.tar.gz -C/opt",
"ln -sr /opt/apache-tomcat-{{user `tomcat_version`}} /opt/tomcat7",
"ln -sr /opt/apache-tomcat-{{user `tomcat_version`}} /opt/tomcat",
"chown -R tomcat /opt/apache-tomcat-{{user `tomcat_version`}}",
"rm -f /tmp/apache-tomcat-{{user `tomcat_version`}}.tar.gz"
]
},
{ "source": "tomcat.service", "destination": "/etc/systemd/system/tomcat.service", "type": "file", "only": [ "lxd" ] },
{
"type": "shell",
"inline": [
"systemctl daemon-reload",
"systemctl enable tomcat.service"
],
"only": [ "lxd" ]
}
],
"builders": [
{
"type": "lxd",
"image": "ubuntu:16.04",
"output_image": "tomcat7",
"publish_properties": {
"description": "Apache Tomcat 7"
}
}
]
}