Skip to content

Commit 8e34d1a

Browse files
authored
Merge branch 'main' into feature/vanish-optimization
2 parents 8497b14 + 1410824 commit 8e34d1a

20 files changed

Lines changed: 1668 additions & 1374 deletions

.github/workflows/checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
run: npm ci
4343
- name: Run ESLint
4444
run: npm run lint
45+
- name: Run Knip
46+
run: npm run knip
4547
build-check:
4648
name: Build check
4749
runs-on: ubuntu-latest

.knip.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@2/schema.json",
3+
"entry": [
4+
"src/index.ts",
5+
"src/import-events.ts",
6+
"knexfile.js"
7+
],
8+
"project": [
9+
"src/**/*.ts"
10+
],
11+
"ignoreFiles": [],
12+
"commitlint": false,
13+
"eslint": false,
14+
"github-actions": false,
15+
"husky": false,
16+
"mocha": false,
17+
"nyc": false,
18+
"semantic-release": false
19+
}

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ before making a change.
66

77
Please keep the conversations civil, respectful and focus on the topic being discussed.
88

9+
## Local Quality Checks
10+
11+
Run dead code and dependency analysis before opening a pull request:
12+
13+
```
14+
npm run knip
15+
```
16+
17+
`npm run lint` now runs Knip first, then ESLint.
18+
919
## Pull Request Process
1020

1121
1. Update the relevant documentation with details of changes to the interface, this includes new environment

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ Start:
209209
```
210210
./scripts/start_with_tor
211211
```
212+
or, with Nginx reverse proxy and Let's Encrypt SSL:
213+
```
214+
RELAY_DOMAIN=relay.example.com CERTBOT_EMAIL=you@example.com ./scripts/start_with_nginx
215+
```
212216
213217
**Windows / WSL2 users:** Docker bind-mounts can cause PostgreSQL permission errors on Windows. Use the dedicated override file instead:
214218
```

docker-compose.nginx.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
services:
2+
nginx:
3+
image: nginx:1.25-alpine
4+
container_name: nostream-nginx
5+
ports:
6+
- 80:80
7+
- 443:443
8+
volumes:
9+
- ${PWD}/nginx/conf.d:/etc/nginx/conf.d
10+
- ${PWD}/nginx/ssl:/etc/nginx/ssl
11+
- certbot-webroot:/var/www/certbot
12+
depends_on:
13+
- nostream
14+
restart: on-failure
15+
# Run nginx in foreground (so container exits if nginx dies).
16+
# A background loop watches for a signal file created by certbot
17+
# after cert issuance/renewal, and reloads nginx within seconds.
18+
command: >
19+
/bin/sh -c "while :; do
20+
if [ -f /etc/nginx/ssl/reload-nginx ]; then
21+
if nginx -t && nginx -s reload; then
22+
rm -f /etc/nginx/ssl/reload-nginx;
23+
fi;
24+
fi;
25+
sleep 5;
26+
done & nginx -g 'daemon off;'"
27+
networks:
28+
default:
29+
30+
certbot:
31+
image: certbot/certbot:v2.11.0
32+
container_name: nostream-certbot
33+
environment:
34+
RELAY_DOMAIN: ${RELAY_DOMAIN:?RELAY_DOMAIN required}
35+
CERTBOT_EMAIL: ${CERTBOT_EMAIL:?CERTBOT_EMAIL required}
36+
volumes:
37+
- ${PWD}/nginx/ssl:/etc/letsencrypt
38+
- ${PWD}/scripts/certbot_entrypoint.sh:/entrypoint.sh:ro
39+
- certbot-webroot:/var/www/certbot
40+
entrypoint: /entrypoint.sh
41+
depends_on:
42+
- nginx
43+
restart: on-failure
44+
networks:
45+
default:
46+
47+
volumes:
48+
certbot-webroot:
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Nginx configuration template for Nostream relay
2+
# ${RELAY_DOMAIN} is substituted automatically by the start script
3+
4+
map $http_upgrade $connection_upgrade {
5+
default upgrade;
6+
'' close;
7+
}
8+
9+
# HTTP — redirect to HTTPS and serve ACME challenge for Let's Encrypt
10+
server {
11+
listen 80;
12+
server_name ${RELAY_DOMAIN};
13+
14+
location /.well-known/acme-challenge/ {
15+
root /var/www/certbot;
16+
}
17+
18+
location / {
19+
return 301 https://$host$request_uri;
20+
}
21+
}
22+
23+
# HTTPS — reverse proxy to nostream relay
24+
server {
25+
listen 443 ssl;
26+
server_name ${RELAY_DOMAIN};
27+
28+
ssl_certificate /etc/nginx/ssl/live/${RELAY_DOMAIN}/fullchain.pem;
29+
ssl_certificate_key /etc/nginx/ssl/live/${RELAY_DOMAIN}/privkey.pem;
30+
31+
ssl_protocols TLSv1.2 TLSv1.3;
32+
ssl_ciphers HIGH:!aNULL:!MD5;
33+
ssl_prefer_server_ciphers on;
34+
35+
location / {
36+
proxy_pass http://nostream:8008;
37+
38+
# WebSocket support
39+
proxy_http_version 1.1;
40+
proxy_set_header Upgrade $http_upgrade;
41+
proxy_set_header Connection $connection_upgrade;
42+
43+
# Pass client IP to relay
44+
proxy_set_header Host $host;
45+
proxy_set_header X-Real-IP $remote_addr;
46+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
47+
proxy_set_header X-Forwarded-Proto $scheme;
48+
49+
# WebSocket timeouts
50+
proxy_read_timeout 86400s;
51+
proxy_send_timeout 86400s;
52+
}
53+
}

0 commit comments

Comments
 (0)