postinst.sh 1.11 KB
Newer Older
joonas lume's avatar
joonas lume committed
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
#!/bin/bash
sleep 30

mkdir -p /var/log/kibana
chown kibana:kibana /var/log/kibana

mkdir -p /var/run/kibana
chown kibana:kibana /var/run/kibana

mkdir -p /opt/rig

mkdir -p /etc/confd
mkdir -p /etc/confd/conf.d
mkdir -p /etc/confd/templates
mv /tmp/confd/conf.d/* /etc/confd/conf.d/
mv /tmp/confd/templates/* /etc/confd/templates/

source /etc/vaultcred && confd \
  -onetime \
  -prefix $workspace \
  -backend vault \
  -node $vaulthost \
  -auth-type token \
  -auth-token $vaulttoken

if [ $? -ne 0 ]
then
  echo "Failed to apply configuration, use vault_test.sh to verify connection
   to vault is working. If that is working, check confd templates and
   configuration. To run it manually use
  source /etc/vaultcred && confd -onetime -prefix $workspace
   -backend vault -node $vaulthost -auth-type token
    -auth-token $vaulttoken
  to finish installation properly use apt-get -f install"
  exit 1
fi

chmod -v o+r /etc/kibana/*.yml

rm -rf /etc/nginx/sites-available/default
mv /etc/nginx/sites-available/default.new /etc/nginx/sites-available/default

systemctl enable nginx
systemctl restart nginx

systemctl stop kibana