work on instalation scripts

This commit is contained in:
iamBadgers
2024-06-09 16:47:53 -07:00
parent 68433b6836
commit aa4f17df06
2 changed files with 55 additions and 4 deletions

44
install.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
echo ""
echo "---"
echo "Moving the distributable folder into /srv/gamestats"
echo "---"
cp -r "$parent_path"/dist /srv/gamestats
echo ""
echo "---"
echo "Creating the systemd services."
echo "---"
SYSTEMD_SERVICE_FILE=/etc/systemd/system/rushstats.service
if [ -f $SYSTEMD_SERVICE_FILE ]; then
echo "Service already exists; removing."
rm $SYSTEMD_SERVICE_FILE
fi
touch $SYSTEMD_SERVICE_FILE
echo "[Unit]" >> $SYSTEMD_SERVICE_FILE
echo "Description=Stats Server for Cyberpunk Rush" >> $SYSTEMD_SERVICE_FILE
echo "After=network.target" >> $SYSTEMD_SERVICE_FILE
echo "" >> $SYSTEMD_SERVICE_FILE
echo "[Service]" >> $SYSTEMD_SERVICE_FILE
echo "Type=simple" >> $SYSTEMD_SERVICE_FILE
echo "WorkingDirectory=/srv/gamestats"
echo "ExecStart=node /srv/gamestats/app.js" >> $SYSTEMD_SERVICE_FILE
echo "Restart=on-failure" >> $SYSTEMD_SERVICE_FILE
echo "" >> $SYSTEMD_SERVICE_FILE
echo "[Install]" >> $SYSTEMD_SERVICE_FILE
echo "WantedBy=multi-user.target" >> $SYSTEMD_SERVICE_FILE
echo "" >> $SYSTEMD_SERVICE_FILE
echo ""
echo "---"
echo "Creating the cron job to refresh the database."
echo "---"
echo ""
echo "---"
echo "Reloading daemons and starting service"
echo "---"
systemctl daeomon-reload
systemctl start rushstats.service

View File

@@ -1,23 +1,30 @@
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
mkdir "$parent_path"/dist
# Build and move the front end distribution into the output dist folder
cd "$parent_path"/frontend
npm install
npm run build
cd ../
cp -r ./frontend/dist ./dist/frontend
cp -rf ./frontend/dist ./dist/frontend
cd "$parent_path"/frontend
# Build and move the back end distribution into the output dist folder
cd "$parent_path"/backend
npm install
npm run build
cd ../
cp -r ./backend/dist ./dist
cp -f ./backend/dist/* ./dist
# Build and move the database into the output dist folder
cd "$parent_path"/loader
python3 createrushdatabase.py
cd ../
cp -r ./loader/testdb.db ./dist
cp -r ./loader/testdb.db ./dist/testdb.db
# Move the package into the dist folder and install the needed modules
cd "$parent_path"
cp ./backend/package.json ./dist/package.json
cd "$parent_path"/dist