remove scripts, fix db copy error

This commit is contained in:
iamBadgers
2025-06-02 00:18:52 -07:00
parent e1f7404c8d
commit cf3abe92f5
3 changed files with 3 additions and 102 deletions

View File

@@ -9,7 +9,7 @@
# RUN systemctl enable cron
# Setup the loader
FROM python:3.12
FROM python:3.12 AS loader
COPY ./loader /srv/cprush-stats
WORKDIR /srv/cprush-stats
RUN python -m pip install --upgrade pip
@@ -19,8 +19,6 @@ CMD ["python3", "createrushdatabase.py"]
FROM node:23
COPY --from=0 /srv/cprush-stats /srv/cprush-stats
RUN corepack enable
# build the frontend
@@ -46,6 +44,8 @@ EXPOSE 3001
ENV NODE_ENV=production
ENV MEMCACHE_ADDR="localhost:11211"
COPY --from=loader /srv/cprush-stats/testdb.db /srv/cprush-stats/testdb.db
WORKDIR /srv/cprush-stats
RUN npm install
CMD ["sh", "-c", "node app.js -m $MEMCACHE_ADDR"]

View File

@@ -1,68 +0,0 @@
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
echo ""
echo "---"
echo "Creating user rushstats"
echo "---"
if [id rushstats >/dev/null 2>&1]; then
echo "rushstats user already exists, skipping."
else
useradd -s /sbin/nologin rushstats
echo "User rushstats created with /sbin/nologin"
fi
echo ""
echo "---"
echo "Moving the distributable folder into /srv/gamestats"
echo "---"
if [ -d /srv/gamestats ]; then
echo "/srv/gamestats already exists; removing"
rm -r /srv/rushstats
fi
mkdir /srv/gamestats
cp -r "$parent_path"/dist/* /srv/gamestats
cp -r "$parent_path"/loader/* /srv/gamestats
chown -R rushstats:rushstats /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 "Created new service."
echo cat $SYSTEMD_SERVICE_FILE
echo ""
echo "---"
echo "Reloading daemons and starting service"
echo "---"
systemctl daemon-reload
systemctl enable rushstats.service
systemctl start rushstats.service
echo ""
echo "---"
echo "Creating the cron job to refresh the database."
echo "---"

View File

@@ -1,31 +0,0 @@
#!/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 -rf ./frontend/dist ./dist/frontend
# Build and move the back end distribution into the output dist folder
cd "$parent_path"/backend
npm install
npm run build
cd ../
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/* ./dist
# 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
npm install