Browse code

update nomad and consul specs

Change-Id: I39d54b059878a2c947dd0a1bd6258c27f8f86f3b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1714
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George

Ivan Porto Carrero authored on 2016/11/15 01:41:37
Showing 8 changed files
... ...
@@ -1,15 +1,14 @@
1 1
 [Unit]
2 2
 Description=Consul Agent
3
-Wants=basic.target
4
-After=basic.target network.target
3
+Requires=network-online.target
4
+After=network-online.target
5 5
 
6 6
 [Service]
7
-EnvironmentFile=-/etc/default/consul
8
-ExecStart=/usr/bin/consul agent $OPTIONS -config-dir /etc/consul.d
9
-ExecReload=/bin/kill -HUP $MAINPID
7
+ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d -dev -advertise 127.0.0.1
8
+ExecReload=/usr/bin/kill -HUP $MAINPID
9
+KillSignal=SIGINT
10 10
 User=consul
11 11
 Group=consul
12
-KillSignal=SIGINT
13 12
 Restart=on-failure
14 13
 LimitNOFILE=131072
15 14
 
... ...
@@ -1,20 +1,27 @@
1
-Summary:	Consul-0.6.4
1
+Summary:	Consul-0.7.1
2 2
 Name:		consul
3
-Version:	0.6.4
3
+Version:	0.7.1
4 4
 Release:	1%{?dist}
5 5
 License:	Mozilla Public License, version 2.0
6 6
 URL:		https://www.consul.io/
7
-Group:		System Environment/Security
7
+Group:		System Environment/Daemons
8 8
 Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0: https://releases.hashicorp.com/%{name}/%{version}/%{name}_%{version}_linux_amd64.zip
11
-%define sha1 consul=85de555de27cae126f0f89e762f6136e1c7104b6
11
+%define sha1 %{name}_%{version}_linux_amd64.zip=c2be9eebc40bf552e260c7dd31a77cb60474712f
12 12
 Source1:	consul.service
13 13
 Requires:	shadow
14 14
 BuildRequires:  unzip
15 15
 
16 16
 %description
17
-Service discovery and configuration made easy. Distributed, highly available, and datacenter-aware.
17
+Consul is a tool for service discovery and configuration. Consul is distributed, highly available, and extremely scalable.
18
+
19
+Consul provides several key features:
20
+ - Service Discovery - Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. External services such as SaaS providers can be registered as well.
21
+ - Health Checking - Health Checking enables Consul to quickly alert operators about any issues in a cluster. The integration with service discovery prevents routing traffic to unhealthy hosts and enables service level circuit breakers.
22
+ - Key/Value Storage - A flexible key/value store enables storing dynamic configuration, feature flagging, coordination, leader election and more. The simple HTTP API makes it easy to use anywhere.
23
+ - Multi-Datacenter - Consul is built to be datacenter aware, and can support any number of regions without complex configuration.
24
+
18 25
 
19 26
 %prep -p exit
20 27
 %setup -qcn %{name}-%{version}
... ...
@@ -33,20 +40,19 @@ mv %{_builddir}/%{name}-%{version}/%{name} %{buildroot}%{_bindir}/
33 33
 cp %{SOURCE1} %{buildroot}/usr/lib/systemd/system
34 34
 install -vdm755 %{buildroot}/var/lib/consul
35 35
 
36
-%post	-p /sbin/ldconfig
37
-if [ $1 -eq 1 ]; then
38
-  # this is initial installation
39
-  if ! getent group %{name} >/dev/null; then
40
-      groupadd -g 850 %{name}
41
-  fi
42
-  if ! getent passwd %{name} >/dev/null; then
43
-      useradd -c "Consul Agent" -d /var/lib/%{name} -g %{name} \
44
-          -s /bin/false -u 850 %{name}
45
-  fi
36
+%pre
37
+if ! getent group %{name} >/dev/null; then
38
+    groupadd %{name}
39
+fi
40
+if ! getent passwd %{name} >/dev/null; then
41
+    useradd -c "Consul Agent" -d /var/lib/%{name} -g %{name} -s /bin/false %{name}
46 42
 fi
47
-%systemd_post consul.service
43
+exit 0
44
+
45
+%post
46
+%systemd_post %{name}.service
48 47
 
49
-%postun	-p /sbin/ldconfig
48
+%postun
50 49
 if [ $1 -eq 0 ]; then
51 50
   # this is delete operation
52 51
   if getent passwd %{name} >/dev/null; then
... ...
@@ -56,21 +62,24 @@ if [ $1 -eq 0 ]; then
56 56
       groupdel %{name}
57 57
   fi
58 58
 fi
59
-%systemd_postun_with_restart consul.service
59
+%systemd_postun_with_restart %{name}.service
60 60
 
61 61
 %preun
62
-%systemd_preun consul.service
62
+%systemd_preun %{name}.service
63 63
 
64 64
 %clean
