-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustomize
executable file
·51 lines (38 loc) · 1.42 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
#!/usr/bin/bash
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Exit if any command fails
set -o errexit
# setup postgresql for passwordless usage for psql usage
sed -i 's/local all all password/local all all peer/' \
/var/pgsql/data/pg_hba.conf
# access postgresql only on localhost
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = 'localhost'/" \
/var/pgsql/data/postgresql.conf
# start services
svcadm enable svc:/pkgsrc/postgresql:default
svcadm enable redis
groupadd -g 1100 netbox
useradd -m -s /usr/bin/bash -d /home/netbox -u 1100 -g netbox netbox
passwd -N netbox
passwd -d netbox
cd /home/netbox
git clone -b master https://github.com/netbox-community/netbox.git
# setup venv
python3.10 -m venv /home/netbox/venv
source venv/bin/activate
# install required packages
cd netbox
TMPDIR=/var/tmp pip3.10 install --upgrade pip
TMPDIR=/var/tmp pip3.10 install -r requirements.txt
TMPDIR=/var/tmp pip3.10 install napalm
# move config into place
mv /var/zoneinit/tmp/configuration.py /home/netbox/netbox/netbox/netbox/configuration.py
cp /home/netbox/netbox/contrib/gunicorn.py /home/netbox/netbox/gunicorn.py
# fix rights
chown -R netbox:netbox /home/netbox
# Clean up
echo "* Cleaning up."
rm -rf /var/zoneinit/tmp/
rm /root/customize
# Prepare image for provisioning
sm-prepare-image -y