mirror of
https://github.com/henrygd/beszel.git
synced 2026-04-15 09:21:49 +02:00
Compare commits
3 Commits
v0.12.1
...
d4bb0a0a30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4bb0a0a30 | ||
|
|
fe5e35d1a9 | ||
|
|
60a6ae2caa |
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -3,7 +3,7 @@ name: Make release and binaries
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- "v*"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '^1.22.1'
|
go-version: "^1.22.1"
|
||||||
|
|
||||||
- name: GoReleaser beszel
|
- name: GoReleaser beszel
|
||||||
uses: goreleaser/goreleaser-action@v6
|
uses: goreleaser/goreleaser-action@v6
|
||||||
@@ -40,3 +40,4 @@ jobs:
|
|||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.TOKEN || secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ winget:
|
|||||||
publisher_support_url: "https://github.com/henrygd/beszel/issues"
|
publisher_support_url: "https://github.com/henrygd/beszel/issues"
|
||||||
short_description: "Agent for Beszel, a lightweight server monitoring platform."
|
short_description: "Agent for Beszel, a lightweight server monitoring platform."
|
||||||
skip_upload: auto
|
skip_upload: auto
|
||||||
|
token: "{{ .Env.WINGET_TOKEN }}"
|
||||||
description: |
|
description: |
|
||||||
Beszel is a lightweight server monitoring platform that includes Docker
|
Beszel is a lightweight server monitoring platform that includes Docker
|
||||||
statistics, historical data, and alert functions. It has a friendly web
|
statistics, historical data, and alert functions. It has a friendly web
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ is_alpine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_openwrt() {
|
is_openwrt() {
|
||||||
cat /etc/os-release | grep -q "OpenWrt"
|
grep -qi "OpenWrt" /etc/os-release
|
||||||
}
|
}
|
||||||
|
|
||||||
# If SELinux is enabled, set the context of the binary
|
# If SELinux is enabled, set the context of the binary
|
||||||
@@ -335,11 +335,10 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated user for the service if it doesn't exist
|
# Create a dedicated user for the service if it doesn't exist
|
||||||
|
echo "Creating a dedicated user for the Beszel Agent service..."
|
||||||
if is_alpine; then
|
if is_alpine; then
|
||||||
if ! id -u beszel >/dev/null 2>&1; then
|
if ! id -u beszel >/dev/null 2>&1; then
|
||||||
echo "Creating a dedicated group for the Beszel Agent service..."
|
|
||||||
addgroup beszel
|
addgroup beszel
|
||||||
echo "Creating a dedicated user for the Beszel Agent service..."
|
|
||||||
adduser -S -D -H -s /sbin/nologin -G beszel beszel
|
adduser -S -D -H -s /sbin/nologin -G beszel beszel
|
||||||
fi
|
fi
|
||||||
# Add the user to the docker group to allow access to the Docker socket if group docker exists
|
# Add the user to the docker group to allow access to the Docker socket if group docker exists
|
||||||
@@ -347,10 +346,37 @@ if is_alpine; then
|
|||||||
echo "Adding beszel to docker group"
|
echo "Adding beszel to docker group"
|
||||||
usermod -aG docker beszel
|
usermod -aG docker beszel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
elif is_openwrt; then
|
||||||
|
# Create beszel group first if it doesn't exist (check /etc/group directly)
|
||||||
|
if ! grep -q "^beszel:" /etc/group >/dev/null 2>&1; then
|
||||||
|
echo "beszel:x:999:" >> /etc/group
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create beszel user if it doesn't exist (double-check to prevent duplicates)
|
||||||
|
if ! id -u beszel >/dev/null 2>&1 && ! grep -q "^beszel:" /etc/passwd >/dev/null 2>&1; then
|
||||||
|
echo "beszel:x:999:999::/nonexistent:/bin/false" >> /etc/passwd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add the user to the docker group if docker group exists and user is not already in it
|
||||||
|
if grep -q "^docker:" /etc/group >/dev/null 2>&1; then
|
||||||
|
echo "Adding beszel to docker group"
|
||||||
|
# Check if beszel is already in docker group
|
||||||
|
if ! grep "^docker:" /etc/group | grep -q "beszel"; then
|
||||||
|
# Add beszel to docker group by modifying /etc/group
|
||||||
|
# Handle both cases: group with existing members and group without members
|
||||||
|
if grep "^docker:" /etc/group | grep -q ":.*:.*$"; then
|
||||||
|
# Group has existing members, append with comma
|
||||||
|
sed -i 's/^docker:\([^:]*:[^:]*:\)\(.*\)$/docker:\1\2,beszel/' /etc/group
|
||||||
|
else
|
||||||
|
# Group has no members, just append
|
||||||
|
sed -i 's/^docker:\([^:]*:[^:]*:\)$/docker:\1beszel/' /etc/group
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
if ! id -u beszel >/dev/null 2>&1; then
|
if ! id -u beszel >/dev/null 2>&1; then
|
||||||
echo "Creating a dedicated user for the Beszel Agent service..."
|
|
||||||
useradd --system --home-dir /nonexistent --shell /bin/false beszel
|
useradd --system --home-dir /nonexistent --shell /bin/false beszel
|
||||||
fi
|
fi
|
||||||
# Add the user to the docker group to allow access to the Docker socket if group docker exists
|
# Add the user to the docker group to allow access to the Docker socket if group docker exists
|
||||||
@@ -546,10 +572,7 @@ start_service() {
|
|||||||
procd_set_param command /opt/beszel-agent/beszel-agent
|
procd_set_param command /opt/beszel-agent/beszel-agent
|
||||||
procd_set_param user beszel
|
procd_set_param user beszel
|
||||||
procd_set_param pidfile /var/run/beszel-agent.pid
|
procd_set_param pidfile /var/run/beszel-agent.pid
|
||||||
procd_set_param env PORT="$PORT"
|
procd_set_param env PORT="$PORT" KEY="$KEY" TOKEN="$TOKEN" HUB_URL="$HUB_URL"
|
||||||
procd_set_param env KEY="$KEY"
|
|
||||||
procd_set_param env TOKEN="$TOKEN"
|
|
||||||
procd_set_param env HUB_URL="$HUB_URL"
|
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
|
|||||||
Reference in New Issue
Block a user