From 44433b820b66d8646698d940465c4cb8b9911cfe Mon Sep 17 00:00:00 2001 From: catjoha04-byte Date: Fri, 13 Nov 2026 10:34:11 +0100 Subject: [PATCH 1/3] feat: allow any user with sudo access to run backend --- Backend/deploy/project2-backend.service | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Backend/deploy/project2-backend.service b/Backend/deploy/project2-backend.service index 7844e6e..66c50c0 100644 --- a/Backend/deploy/project2-backend.service +++ b/Backend/deploy/project2-backend.service @@ -1,15 +1,14 @@ [Unit] Description=Project 2 GraphQL backend -After=network-online.target +After=network-online.target postgresql.service Wants=network-online.target -StartLimitIntervalSec=0 [Service] -Type=simple -WorkingDirectory=%h/T10-project-2 -ExecStart=/bin/bash -c 'source "$HOME/.nvm/nvm.sh" && exec node Backend/Server.ts' +User=project2 +WorkingDirectory=/srv/project2/app +ExecStart=/usr/bin/node --env-file=.env Backend/Server.ts' Restart=always RestartSec=5 [Install] -WantedBy=default.target +WantedBy=multi-user.target From 08c72765b5e5a166b94049e3a5b8fbb5a45b724b Mon Sep 17 00:00:00 2001 From: catjoha04-byte Date: Fri, 13 Nov 2026 11:16:37 +0100 Subject: [PATCH 2/3] fix: remove wrong symbol --- Backend/deploy/project2-backend.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Backend/deploy/project2-backend.service b/Backend/deploy/project2-backend.service index 66c50c0..72e0061 100644 --- a/Backend/deploy/project2-backend.service +++ b/Backend/deploy/project2-backend.service @@ -6,7 +6,7 @@ Wants=network-online.target [Service] User=project2 WorkingDirectory=/srv/project2/app -ExecStart=/usr/bin/node --env-file=.env Backend/Server.ts' +ExecStart=/usr/bin/node --env-file=.env Backend/Server.ts Restart=always RestartSec=5 From 7ad68b9b0dd20b9379264260b9f47fae8fc64ac3 Mon Sep 17 00:00:00 2001 From: catjoha04-byte Date: Fri, 13 Nov 2026 12:48:45 +0100 Subject: [PATCH 3/3] docs: add guide for accessing VM and backend --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0886ed7..989d3e9 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,27 @@ Our database has been filled with information from [SteamSpy](https://steamspy.c ## Backend -The Apollo GraphQL backend runs as a user-level system service on the VM on port 3001, and can be accessed using this link: [http://it2810-10.idi.ntnu.no:3001/](http://it2810-10.idi.ntnu.no:3001/). The instructions for setting up, starting, stopping, and restarting the backend with the VM are provided in a private document shared with all project members and administrators. You can run the backend localy by following the steps under [Setting up a local project](#setting-up-a-local-project) +The Apollo GraphQL backend runs on the VM on port 3001, and can be accessed using this link: [http://it2810-10.idi.ntnu.no:3001/](http://it2810-10.idi.ntnu.no:3001/). It runs as a system service (`project2-backend.service`) from a shared clone of this repository in `/srv/project2/app`, and it starts automatically when the VM boots. You can run the backend locally by following the steps under [Setting up a local project](#setting-up-a-local-project). + +### Backend guide on the VM (requires sudo permission) + +The full guide for starting, stopping, restarting, updating, and setting up the backend from scratch, including the database login details, is stored on the VM in a file that can only be read with sudo rights. Anyone with sudo access on the VM (group members and course administrators) can read it: + +1. Log in to the VM: + + ```sh + ssh @it2810-10.idi.ntnu.no + ``` + +2. Read the guide (you will be asked for your own sudo password): + + ```sh + sudo cat /srv/project2/BACKEND_HOWTO.md + ``` + + To scroll through it instead, use `sudo less /srv/project2/BACKEND_HOWTO.md` (press `q` to quit). + +Without sudo rights, the file cannot be opened. The same applies to the backend's env file, `/srv/project2/app/.env`. ## Setting up a local project