-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomize
executable file
·62 lines (50 loc) · 1.41 KB
/
customize
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
#!/usr/bin/bash
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Exit if any commands fail
set -o errexit
VARNISH_VERSION="5.2.1"
MUNIN_PLUGINS="
varnish_main_uptime
varnish_hit_rate
varnish_expunge
varnish_threads
varnish_mgt_uptime
varnish_backend_traffic
varnish_bad
varnish_objects
varnish_memory_usage
varnish_request_rate
varnish_transfer_rates
"
echo "* Activate munin plugins"
/opt/qutic/bin/munin-node-plugins ${MUNIN_PLUGINS}
echo "* Build varnish"
mkdir /opt/qutic/src
cd /opt/qutic/src
# get it from: https://github.com/varnishcache/varnish-cache/releases
curl -s -L -O https://download.qutic.com/src/varnish/varnish-${VARNISH_VERSION}.tgz
tar xf varnish-${VARNISH_VERSION}.tgz
cd varnish-${VARNISH_VERSION}
./configure --prefix=/opt/local
gmake
gmake install
echo "* Create varnish guid and uid"
groupadd -g 201 varnish
useradd -m -s /usr/bin/false -u 201 -g varnish varnish
# passwd -N varnish
# passwd -d varnish
svccfg import /opt/local/lib/svc/manifest/varnish.xml
svccfg import /opt/local/lib/svc/manifest/varnish-log.xml
mkdir -p /var/run/varnishd
mkdir -p /opt/local/var/varnish
chown -R varnish:varnish /var/run/varnishd
chown -R varnish:varnish /opt/local/var/varnish
touch /var/log/varnish.log
chown varnish:varnish /var/run/varnishd
# Clean up
echo "* Cleaning up."
cd /root
rm -rf /opt/qutic/src
rm /root/customize
# Prepare image for provisioning
sm-prepare-image -y