From 5f6607f4518ad95c9de34701567c247fc2764d44 Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 11 Sep 2024 14:40:22 -0400 Subject: better upload script build server on server side to avoid glibc version conflicts --- README.md | 24 +++--------------------- jigsaw-server.service | 14 ++++++++++++++ upload.sh | 22 ++++++++++++++++------ 3 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 jigsaw-server.service diff --git a/README.md b/README.md index 4e4c408..d604899 100644 --- a/README.md +++ b/README.md @@ -40,28 +40,10 @@ GRANT CREATE ON SCHEMA public TO jigsaw; \q ``` -run `cargo build --release` in the `server` directory -either on the server or on your computer, and copy `featuredpictures.txt potd.py getfeaturedpictures.py target/release/jigsaw-server` -to a directory owned by the jigsaw user, e.g. `/home/jigsaw/server`. install python3, and run `getfeaturedpictures.py` +copy over the `server` directory to your server and run `cargo build --release` there. install python3, and run `getfeaturedpictures.py` to get the list of featured pictures (this will take a while). -now you can run the `jigsaw-server` executable to start the backend, or create a systemd service to run it for you, e.g.: - -``` -[Unit] -Description=Jigsaw puzzle server -After=network.target - -[Service] -User=jigsaw -WorkingDirectory=/home/jigsaw/server -ExecStart=/home/jigsaw/server/jigsaw-server -Type=simple -Restart=always - -[Install] -WantedBy=default.target -RequiredBy=network.target -``` +now you can run the `target/release/jigsaw-server` executable to start the backend, or create a systemd service to run it for you, e.g. as in +the jigsaw-server.service file. now for the front-end, first change the `WEBSOCKET_URL_REMOTE` constant in `game.js` to a subdomain of your domain. run a proxy on your server to forward websocket traffic from that subdomain to port 54472 (this port can be configured in `server/src/main.rs`). diff --git a/jigsaw-server.service b/jigsaw-server.service new file mode 100644 index 0000000..6dcb046 --- /dev/null +++ b/jigsaw-server.service @@ -0,0 +1,14 @@ +[Unit] +Description=Jigsaw puzzle server +After=network.target + +[Service] +User=jigsaw +WorkingDirectory=/home/jigsaw/server +ExecStart=/home/jigsaw/server/target/release/jigsaw-server +Type=simple +Restart=always + +[Install] +WantedBy=default.target +RequiredBy=network.target diff --git a/upload.sh b/upload.sh index f470d61..8f4fd9a 100755 --- a/upload.sh +++ b/upload.sh @@ -14,14 +14,24 @@ done # if static-only argument is given, exit now printf '%s' "$@" | grep -q 'static-only' && exit 0 -cd server +echo 'Copying over server files…' +tar czf server.tar.gz $(git ls-files server) || exit 1 +scp server.tar.gz $REMOTE: || exit 1 +rm server.tar.gz +ssh $REMOTE <