mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-24 14:36:17 +01:00
Compare commits
6 Commits
v0.0.1-alp
...
v0.0.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be4a583126 | ||
|
|
75f1cb619b | ||
|
|
09806e8688 | ||
|
|
bb295ca297 | ||
|
|
765a4c707b | ||
|
|
683032f919 |
74
.github/workflows/docker-images.yml
vendored
Normal file
74
.github/workflows/docker-images.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
name: Make docker images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- image: henrygd/beszel
|
||||||
|
context: ./hub
|
||||||
|
dockerfile: ./hub/Dockerfile
|
||||||
|
- image: henrygd/beszel-agent
|
||||||
|
context: ./agent
|
||||||
|
dockerfile: ./agent/Dockerfile
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun install --cwd ./hub/site
|
||||||
|
|
||||||
|
- name: Build site
|
||||||
|
run: bun run --cwd ./hub/site build
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Docker metadata
|
||||||
|
id: metadata
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ matrix.image }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
|
||||||
|
|
||||||
|
# https://github.com/docker/login-action
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
|
# https://github.com/docker/build-push-action
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: '${{ matrix.context }}'
|
||||||
|
file: ${{ matrix.dockerfile }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha
|
||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
psutilNet "github.com/shirou/gopsutil/v4/net"
|
psutilNet "github.com/shirou/gopsutil/v4/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "0.0.1-alpha.0"
|
var Version = "0.0.1-alpha.3"
|
||||||
|
|
||||||
var containerCpuMap = make(map[string][2]uint64)
|
var containerCpuMap = make(map[string][2]uint64)
|
||||||
var containerCpuMutex = &sync.Mutex{}
|
var containerCpuMutex = &sync.Mutex{}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -17,7 +16,10 @@ func updateBeszel() {
|
|||||||
currentVersion := semver.MustParse(Version)
|
currentVersion := semver.MustParse(Version)
|
||||||
fmt.Println("beszel-agent", currentVersion)
|
fmt.Println("beszel-agent", currentVersion)
|
||||||
fmt.Println("Checking for updates...")
|
fmt.Println("Checking for updates...")
|
||||||
latest, found, err = selfupdate.DetectLatest("henrygd/beszel")
|
updater, _ := selfupdate.NewUpdater(selfupdate.Config{
|
||||||
|
Filters: []string{"beszel-agent"},
|
||||||
|
})
|
||||||
|
latest, found, err = updater.DetectLatest("henrygd/beszel")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error checking for updates:", err)
|
fmt.Println("Error checking for updates:", err)
|
||||||
@@ -29,7 +31,7 @@ func updateBeszel() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Latest version", "v", latest.Version)
|
fmt.Println("Latest version:", latest.Version)
|
||||||
|
|
||||||
if latest.Version.LTE(currentVersion) {
|
if latest.Version.LTE(currentVersion) {
|
||||||
fmt.Println("You are up to date")
|
fmt.Println("You are up to date")
|
||||||
@@ -37,7 +39,7 @@ func updateBeszel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var binaryPath string
|
var binaryPath string
|
||||||
fmt.Printf("Updating from %s to %s...", currentVersion, latest.Version)
|
fmt.Printf("Updating from %s to %s...\n", currentVersion, latest.Version)
|
||||||
binaryPath, err = os.Executable()
|
binaryPath, err = os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error getting binary path:", err)
|
fmt.Println("Error getting binary path:", err)
|
||||||
@@ -48,5 +50,5 @@ func updateBeszel() {
|
|||||||
fmt.Println("Please try rerunning with sudo. Error:", err)
|
fmt.Println("Please try rerunning with sudo. Error:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log.Printf("Successfully updated: %s -> %s\n\n%s", currentVersion, latest.Version, strings.TrimSpace(latest.ReleaseNotes))
|
fmt.Printf("Successfully updated to %s\n\n%s\n", latest.Version, strings.TrimSpace(latest.ReleaseNotes))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,26 +6,29 @@ WORKDIR /app
|
|||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy source files
|
||||||
COPY *.go ./
|
COPY *.go ./
|
||||||
COPY migrations ./migrations
|
COPY migrations ./migrations
|
||||||
|
COPY site/dist ./site/dist
|
||||||
|
COPY site/*.go ./site
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
unzip \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
|
RUN update-ca-certificates
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
ARG TARGETOS TARGETARCH
|
ARG TARGETOS TARGETARCH
|
||||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /beszel .
|
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-w -s" -o /beszel .
|
||||||
|
|
||||||
# ? -------------------------
|
# ? -------------------------
|
||||||
FROM alpine:latest
|
FROM scratch
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
unzip \
|
|
||||||
ca-certificates
|
|
||||||
|
|
||||||
COPY --from=builder /beszel /
|
COPY --from=builder /beszel /
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
|
|
||||||
COPY ./site/dist /site/dist
|
EXPOSE 8090
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/beszel" ]
|
ENTRYPOINT [ "/beszel" ]
|
||||||
|
CMD ["serve", "--http=0.0.0.0:8090"]
|
||||||
CMD ["serve", "--http=0.0.0.0:8080"]
|
|
||||||
@@ -31,7 +31,7 @@ import (
|
|||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "0.0.1-alpha.0"
|
var Version = "0.0.1-alpha.3"
|
||||||
|
|
||||||
var app *pocketbase.PocketBase
|
var app *pocketbase.PocketBase
|
||||||
var serverConnections = make(map[string]Server)
|
var serverConnections = make(map[string]Server)
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ export function UserAuthForm({
|
|||||||
<Dialog>
|
<Dialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<button type="button" className={cn(buttonVariants({ variant: 'outline' }))}>
|
<button type="button" className={cn(buttonVariants({ variant: 'outline' }))}>
|
||||||
<img className="mr-2 h-4 w-4 dark:invert" src="/icons/github.svg" alt="" />
|
<img className="mr-2 h-4 w-4 dark:invert" src="/static/github.svg" alt="" />
|
||||||
<span className="translate-y-[1px]">GitHub</span>
|
<span className="translate-y-[1px]">GitHub</span>
|
||||||
</button>
|
</button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -18,7 +17,10 @@ func updateBeszel(cmd *cobra.Command, args []string) {
|
|||||||
currentVersion := semver.MustParse(Version)
|
currentVersion := semver.MustParse(Version)
|
||||||
fmt.Println("beszel", currentVersion)
|
fmt.Println("beszel", currentVersion)
|
||||||
fmt.Println("Checking for updates...")
|
fmt.Println("Checking for updates...")
|
||||||
latest, found, err = selfupdate.DetectLatest("henrygd/beszel")
|
updater, _ := selfupdate.NewUpdater(selfupdate.Config{
|
||||||
|
Filters: []string{"beszel_"},
|
||||||
|
})
|
||||||
|
latest, found, err = updater.DetectLatest("henrygd/beszel")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error checking for updates:", err)
|
fmt.Println("Error checking for updates:", err)
|
||||||
@@ -30,7 +32,7 @@ func updateBeszel(cmd *cobra.Command, args []string) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Latest version", "v", latest.Version)
|
fmt.Println("Latest version:", latest.Version)
|
||||||
|
|
||||||
if latest.Version.LTE(currentVersion) {
|
if latest.Version.LTE(currentVersion) {
|
||||||
fmt.Println("You are up to date")
|
fmt.Println("You are up to date")
|
||||||
@@ -38,7 +40,7 @@ func updateBeszel(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var binaryPath string
|
var binaryPath string
|
||||||
fmt.Printf("Updating from %s to %s...", currentVersion, latest.Version)
|
fmt.Printf("Updating from %s to %s...\n", currentVersion, latest.Version)
|
||||||
binaryPath, err = os.Executable()
|
binaryPath, err = os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error getting binary path:", err)
|
fmt.Println("Error getting binary path:", err)
|
||||||
@@ -49,5 +51,5 @@ func updateBeszel(cmd *cobra.Command, args []string) {
|
|||||||
fmt.Println("Please try rerunning with sudo. Error:", err)
|
fmt.Println("Please try rerunning with sudo. Error:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log.Printf("Successfully updated: %s -> %s\n\n%s", currentVersion, latest.Version, strings.TrimSpace(latest.ReleaseNotes))
|
fmt.Printf("Successfully updated to %s\n\n%s\n", latest.Version, strings.TrimSpace(latest.ReleaseNotes))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user