65
-rm -rf %{buildroot}/*
65
+rm -rf %{buildroot}
66 66
 
67 67
 %files
68
-%defattr(-,consul,consul)
68
+%defattr(-,%{name},%{name})
69 69
 %{_bindir}/%{name}
70 70
 /usr/lib/systemd/system/%{name}.service
71 71
 %dir /var/lib/%{name}
72 72
 %dir %{_sysconfdir}/%{name}.d
73 73
 
74 74
 %changelog
75
+*	Sat Nov 12 2016 Ivan Porto Carrero <icarrero@vmware.com> 0.7.1-1
76
+-	Defaults to dev mode
77
+- Fix user and group creation
75 78
 *	Sun Jul 24 2016 Ivan Porto Carrero <icarrero@vmware.com> 0.6.4-1
76 79
 -	Initial build.	First version
77 80
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+# https://www.nomadproject.io/docs/agent/config.html
1
+
2
+bind_addr = "0.0.0.0"
3
+data_dir = "/var/lib/nomad"
4
+
5
+leave_on_interrupt = true
6
+leave_on_terminate = true
7
+
8
+disable_update_check = true
9
+
10
+client {
11
+  servers = []
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+[Unit]
1
+Description=Nomad Client Agent
2
+Documentation=https://www.nomadproject.io/docs/agent/
3
+After=network.target
4
+
5
+[Service]
6
+ExecStart=/usr/bin/nomad agent -config /etc/nomad/client.conf -client
7
+
8
+[Install]
9
+WantedBy=multi-user.target
0 10
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+# https://www.nomadproject.io/docs/agent/config.html
1
+
2
+bind_addr = "127.0.0.1"
3
+data_dir = "/var/lib/nomad"
4
+
5
+leave_on_interrupt = true
6
+leave_on_terminate = true
7
+
8
+disable_update_check = true
9
+
10
+server {
11
+  bootstrap_expect = 1
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+[Unit]
1
+Description=Nomad Server Agent
2
+Documentation=https://www.nomadproject.io/docs/agent/
3
+After=network-online.target
4
+
5
+[Service]
6
+ExecStart=/usr/bin/nomad agent -config /etc/nomad/server.conf -server
7
+
8
+[Install]
9
+WantedBy=multi-user.target
0 10
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-[Unit]
2
-Description=Nomad
3
-Documentation=https://nomadproject.io/docs/
4
-Wants=network-online.target
5
-After=network-online.target consul.service
6
-Requires=consul.service
7
-
8
-[Service]
9
-Type=notify
10
-User=root
11
-Group=root
12
-EnvironmentFile=-/etc/default/nomad
13
-ExecStart=/usr/bin/nomad agent $OPTIONS -config /etc/nomad.d
14
-LimitNOFILE=infinity
15
-LimitNPROC=infinity
16
-LimitCORE=infinity
17
-TasksMax=infinity
18
-KillSignal=SIGINT
19
-Restart=on-abnormal
20
-
21
-[Install]
22
-WantedBy=multi-user.target
... ...
@@ -1,6 +1,6 @@
1
-Summary:	Nomad Scheduler 0.4.0
1
+Summary:	Nomad Scheduler 0.4.1
2 2
 Name:		nomad
3
-Version:	0.4.0
3
+Version:	0.4.1
4 4
 Release:	1%{?dist}
5 5
 License:	Mozilla Public License, version 2.0
6 6
 URL:		https://www.nomadproject.io/
... ...
@@ -8,8 +8,11 @@ Group:		System Environment/Security
8 8
 Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0: https://releases.hashicorp.com/%{name}/%{version}/%{name}_%{version}_linux_amd64.zip
11
-%define sha1 nomad=62685976dc86b3d2c89b529ade8e4d83be4d80fa
12
-Source1:	%{name}.service
11
+%define sha1 %{name}_%{version}_linux_amd64.zip=33ebb18daf38621e1c5e1d5e98b5eb9dbc3446c9
12
+Source1:	%{name}-client.conf
13
+Source2:	%{name}-client.service
14
+Source3:	%{name}-server.conf
15
+Source4:	%{name}-server.service
13 16
 Requires:	shadow
14 17
 BuildRequires:  unzip
15 18
 
... ...
@@ -30,28 +33,35 @@ chown -R root:root %{buildroot}%{_bindir}
30 30
 
31 31
 mv %{_builddir}/%{name}-%{version}/%{name} %{buildroot}%{_bindir}/
32 32
 
33
-cp %{SOURCE1} %{buildroot}/usr/lib/systemd/system
33
+cp %{SOURCE2} %{buildroot}/usr/lib/systemd/system
34
+cp %{SOURCE4} %{buildroot}/usr/lib/systemd/system
34 35
 install -vdm755 %{buildroot}/var/lib/%{name}
35 36
 
36
-%post	-p /sbin/ldconfig
37
-%systemd_post %{name}.service
37
+%post
38
+%systemd_post %{name}-client.service
39
+%systemd_post %{name}-server.service
38 40
 
39
-%postun	-p /sbin/ldconfig
40
-%systemd_postun_with_restart %{name}.service
41
+%postun
42
+%systemd_postun_with_restart %{name}-client.service
43
+%systemd_postun_with_restart %{name}-server.service
41 44
 
42 45
 %preun
43
-%systemd_preun %{name}.service
46
+%systemd_preun %{name}-client.service
47
+%systemd_preun %{name}-server.service
44 48
 
45 49
 %clean
46
-rm -rf %{buildroot}/*
50
+rm -rf %{buildroot}
47 51
 
48 52
 %files
49
-%defattr(-,%{name},%{name})
53
+%defattr(-,root,root)
50 54
 %{_bindir}/%{name}
51
-/usr/lib/systemd/system/%{name}.service
55
+/usr/lib/systemd/system/%{name}-client.service
56
+/usr/lib/systemd/system/%{name}-server.service
52 57
 %dir /var/lib/%{name}
53 58
 %dir %{_sysconfdir}/%{name}.d
54 59
 
55 60
 %changelog
61
+*	Sat Nov 12 2016 Ivan Porto Carrero <icarrero@vmware.com> 0.4.1-1
62
+-	Defaults to dev mode
56 63
 *	Sun Jul 24 2016 Ivan Porto Carrero <icarrero@vmware.com> 0.4.0-1
57 64
 -	Initial build.	First version