From cf3abe92f577a6de92d62fbd56521bb14b0d75b2 Mon Sep 17 00:00:00 2001 From: iamBadgers Date: Mon, 2 Jun 2025 00:18:52 -0700 Subject: [PATCH] remove scripts, fix db copy error --- Dockerfile | 6 ++--- install.sh | 68 ------------------------------------------------------ setup.sh | 31 ------------------------- 3 files changed, 3 insertions(+), 102 deletions(-) delete mode 100755 install.sh delete mode 100755 setup.sh diff --git a/Dockerfile b/Dockerfile index d4c2fcf..b5db781 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/install.sh b/install.sh deleted file mode 100755 index c7d21ed..0000000 --- a/install.sh +++ /dev/null @@ -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 "---" diff --git a/setup.sh b/setup.sh deleted file mode 100755 index c8ca604..0000000 --- a/setup.sh +++ /dev/null @@ -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