This repository has been archived by the owner on Mar 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
install.sh
37 lines (33 loc) · 1.83 KB
/
install.sh
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
#!/bin/bash
# Quick installation for Arsenal teamserver
# Compatible with Ubuntu 16.04
#
# You may need to run this script as root, or configure proper user permissions
#
# usage: ./install.sh new
# Install a new teamserver, and setup the database with defaults
#
# usage: ./install.sh
# Install a new teamserver, but don't populate the database
echo "Installing dependencies" | tee install.log
apt-get update -y && apt-get install -y docker.io git curl > install.log && echo "Installed packages" | tee install.log
curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose >> install.log && echo "Installed docker-compose" | tee install.log
sudo chmod +x /usr/local/bin/docker-compose >> install.log && echo "docker-compose marked executable" | tee install.log
echo "Dependencies installed" | tee install.log
echo -e "\nConfiguring logging" | tee install.log
mkdir -p /var/log/arsenal >> install.log && echo "Created log directory '/var/log/arsenal'" | tee install.log
echo -e "\nSpinning up teamserver with defaults" | tee install.log
docker-compose up -d >> /var/log/arsenal/stdout.log 2>> /var/log/arsenal/stderr.log
echo "Installation STDOUT:" | tee install.log
echo "$(cat /var/log/arsenal/stdout.log)" | tee install.log
echo "Installation STDERR:" | tee install.log
echo "$(cat /var/log/arsenal/stderr.log)" | tee install.log
if [ "$1" = "new" ]; then
echo "Configuring initial db using bin/setup.py" | tee install.log
echo -e "\n\nSaving these credentials to 'init.creds'" | tee install.log
docker exec -it arsenal_teamserver_1 /bin/sh -c "cd /opt/arsenal/bin; python3 setup.py" | tee init.creds
echo "DB Setup complete"
fi
echo -e "\nMoving log to /var/log/arsenal/install.log" | tee install.log
mv install.log /var/log/arsenal/install.log
echo -e "\nInstallation complete"