-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize
executable file
·50 lines (36 loc) · 1.19 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
#!/usr/bin/bash
#
# Put customizations to your image in this file.
NETMGT_VERSION='0.0.13'
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Munin plugins
MUNIN_PLUGINS="
nginx_request
nginx_status
"
# Exit if any commands fail
set -o errexit
echo "* Use default python 3.8"
pkg_alternatives manual python38
echo "* Create ssl folder"
mkdir -p /opt/local/etc/nginx/ssl
echo "* Download and extract netmgt to /opt/netmgt"
mkdir -p /opt/netmgt
curl -L "https://github.com/wiedi/django-netmgt/archive/v${NETMGT_VERSION}.tar.gz" | gtar xz -C /opt/netmgt --strip-components=1
echo "* Setup permissions for netmgt folder"
chown -R www:www /opt/netmgt
echo "* Install missing dependencies via pip"
pip install -r /opt/netmgt/req.txt
echo "* Copy default (basic) netmgt settings"
cp /tmp/netmgt-settings.py /opt/netmgt/netmgt_web/settings.py
rm /tmp/netmgt-settings.py
echo "* Setup gunicorn"
mkdir -p /opt/local/etc/gunicorn
svccfg import /tmp/gunicorn.xml
echo "* Activate munin plugins"
/opt/core/bin/munin-node-plugins ${MUNIN_PLUGINS}
echo "* Cleanup home/admin because of delegate dataset usage"
rm -rf /home/admin/.[^.]*
echo "* Cleaning up."
rm -rf /root/*
sm-prepare-image -y