add -p flag to hub installer and run on 0.0.0.0

This commit is contained in:
Henry Dollman
2024-08-09 12:17:22 -04:00
parent 8a04a9bed6
commit 39596b8da8
2 changed files with 10 additions and 6 deletions

View File

@@ -21,6 +21,8 @@ curl -sL https://raw.githubusercontent.com/henrygd/beszel/main/supplemental/scri
#### Install #### Install
You may specify a port number with the `-p` flag. The default port is `8090`.
```bash ```bash
./install-hub.sh ./install-hub.sh
``` ```
@@ -34,7 +36,7 @@ curl -sL https://raw.githubusercontent.com/henrygd/beszel/main/supplemental/scri
#### Update #### Update
```bash ```bash
sudo /opt/beszel/beszel update && sudo systemctl restart beszel sudo /opt/beszel/beszel update && sudo systemctl restart beszel-hub
``` ```
### Agent ### Agent

View File

@@ -1,17 +1,19 @@
#!/bin/bash #!/bin/bash
version=0.0.1 version=0.0.1
# Define default values PORT=8090 # Default port
# Read command line options # Read command line options
while getopts ":uh" opt; do while getopts ":uhp:" opt; do
case $opt in case $opt in
u) UNINSTALL="true";; u) UNINSTALL="true";;
h) printf "Beszel Hub installation script\n\n"; h) printf "Beszel Hub installation script\n\n";
printf "Usage: ./install-hub.sh [options]\n\n"; printf "Usage: ./install-hub.sh [options]\n\n";
printf "Options: \n" printf "Options: \n"
printf " -u : Uninstall the Beszel Hub\n"; printf " -u : Uninstall the Beszel Hub\n";
printf " -p <port> : Specify a port number (default: 8090)\n";
echo " -h : Display this help message"; echo " -h : Display this help message";
exit 0;; exit 0;;
p) PORT=$OPTARG;;
\?) echo "Invalid option: -$OPTARG"; exit 1;; \?) echo "Invalid option: -$OPTARG"; exit 1;;
esac esac
done done
@@ -88,7 +90,7 @@ Description=Beszel Hub Service
After=network.target After=network.target
[Service] [Service]
ExecStart=/opt/beszel/beszel serve ExecStart=/opt/beszel/beszel serve --http "0.0.0.0:$PORT"
WorkingDirectory=/opt/beszel WorkingDirectory=/opt/beszel
User=beszel User=beszel
Restart=always Restart=always
@@ -113,5 +115,5 @@ EOF
exit 1 exit 1
fi fi
echo "The Beszel Hub has been installed and configured successfully! It is now accessible on port 8090." echo "The Beszel Hub has been installed and configured successfully! It is now accessible on port $PORT."
fi fi