From e6bef224942288dcbefabc10ca1dc50635918731 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 29 Sep 2025 09:39:14 -0400 Subject: [PATCH] . --- thrower_daemon/install.sh | 14 +++++++++++--- thrower_daemon/superball-thrower.service | 11 ++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/thrower_daemon/install.sh b/thrower_daemon/install.sh index ba43e0a..9dd673e 100755 --- a/thrower_daemon/install.sh +++ b/thrower_daemon/install.sh @@ -62,6 +62,16 @@ NPM_VERSION=$(npm --version) echo "✅ Node.js $NODE_VERSION installed" echo "✅ npm $NPM_VERSION installed" +# Create system-wide symlinks for Node.js and npm +echo "🔗 Creating system-wide Node.js symlinks..." +NODE_PATH=$(which node) +NPM_PATH=$(which npm) + +sudo ln -sf "$NODE_PATH" /usr/local/bin/node +sudo ln -sf "$NPM_PATH" /usr/local/bin/npm + +echo "✅ Node.js symlinks created" + # Install npm dependencies echo "📦 Installing npm dependencies..." if ! npm install; then @@ -197,10 +207,8 @@ if [ -z "$PRIVATE_KEY" ]; then echo "🔑 Initializing daemon to generate keypair..." # Create a simple init script that generates keypair sudo -u "$DAEMON_USER" bash -c " - export NVM_DIR=\"$HOME/.nvm\" - [ -s \"\$NVM_DIR/nvm.sh\" ] && \. \"\$NVM_DIR/nvm.sh\" cd \"$INSTALL_DIR\" - node -e \" + /usr/local/bin/node -e \" const { generateSecretKey, getPublicKey } = require('nostr-tools/pure'); const fs = require('fs'); const config = JSON.parse(fs.readFileSync('config.json', 'utf8')); diff --git a/thrower_daemon/superball-thrower.service b/thrower_daemon/superball-thrower.service index 38341a5..b7c554b 100644 --- a/thrower_daemon/superball-thrower.service +++ b/thrower_daemon/superball-thrower.service @@ -6,10 +6,11 @@ Wants=network-online.target [Service] Type=simple -User=superball -Group=superball -WorkingDirectory=/path/to/thrower_daemon -ExecStart=/usr/bin/node daemon.js /etc/superball/config.json +User=superball-thrower +Group=superball-thrower +WorkingDirectory=/opt/superball-thrower +ExecStart=/usr/local/bin/node daemon.js +Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Restart=always RestartSec=10 StandardOutput=journal @@ -21,7 +22,7 @@ NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true -ReadWritePaths=/var/log/superball +ReadWritePaths=/var/log/superball-thrower /opt/superball-thrower ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true