|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2021-2026 community-scripts ORG |
| 4 | +# Author: Owen Voke (owenvoke) |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE |
| 6 | +# Source: https://github.com/Ralex91/Razzia |
| 7 | + |
| 8 | +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" |
| 9 | +color |
| 10 | +verb_ip6 |
| 11 | +catch_errors |
| 12 | +setting_up_container |
| 13 | +network_check |
| 14 | +update_os |
| 15 | + |
| 16 | +msg_info "Installing Dependencies" |
| 17 | +$STD apt install -y nginx |
| 18 | +msg_ok "Installed Dependencies" |
| 19 | + |
| 20 | +NODE_VERSION="24" NODE_MODULE="pnpm@11" setup_nodejs |
| 21 | +fetch_and_deploy_gh_release "razzia" "Ralex91/Razzia" "tarball" |
| 22 | + |
| 23 | +msg_info "Building Razzia" |
| 24 | +cd /opt/razzia |
| 25 | +$STD pnpm install --frozen-lockfile |
| 26 | +$STD pnpm build |
| 27 | +msg_ok "Built Razzia" |
| 28 | + |
| 29 | +msg_info "Configuring Razzia" |
| 30 | +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 | +} |
| 35 | +EOF |
| 36 | +msg_ok "Configured Razzia" |
| 37 | + |
| 38 | +msg_info "Creating Service" |
| 39 | +cat <<EOF >/etc/systemd/system/razzia.service |
| 40 | +[Unit] |
| 41 | +Description=Razzia Socket Server |
| 42 | +After=network.target |
| 43 | +
|
| 44 | +[Service] |
| 45 | +Type=simple |
| 46 | +User=root |
| 47 | +WorkingDirectory=/opt/razzia/packages/socket |
| 48 | +Environment=NODE_ENV=production |
| 49 | +Environment=CONFIG_PATH=/opt/razzia-config |
| 50 | +ExecStart=/usr/bin/node /opt/razzia/packages/socket/dist/index.cjs |
| 51 | +Restart=on-failure |
| 52 | +RestartSec=5 |
| 53 | +
|
| 54 | +[Install] |
| 55 | +WantedBy=multi-user.target |
| 56 | +EOF |
| 57 | +systemctl enable -q --now razzia |
| 58 | +msg_ok "Created Service" |
| 59 | + |
| 60 | +msg_info "Configuring Nginx" |
| 61 | +cat <<EOF >/etc/nginx/sites-available/razzia |
| 62 | +server { |
| 63 | + listen 3000; |
| 64 | + server_name _; |
| 65 | +
|
| 66 | + root /opt/razzia/packages/web/dist; |
| 67 | + index index.html; |
| 68 | +
|
| 69 | + location / { |
| 70 | + try_files \$uri \$uri/ /index.html; |
| 71 | + } |
| 72 | +
|
| 73 | + location /branding/ { |
| 74 | + alias /opt/razzia-config/branding/; |
| 75 | + } |
| 76 | +
|
| 77 | + location /ws { |
| 78 | + proxy_pass http://127.0.0.1:3001; |
| 79 | + proxy_http_version 1.1; |
| 80 | + proxy_set_header Upgrade \$http_upgrade; |
| 81 | + proxy_set_header Connection "upgrade"; |
| 82 | + 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; |
| 86 | + proxy_read_timeout 3600s; |
| 87 | + proxy_send_timeout 3600s; |
| 88 | + } |
| 89 | +} |
| 90 | +EOF |
| 91 | +nginx_enable_site razzia |
| 92 | +msg_ok "Configured Nginx" |
| 93 | + |
| 94 | +motd_ssh |
| 95 | +customize |
| 96 | +cleanup_lxc |
0 commit comments