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

View File

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