-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds the working version of the install script. Signed-off-by: Amy Parker <[email protected]>
- Loading branch information
Showing
7 changed files
with
232 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# | ||
# ssvp: server statistics viewer project | ||
# Copyright (C) 2023 Amy Parker <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or visit the | ||
# GNU Project at https://gnu.org/licenses. The GNU Affero General Public | ||
# License version 3 is available at, for your convenience, | ||
# https://www.gnu.org/licenses/agpl-3.0.en.html. | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")" | ||
|
||
if [ $(id -u) -ne 0 ]; then | ||
which sudo > /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "Either run as root, or have sudo installed" | ||
exit 1 | ||
else | ||
PREROOT="sudo" | ||
fi | ||
fi | ||
|
||
echo -e "SSVP Setup and Installer\n\nPlease ensure that you are logged in as the user you wish to install SSVP as.\n" | ||
|
||
echo -n "Autoinstall system dependencies? (Debian and Fedora derivatives only) y/[n] " | ||
read AILDPDS | ||
if [ "$AILDPDS" == "y" ]; then | ||
bash -c "$PREROOT installer/autoinstall-deps-system.sh $USER" | ||
else | ||
echo -n "Verify system dependencies? y/[n] " | ||
read VFYDPS | ||
if [ "$VFYDPS" == "y" ]; then | ||
bash installer/verify-deps-system.sh | ||
fi | ||
fi | ||
|
||
if [ ! -d "venv" ]; then | ||
echo -n "Create virtual environment? (recommended) n/[y] " | ||
read CRVENV | ||
if [ "$CRVENV" != "n" ]; then | ||
python3 -m venv venv | ||
fi | ||
fi | ||
|
||
if [ "$VIRTUAL_ENV" == "" ]; then | ||
if [ -d "venv" ]; then | ||
echo -n "Source detected venv? (recommended) n/[y] " | ||
read SRVENV | ||
if [ "$SRVENV" != "n" ]; then | ||
source venv/bin/activate | ||
fi | ||
fi | ||
fi | ||
|
||
echo -n "Install PyPI dependencies? n/[y] " | ||
read INSPYPI | ||
if [ "$INSPYPI" != "n" ]; then | ||
pip3 install -r requirements.txt | ||
fi | ||
|
||
echo -n "Install NPM dependencies? n/[y] " | ||
read INSNPM | ||
if [ "$INSNPM" != "n" ]; then | ||
npm i | ||
fi | ||
|
||
echo -n "Compile site dependencies? n/[y] " | ||
read CMPSDP | ||
if [ "$CMPSDP" != "n" ]; then | ||
make | ||
fi | ||
|
||
echo -n "Initialize database system for SSVP? (use defaults when generating configuration) y/[n] " | ||
read INIDBS | ||
if [ "$INIDBS" == "y" ]; then | ||
bash installer/initialize-databases.sh | ||
echo "For mysql and postgres: make sure to change the database password after finishing install/setup." | ||
fi | ||
|
||
echo -n "Generate ssvp config file? n/[y] " | ||
read GENCF | ||
if [ "$GENCF" != "n" ]; then | ||
python3 installer/gen_config.py | ||
fi | ||
|
||
echo -n "Initialize the cached statistics table? n/[y] " | ||
read INISCS | ||
if [ "$INISCS" != "n" ]; then | ||
python3 srv/initialized_cached_stats.py | ||
fi | ||
|
||
echo "Installation finished. Remember to set up a cron job for srv/interval.py to run every 5 minutes (this will be automated in the future)" | ||
|
||
# next todo: cron (also implement systemd timers) | ||
# next todo: get install directory (default: /opt/ssvp), `make install` | ||
# next todo: systemd service for web server? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# | ||
# ssvp: server statistics viewer project | ||
# Copyright (C) 2023 Amy Parker <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or visit the | ||
# GNU Project at https://gnu.org/licenses. The GNU Affero General Public | ||
# License version 3 is available at, for your convenience, | ||
# https://www.gnu.org/licenses/agpl-3.0.en.html. | ||
|
||
# support existing rustup installs | ||
su - $1 -c "which cargo" | ||
if [ $? -ne 0 ]; then | ||
CARGO_INSTALL="cargo" | ||
fi | ||
|
||
su - $1 -c "which crontab" | ||
if [ $? -ne 0 ]; then | ||
CRONTAB_INSTALL_APT = "cron" | ||
CRONTAB_INSTALL_DNF = "cronie" | ||
fi | ||
|
||
# NOTE: This doesn't work on dual-platform systems (if both, say, apt and dnf are installed) | ||
if [ -f "/usr/bin/apt" ]; then | ||
apt update | ||
apt install python3 python3-pip python3-dev python3-venv libpq-dev nodejs npm sass jq make gcc g++ $CARGO_INSTALL tmux $CRONTAB_INSTALL_APT | ||
elif [ -f "/usr/bin/dnf" ]; then | ||
dnf install python3 python3-pip python3-devel libpq libpq-devel nodejs nodejs-npm jq make gcc gcc-c++ $CARGO_INSTALL tmux $CRONTAB_INSTALL_DNF | ||
elif [ -f "/usr/bin/yum" ]; then | ||
yum install python3 python3-pip python3-devel libpq libpq-devel nodejs nodejs-npm jq make gcc gcc-c++ $CARGO_INSTALL tmux $CRONTAB_INSTALL_DNF | ||
else | ||
echo "Unsupported OS for system package autoinstall" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# | ||
# ssvp: server statistics viewer project | ||
# Copyright (C) 2023 Amy Parker <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or visit the | ||
# GNU Project at https://gnu.org/licenses. The GNU Affero General Public | ||
# License version 3 is available at, for your convenience, | ||
# https://www.gnu.org/licenses/agpl-3.0.en.html. | ||
|
||
# LIMITATION: We can't actually really check for libpq-dev(el). | ||
# It could technically be installed *anywhere* with some tricks. | ||
# Same goes for python3-dev(el). Let's just presume it's installed, | ||
# setup.py will fail if things go wrong anyways... | ||
|
||
if [ ! -f "/usr/bin/pip3" ]; then | ||
echo "No system pip3 detected" | ||
exit 1 | ||
fi | ||
|
||
declare -a deps=( "python3" "jq" "gcc" "g++" "cargo" "tmux" "npx" "npm" "crontab" ) | ||
|
||
for dep in "${deps[@]}" | ||
do | ||
which $dep | ||
if [ $? -ne 0 ]; then | ||
echo "Missing required dependency $dep" | ||
exit 1 | ||
fi | ||
done |
Empty file.