-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·34 lines (26 loc) · 840 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·34 lines (26 loc) · 840 Bytes
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
#!/bin/bash
set -e # Stop on error
# Define directories and files
BASE_DIR="/opt/threat-overview-dashboard-demo"
DASHBOARD_DIR="$BASE_DIR/dashboard"
DATA_DIR="$DASHBOARD_DIR/data"
ENV_FILE=".env"
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
# Copy files
cd "$DASHBOARD_DIR" || exit
# Setup python environment
dnf -y install python3.11 python3.11-pip openssl
python3.11 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r $DASHBOARD_DIR/requirements.txt
echo "FlaskDashboardSecretKey=$(openssl rand -hex 20)" >> env
cp env "$ENV_FILE"
rm -f env
# Create dashboard user and setup dashboard app service
getent passwd dashboard > /dev/null && userdel --remove dashboard
useradd -r -s /bin/false dashboard
echo "Installation complete."