summary refs log tree commit diff
path: root/DEPLOY.md
blob: a427ed7b19414f5893391fd4d56b5ffd3123b0e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Deployment
---

## NixOS (recommended)

flake.nix: (production: [inputs](https://cgit.rory.gay/Rory-Open-Architecture.git/tree/flake.nix?h=d94f5#n104), [modules](https://cgit.rory.gay/Rory-Open-Architecture.git/tree/flake.nix?h=d94f5#n147), [service](https://cgit.rory.gay/Rory-Open-Architecture.git/tree/host/Rory-ovh/services/safensound.nix))
```nix
# inputs section - using public mirror for unauthenticated access
inputs.safeNSound.url = "git+https://cgit.rory.gay/school/nodejs-final-assignment.git/";

# system configuration section
# modules = [
safeNSound.modules.default

# configuration section
# Make sure mongodb is set up: services.mongodb = { enable = true; ... };
services.safeNSound = {
  enable = true;
  package = safeNSound.packages.default;
  port = 3000; # or any other port you prefer
  logRequests = "-"; # or "true" to log requests
  databaseSecretPath = "/path/to/mongodb/connection/string";
  jwtSecretPath = "/path/to/jwt/secret/certificate";
  logQueries = false; # set to true to enable mongoose debug logs
  logAuth = false; # set to true to enable authentication debug logs
};
```

## Other Linux distros:

### Preparation

Make sure you have the following installed:
- Node.js (v22 or later)
- MongoDB

```shell
git clone --recursive https://cgit.rory.gay/school/nodejs-final-assignment.git/
cd nodejs-final-assignment
npm i
```

### Installation

Please see your service manager:
- systemd (Debian, Arch, Fedora, ...): /etc/systemd/system/SafeNSound.service (see [example](https://cgit.rory.gay/school/nodejs-final-assignment.git/tree/doc/systemd.service))
- Other: please refer to your service manager's documentation.

## General setup considerations:
- Do not run as root!
- Secrets live on disk and should be handled via whatever secret scheme your system allows. (NixOS uses systemd by default).