From 4e2e52b5c6f68774a98c232e953787dfdecfb726 Mon Sep 17 00:00:00 2001 From: Luca Rickli Date: Mon, 1 Dec 2025 10:49:55 +0100 Subject: [PATCH 1/2] Refactor: github workflows (#79) * fix: undefined error * chore: next release * fix: next release branch * chore: commit SHA added to unstable/next versioning * feat: service worker * feat: about info * feat: Access Control editor * fix: policy service command * fix: tsnet hostnames * fix: viper flags * chore: update docs * feat: switch user * refactor: github workflows * refactor: pr checks --- .github/workflows/check-pr.yaml | 135 ++++++++++++++++++++++ .github/workflows/next.yaml | 198 -------------------------------- .github/workflows/release.yaml | 56 ++------- .github/workflows/unstable.yaml | 54 ++------- README.md | 1 - 5 files changed, 152 insertions(+), 292 deletions(-) create mode 100644 .github/workflows/check-pr.yaml delete mode 100644 .github/workflows/next.yaml diff --git a/.github/workflows/check-pr.yaml b/.github/workflows/check-pr.yaml new file mode 100644 index 0000000..33892bf --- /dev/null +++ b/.github/workflows/check-pr.yaml @@ -0,0 +1,135 @@ +name: Check pull request + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + golang: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Golang + uses: actions/setup-go@v5 + # with: + # go-version: "" + + - name: Run Golang check + run: go vet main.go + + golang-wasm: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + env: + GOOS: js + GOARCH: wasm + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Golang + uses: actions/setup-go@v5 + # with: + # go-version: "" + + - name: Setup binaryen + run: | + sudo apt update + sudo apt install -y binaryen + + - name: Run Golang check + run: go vet ./wasm/wasm.go + + - name: Build Golang WASM + run: go build -trimpath -ldflags "-X tailscale.com/version.shortStamp=1.82.5 -X tailscale.com/version.longStamp=1.82.5-HeadscaleConsole-test-${{ github.sha }} -s -w" -o ./src/lib/api/tsconnect/pkg/client.wasm ./wasm/wasm.go + + - name: Optimize Golang WASM + run: wasm-opt --enable-bulk-memory -Oz ./src/lib/api/tsconnect/pkg/client.wasm -o ./src/lib/api/tsconnect/pkg/client.wasm + + - name: Copy WASM exec.js + run: cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./src/lib/api/tsconnect/pkg/wasm_exec.js + + - name: Upload golang package + uses: actions/upload-artifact@v4 + with: + name: golang-wasm-pkg + path: src/lib/api/tsconnect/pkg/ + + rust-wasm: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup rust + run: | + curl https://sh.rustup.rs -sSf | sh -s -- -y + . "$HOME/.cargo/env" + + - name: Setup wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: Build Rust WASM + working-directory: wasm + run: wasm-pack build --out-name ironrdp --target web + + - name: Upload rust wasm package + uses: actions/upload-artifact@v4 + with: + name: rust-wasm-pkg + path: wasm/pkg/ + + typescript: + needs: + - golang-wasm + - rust-wasm + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Download golang wasm package + uses: actions/download-artifact@v4 + with: + name: golang-wasm-pkg + path: src/lib/api/tsconnect/pkg/ + + - name: Download rust wasm package + uses: actions/download-artifact@v4 + with: + name: rust-wasm-pkg + path: wasm/pkg/ + + - name: Setup Deno + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: Install dependencies + run: deno install + + # Basic syntax & types check + - name: Run checks + run: deno task check + + # TODO: proper tests + # - name: Run unit tests + # run: deno task test:unit + + # - name: Run e2e tests + # run: deno task test:e2e diff --git a/.github/workflows/next.yaml b/.github/workflows/next.yaml deleted file mode 100644 index 2e5e44d..0000000 --- a/.github/workflows/next.yaml +++ /dev/null @@ -1,198 +0,0 @@ -name: Next release - -on: - push: - branches: - - next - -jobs: - build-golang: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: next - - - name: Setup Golang - uses: actions/setup-go@v5 - # with: - # go-version: "" - - - name: Setup binaryen - run: | - sudo apt update - sudo apt install -y binaryen - - - name: Build Golang WASM - run: | - GOOS=js GOARCH=wasm go build -trimpath -ldflags "-X tailscale.com/version.shortStamp=1.82.5 -X tailscale.com/version.longStamp=1.82.5-HeadscaleConsole-next-${{ github.sha }} -s -w" -o ./src/lib/api/tsconnect/pkg/client.wasm ./wasm/wasm.go - wasm-opt --enable-bulk-memory -Oz ./src/lib/api/tsconnect/pkg/client.wasm -o ./src/lib/api/tsconnect/pkg/client.wasm - cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./src/lib/api/tsconnect/pkg/wasm_exec.js - - - name: Upload golang package - uses: actions/upload-artifact@v4 - with: - name: golang-wasm-pkg - path: src/lib/api/tsconnect/pkg/ - - build-rust: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: next - - - name: Setup rust - run: | - curl https://sh.rustup.rs -sSf | sh -s -- -y - . "$HOME/.cargo/env" - - - name: Setup wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Build Rust WASM - working-directory: wasm - run: wasm-pack build --out-name ironrdp --target web - - - name: Upload rust wasm package - uses: actions/upload-artifact@v4 - with: - name: rust-wasm-pkg - path: wasm/pkg/ - - test: - needs: - - build-golang - - build-rust - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: next - - - name: Download golang wasm package - uses: actions/download-artifact@v4 - with: - name: golang-wasm-pkg - path: src/lib/api/tsconnect/pkg/ - - - name: Download rust wasm package - uses: actions/download-artifact@v4 - with: - name: rust-wasm-pkg - path: wasm/pkg/ - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Install dependencies - run: deno install - - # Basic syntax & types check - - name: Run checks - run: deno task check - - # TODO: proper tests - # - name: Run unit tests - # run: deno task test:unit - - # - name: Run e2e tests - # run: deno task test:e2e - - build: - needs: test - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: next - - - name: Download golang wasm package - uses: actions/download-artifact@v4 - with: - name: golang-wasm-pkg - path: src/lib/api/tsconnect/pkg/ - - - name: Download rust wasm package - uses: actions/download-artifact@v4 - with: - name: rust-wasm-pkg - path: wasm/pkg/ - - - name: Setup deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Install dependencies - run: deno install - - - name: Patch version - run: deno --allow-read="package.json" --allow-write="package.json" patch-version.js 0.0.0-next-${{ github.sha }} - - - name: Build frontend - run: deno task build - - - name: Upload app package - uses: actions/upload-artifact@v4 - with: - name: app-pkg - path: dist/ - - publish: - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: next - - - name: Download app package - uses: actions/download-artifact@v4 - with: - name: app-pkg - path: dist/ - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and publish latest docker image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - tags: ghcr.io/rickli-cloud/headscale-console:next - build-args: HEADSCALE_CONSOLE_VERSION=next-${{ github.sha }} - push: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 384218f..333604c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,10 +26,13 @@ jobs: sudo apt install -y binaryen - name: Build Golang WASM - run: | - GOOS=js GOARCH=wasm go build -trimpath -ldflags "-s -w -X tailscale.com/version.shortStamp=1.82.5 -X tailscale.com/version.longStamp=1.82.5-HeadscaleConsole-${{ github.event.release.tag_name }}" -o ./src/lib/api/tsconnect/pkg/client.wasm ./wasm/wasm.go - wasm-opt --enable-bulk-memory -Oz ./src/lib/api/tsconnect/pkg/client.wasm -o ./src/lib/api/tsconnect/pkg/client.wasm - cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./src/lib/api/tsconnect/pkg/wasm_exec.js + run: GOOS=js GOARCH=wasm go build -trimpath -ldflags "-X tailscale.com/version.shortStamp=1.82.5 -X tailscale.com/version.longStamp=1.82.5-HeadscaleConsole-${{ github.event.release.tag_name }} -s -w" -o ./src/lib/api/tsconnect/pkg/client.wasm ./wasm/wasm.go + + - name: Optimize Golang WASM + run: wasm-opt --enable-bulk-memory -Oz ./src/lib/api/tsconnect/pkg/client.wasm -o ./src/lib/api/tsconnect/pkg/client.wasm + + - name: Copy Golang WASM exec.js + run: cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./src/lib/api/tsconnect/pkg/wasm_exec.js - name: Upload golang package uses: actions/upload-artifact@v4 @@ -64,52 +67,11 @@ jobs: name: rust-wasm-pkg path: wasm/pkg/ - test: + build: needs: - build-golang - build-rust runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Download golang wasm package - uses: actions/download-artifact@v4 - with: - name: golang-wasm-pkg - path: src/lib/api/tsconnect/pkg/ - - - name: Download rust wasm package - uses: actions/download-artifact@v4 - with: - name: rust-wasm-pkg - path: wasm/pkg/ - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Install dependencies - run: deno install - - # Basic syntax & types check - - name: Run checks - run: deno task check - - # TODO: proper tests - # - name: Run unit tests - # run: deno task test:unit - - # - name: Run e2e tests - # run: deno task test:e2e - - build: - needs: test - runs-on: ubuntu-latest permissions: contents: read packages: write @@ -204,4 +166,4 @@ jobs: platforms: linux/amd64,linux/arm64 tags: ghcr.io/rickli-cloud/headscale-console:latest push: true - build-args: HEADSCALE_CONSOLE_VERSION=${{ github.event.release.tag_name }} + build-args: HEADSCALE_CONSOLE_VERSION=v${{ github.event.release.tag_name }} diff --git a/.github/workflows/unstable.yaml b/.github/workflows/unstable.yaml index dfa0e1a..3ca5a64 100644 --- a/.github/workflows/unstable.yaml +++ b/.github/workflows/unstable.yaml @@ -26,10 +26,13 @@ jobs: sudo apt install -y binaryen - name: Build Golang WASM - run: | - GOOS=js GOARCH=wasm go build -trimpath -ldflags "-X tailscale.com/version.shortStamp=1.82.5 -X tailscale.com/version.longStamp=1.82.5-HeadscaleConsole-unstable-${{ github.sha }} -s -w" -o ./src/lib/api/tsconnect/pkg/client.wasm ./wasm/wasm.go - wasm-opt --enable-bulk-memory -Oz ./src/lib/api/tsconnect/pkg/client.wasm -o ./src/lib/api/tsconnect/pkg/client.wasm - cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./src/lib/api/tsconnect/pkg/wasm_exec.js + run: GOOS=js GOARCH=wasm go build -trimpath -ldflags "-X tailscale.com/version.shortStamp=1.82.5 -X tailscale.com/version.longStamp=1.82.5-HeadscaleConsole-unstable-${{ github.sha }} -s -w" -o ./src/lib/api/tsconnect/pkg/client.wasm ./wasm/wasm.go + + - name: Optimize Golang WASM + run: wasm-opt --enable-bulk-memory -Oz ./src/lib/api/tsconnect/pkg/client.wasm -o ./src/lib/api/tsconnect/pkg/client.wasm + + - name: Copy Golang WASM exec.js + run: cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" ./src/lib/api/tsconnect/pkg/wasm_exec.js - name: Upload golang package uses: actions/upload-artifact@v4 @@ -64,52 +67,11 @@ jobs: name: rust-wasm-pkg path: wasm/pkg/ - test: + build: needs: - build-golang - build-rust runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Download golang wasm package - uses: actions/download-artifact@v4 - with: - name: golang-wasm-pkg - path: src/lib/api/tsconnect/pkg/ - - - name: Download rust wasm package - uses: actions/download-artifact@v4 - with: - name: rust-wasm-pkg - path: wasm/pkg/ - - - name: Setup Deno - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x - - - name: Install dependencies - run: deno install - - # Basic syntax & types check - - name: Run checks - run: deno task check - - # TODO: proper tests - # - name: Run unit tests - # run: deno task test:unit - - # - name: Run e2e tests - # run: deno task test:e2e - - build: - needs: test - runs-on: ubuntu-latest permissions: contents: read packages: write diff --git a/README.md b/README.md index 1d1f1ea..876e946 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,6 @@ docker run -it ghcr.io/rickli-cloud/headscale-console:unstable --help - `x.x.x`: Specific release versions - `x.x.x-pre`: Pre-release versions (potentially unstable) - `unstable`: Built on every push to the main branch -- `next`: Built on every push to the next branch (may contain undocumented features) #### Docker Compose From 7f295d8a2323a5c6887792ec4b31162cb7a256eb Mon Sep 17 00:00:00 2001 From: Luca Rickli Date: Fri, 12 Dec 2025 17:44:56 +0100 Subject: [PATCH 2/2] chore: update headscale to 0.27 (#82) --- README.md | 8 ++++---- docker-compose.yaml | 6 +++--- proto/headscale/v1/headscale.proto | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 876e946..153fc6e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Headscale Console [![Unstable release](https://github.com/rickli-cloud/headscale-console/actions/workflows/unstable.yaml/badge.svg)](https://github.com/rickli-cloud/headscale-console/actions/workflows/unstable.yaml) -![Current Headscale Version](https://img.shields.io/badge/Headscale-v0.26-blue) +![Current Headscale Version](https://img.shields.io/badge/Headscale-v0.27-blue) **A WebAssembly-powered client for connecting to your Headscale nodes via SSH, VNC, or RDP - directly from the comfort of your browser.** @@ -91,17 +91,17 @@ A full deployment of traefik, headscale, headscale-console, headscale-selfservic 1. **Configure headscale** in `config.yaml` - See [`config-example.yaml`](https://github.com/juanfont/headscale/blob/v0.26.1/config-example.yaml) + See [`config-example.yaml`](https://github.com/juanfont/headscale/blob/v0.27.1/config-example.yaml) 2. **Configure environment variables** in `.env`: ```sh # Required HEADSCALE_SERVER_HOSTNAME=headscale.example.com - HEADSCALE_VERSION=0.26.1 + HEADSCALE_VERSION=0.27.1 # Optional - HEADSCALE_CONSOLE_VERSION=unstable + HEADSCALE_CONSOLE_VERSION=latest TRAEFIK_LISTEN_ADDR=0.0.0.0 TRAEFIK_VERSION=latest ``` diff --git a/docker-compose.yaml b/docker-compose.yaml index a5af594..8af277f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -75,7 +75,7 @@ services: condition: service_started headscale-console: - image: ghcr.io/rickli-cloud/headscale-console:${HEADSCALE_CONSOLE_VERSION:-unstable} + image: ghcr.io/rickli-cloud/headscale-console:${HEADSCALE_CONSOLE_VERSION:-latest} container_name: headscale-console pull_policy: always restart: always @@ -94,7 +94,7 @@ services: traefik.http.services.headscale-console.loadbalancer.server.port: 3000 headscale-selfservice: - image: ghcr.io/rickli-cloud/headscale-console:${HEADSCALE_CONSOLE_VERSION:-unstable} + image: ghcr.io/rickli-cloud/headscale-console:${HEADSCALE_CONSOLE_VERSION:-latest} container_name: headscale-selfservice pull_policy: always restart: always @@ -107,7 +107,7 @@ services: condition: service_started headscale-policyservice: - image: ghcr.io/rickli-cloud/headscale-console:${HEADSCALE_CONSOLE_VERSION:-unstable} + image: ghcr.io/rickli-cloud/headscale-console:${HEADSCALE_CONSOLE_VERSION:-latest} container_name: headscale-policyservice pull_policy: always restart: always diff --git a/proto/headscale/v1/headscale.proto b/proto/headscale/v1/headscale.proto index 5cf5d7b..d16af09 100644 --- a/proto/headscale/v1/headscale.proto +++ b/proto/headscale/v1/headscale.proto @@ -187,6 +187,14 @@ service HeadscaleService { } // --- Policy end --- + // --- Health start --- + rpc Health(HealthRequest) returns (HealthResponse) { + option (google.api.http) = { + get : "/api/v1/health" + }; + } + // --- Health end --- + // Implement Tailscale API // rpc GetDevice(GetDeviceRequest) returns(GetDeviceResponse) { // option(google.api.http) = { @@ -214,3 +222,9 @@ service HeadscaleService { // }; // } } + +message HealthRequest {} + +message HealthResponse { + bool database_connectivity = 1; +}