Skip to content

Commit 877802b

Browse files
authored
Merge pull request #2396 from owenvoke/feature/razzia-4
feat(razzia): update to support 4.x
2 parents a1fba39 + 3b782fd commit 877802b

3 files changed

Lines changed: 41 additions & 17 deletions

File tree

‎ct/razzia.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/usr/bin/env bash
22
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
3-
# Engine comes from community-scripts/core; this repo only ships the scripts.
4-
# A local core checkout wins (COMMUNITY_SCRIPTS_CORE_DIR, else a sibling ../core),
5-
# so a fork or branch of core can be tested without editing this file.
63
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
74
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
85
# Copyright (c) 2021-2026 community-scripts ORG
@@ -41,8 +38,12 @@ function update_script() {
4138
systemctl stop razzia
4239
msg_ok "Stopped Service"
4340

41+
create_backup /opt/razzia/.env
42+
4443
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "razzia" "Ralex91/Razzia" "tarball"
4544

45+
restore_backup
46+
4647
NODE_VERSION="24" NODE_MODULE="pnpm@11" setup_nodejs
4748

4849
msg_info "Building Razzia"

‎install/razzia-install.sh‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ msg_ok "Built Razzia"
2828

2929
msg_info "Configuring Razzia"
3030
mkdir -p /opt/razzia-config
31-
cat <<EOF >/opt/razzia-config/game.json
32-
{
33-
"managerPassword": "$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
34-
}
31+
cat <<EOF >/opt/razzia/.env
32+
MANAGER_PASSWORD=$(random_password 16)
33+
JWT_SECRET=$(openssl rand -hex 32)
3534
EOF
3635
msg_ok "Configured Razzia"
3736

@@ -45,6 +44,7 @@ After=network.target
4544
Type=simple
4645
User=root
4746
WorkingDirectory=/opt/razzia/packages/socket
47+
EnvironmentFile=/opt/razzia/.env
4848
Environment=NODE_ENV=production
4949
Environment=CONFIG_PATH=/opt/razzia-config
5050
ExecStart=/usr/bin/node /opt/razzia/packages/socket/dist/index.cjs
@@ -74,15 +74,37 @@ server {
7474
alias /opt/razzia-config/branding/;
7575
}
7676
77+
location /media/ {
78+
alias /opt/razzia-config/media/;
79+
types {
80+
image/png png;
81+
image/jpeg jpg;
82+
image/webp webp;
83+
image/gif gif;
84+
audio/mpeg mp3;
85+
audio/ogg ogg;
86+
audio/wav wav;
87+
video/mp4 mp4;
88+
video/webm webm;
89+
}
90+
default_type application/octet-stream;
91+
add_header X-Content-Type-Options nosniff;
92+
}
93+
94+
location /api {
95+
client_max_body_size 101m;
96+
proxy_pass http://127.0.0.1:3001;
97+
proxy_set_header Host \$host;
98+
proxy_read_timeout 300s;
99+
proxy_send_timeout 300s;
100+
}
101+
77102
location /ws {
78103
proxy_pass http://127.0.0.1:3001;
79104
proxy_http_version 1.1;
80105
proxy_set_header Upgrade \$http_upgrade;
81106
proxy_set_header Connection "upgrade";
82107
proxy_set_header Host \$host;
83-
proxy_set_header X-Real-IP \$remote_addr;
84-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
85-
proxy_set_header X-Forwarded-Proto \$scheme;
86108
proxy_read_timeout 3600s;
87109
proxy_send_timeout 3600s;
88110
}

‎json/razzia.json‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
"documentation": "https://github.com/Ralex91/Razzia/blob/main/docs/README.md",
1313
"website": "https://github.com/Ralex91/Razzia",
1414
"repository": "https://github.com/Ralex91/Razzia",
15-
"architectures": [
16-
"amd64"
17-
],
1815
"logo": "https://cdn.jsdelivr.net/gh/Ralex91/Razzia@main/packages/web/public/icon.svg",
1916
"description": "Razzia is a self-hosted, open-source quiz platform for smaller events. A manager hosts a live quiz from the browser while participants join with a room code from their own devices, with quizzes, results and custom branding stored as files in the config folder.",
2017
"install_methods": [
2118
{
2219
"type": "default",
2320
"script": "ct/razzia.sh",
24-
"config_path": "/opt/razzia-config/game.json",
21+
"config_path": "/opt/razzia/.env",
2522
"resources": {
2623
"cpu": 2,
2724
"ram": 3072,
@@ -37,15 +34,19 @@
3734
},
3835
"notes": [
3936
{
40-
"text": "The manager password is generated during installation and stored in /opt/razzia-config/game.json. Open the manager interface at http://<IP>:3000/manager and log in with it. Manager access stays blocked while managerPassword is the upstream default value \"PASSWORD\".",
37+
"text": "The manager password is generated during installation and stored as MANAGER_PASSWORD in /opt/razzia/.env. Open the manager interface at http://<IP>:3000/manager and log in with it. Manager access is refused until MANAGER_PASSWORD is set.",
38+
"type": "info"
39+
},
40+
{
41+
"text": "JWT_SECRET in /opt/razzia/.env signs the session tokens and is generated during installation. Leaving it empty makes the server generate a new secret at every start, which logs managers out and gives players a fresh identity on each restart. It must be at least 32 characters; a shorter value is ignored. Restart the service after editing the file: systemctl restart razzia",
4142
"type": "info"
4243
},
4344
{
44-
"text": "Quizzes, saved results and optional branding live in /opt/razzia-config (quizz/, results/, branding/). An example quiz is created there on first start. Restart the service after editing game.json: systemctl restart razzia",
45+
"text": "Quizzes, saved results, uploaded media and optional branding live in /opt/razzia-config (quizz/, results/, media/, branding/). An example quiz is created there on first start.",
4546
"type": "info"
4647
},
4748
{
48-
"text": "Game state is kept in memory by the socket server, so only run a single instance. Behind a reverse proxy, WebSocket upgrade headers must be forwarded to port 3000 or clients stay stuck on connecting.",
49+
"text": "Game state is kept in memory by the socket server, so only run a single instance. Behind a reverse proxy, WebSocket upgrade headers must be forwarded to port 3000 or clients stay stuck on connecting, and the upload limit must allow 100 MB media files.",
4950
"type": "warning"
5051
}
5152
]

0 commit comments

Comments
 (0)