refactor: update installation script to use user home directory

- Changed the installation directory from `/opt/debros` to the user's home directory for improved flexibility.
- Updated systemd service configurations to reflect the new installation path for both node and gateway services.
- Ensured that read/write paths are aligned with the new installation directory.
This commit is contained in:
anonpenguin23 2025-10-25 14:40:45 +03:00
parent 2cbc3034e8
commit 6ec4f7f903
No known key found for this signature in database
GPG Key ID: 1CBB1FE35AFBEE30

View File

@ -16,7 +16,7 @@ YELLOW='\033[1;33m'
NOCOLOR='\033[0m' NOCOLOR='\033[0m'
# Defaults # Defaults
INSTALL_DIR="/opt/debros" INSTALL_DIR="$HOME"
REPO_URL="https://github.com/DeBrosOfficial/network.git" REPO_URL="https://github.com/DeBrosOfficial/network.git"
MIN_GO_VERSION="1.21" MIN_GO_VERSION="1.21"
NODE_PORT="4001" NODE_PORT="4001"
@ -412,8 +412,8 @@ Wants=network-online.target
Type=simple Type=simple
User=debros User=debros
Group=debros Group=debros
WorkingDirectory=/opt/debros/src WorkingDirectory=$INSTALL_DIR/src
ExecStart=/opt/debros/bin/node --config bootstrap.yaml ExecStart=$INSTALL_DIR/bin/node --config bootstrap.yaml
Restart=always Restart=always
RestartSec=5 RestartSec=5
StandardOutput=journal StandardOutput=journal
@ -424,7 +424,7 @@ NoNewPrivileges=yes
PrivateTmp=yes PrivateTmp=yes
ProtectSystem=strict ProtectSystem=strict
ProtectHome=yes ProtectHome=yes
ReadWritePaths=/opt/debros ReadWritePaths=$INSTALL_DIR
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@ -441,7 +441,7 @@ EOF
fi fi
log "Creating debros-gateway.service..." log "Creating debros-gateway.service..."
cat > /tmp/debros-gateway.service << 'EOF' cat > /tmp/debros-gateway.service << EOF
[Unit] [Unit]
Description=DeBros Gateway (HTTP/WebSocket) Description=DeBros Gateway (HTTP/WebSocket)
After=debros-node.service After=debros-node.service
@ -451,8 +451,8 @@ Wants=debros-node.service
Type=simple Type=simple
User=debros User=debros
Group=debros Group=debros
WorkingDirectory=/opt/debros/src WorkingDirectory=$INSTALL_DIR/src
ExecStart=/opt/debros/bin/gateway ExecStart=$INSTALL_DIR/bin/gateway
Restart=always Restart=always
RestartSec=5 RestartSec=5
StandardOutput=journal StandardOutput=journal
@ -463,7 +463,7 @@ NoNewPrivileges=yes
PrivateTmp=yes PrivateTmp=yes
ProtectSystem=strict ProtectSystem=strict
ProtectHome=yes ProtectHome=yes
ReadWritePaths=/opt/debros ReadWritePaths=$INSTALL_DIR
# Allow binding to privileged ports (80, 443) for ACME TLS # Allow binding to privileged ports (80, 443) for ACME TLS
AmbientCapabilities=CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_BIND_SERVICE