Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Backend/deploy/project2-backend.service
Original file line number Diff line number Diff line change
@@ -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
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <username>@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
Expand Down