From 0adbd720bf921738f2c15942f776a14750650945 Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Fri, 20 Aug 2021 19:15:20 +0200 Subject: [PATCH 1/7] github/workflows: add docker release --- .github/workflows/release.yml | 46 ++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b191a12..84bb73f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,10 @@ -name: goreleaser +--- +name: release on: push: tags: - - "*" # triggers only if push new tag version + - "*" # triggers only if push new tag version jobs: goreleaser: @@ -27,4 +28,43 @@ jobs: version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + docker-release: + runs-on: ubuntu-latest + steps: + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/headsacle + ghcr.io/${{ github.repository_owner }}/headscale + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Login to GHCR + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 8bcc7e88f03825b7c6835a8f6b9c610f15d01bf9 Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Fri, 20 Aug 2021 19:37:15 +0200 Subject: [PATCH 2/7] github/workflows: add dispatch --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84bb73f..8046592 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: push: tags: - "*" # triggers only if push new tag version + workflow_dispatch: jobs: goreleaser: @@ -66,5 +67,6 @@ jobs: uses: docker/build-push-action@v2 with: push: true + context: . tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From f02beaf0758362426c2c0b3ed4c5d671beedfc15 Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Fri, 20 Aug 2021 19:45:01 +0200 Subject: [PATCH 3/7] github/workflows: add checkout --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8046592..9392db6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,11 @@ jobs: docker-release: runs-on: ubuntu-latest steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Docker meta id: meta From 75afdc6306cebc5612ad5c9d433adffb2a75d99a Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Fri, 20 Aug 2021 20:10:34 +0200 Subject: [PATCH 4/7] github/workflows: remove version tag --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9392db6..4c724f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,6 @@ jobs: ${{ secrets.DOCKERHUB_USERNAME }}/headsacle ghcr.io/${{ github.repository_owner }}/headscale tags: | - type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha From a613501ff218797a4fbbad8df961234743aa4e7f Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Sat, 21 Aug 2021 11:17:21 +0200 Subject: [PATCH 5/7] Update .github/workflows/release.yml Fix typo Co-authored-by: Kristoffer Dalby --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c724f7..7f715ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: with: # list of Docker images to use as base name for tags images: | - ${{ secrets.DOCKERHUB_USERNAME }}/headsacle + ${{ secrets.DOCKERHUB_USERNAME }}/headscale ghcr.io/${{ github.repository_owner }}/headscale tags: | type=semver,pattern={{major}}.{{minor}} From 3b97c7bdecfaca7dcbaa02698c144aa298d476ec Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Sun, 22 Aug 2021 21:47:31 +0200 Subject: [PATCH 6/7] gitignore: add jetbrains --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3a64648..36c91e5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ config.json *.key /db.sqlite *.sqlite3 + +# Exclude Jetbrains Editors +.idea From 18867a4c8404acf9d60e752bee9c555451007de1 Mon Sep 17 00:00:00 2001 From: ohdearaugustin Date: Sun, 12 Sep 2021 18:08:03 +0200 Subject: [PATCH 7/7] update docu --- README.md | 28 ++++++++++++++++++++++++++-- k8s/README.md | 1 - 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb42b66..c13a5fc 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,16 @@ Suggestions/PRs welcomed! ## Running it -1. Download the Headscale binary https://github.com/juanfont/headscale/releases, and place it somewhere in your PATH - +1. Download the Headscale binary https://github.com/juanfont/headscale/releases, and place it somewhere in your PATH or use the docker container + + ```shell + docker pull headscale/headscale:x.x.x + ``` + + or + ```shell + docker pull ghrc.io/juanfont/headscale:x.x.x + ``` 2. (Optional, you can also use SQLite) Get yourself a PostgreSQL DB running @@ -65,11 +73,19 @@ Suggestions/PRs welcomed! ```shell headscale namespaces create myfirstnamespace ``` + or docker: + ```shell + docker run -v ./private.key:/private.key -v ./config.json:/config.json headscale/headscale:x.x.x headscale namespace create myfirstnamespace + ``` 5. Run the server ```shell headscale serve ``` + or docker: + ```shell + docker run -v $(pwd)/private.key:/private.key -v $(pwd)/config.json:/config.json -v $(pwd)/derb.yaml:/derb.yaml -p 127.0.0.1:8080:8080 headscale/headscale:x.x.x headscale serve + ``` 6. If you used tailscale.com before in your nodes, make sure you clear the tailscaled data folder ```shell @@ -89,6 +105,10 @@ Suggestions/PRs welcomed! ```shell headscale -n myfirstnamespace node register YOURMACHINEKEY ``` + or docker: + ```shell + docker run -v ./private.key:/private.key -v ./config.json:/config.json headscale/headscale:x.x.x headscale -n myfirstnamespace node register YOURMACHINEKEY + ``` Alternatively, you can use Auth Keys to register your machines: @@ -96,6 +116,10 @@ Alternatively, you can use Auth Keys to register your machines: ```shell headscale -n myfirstnamespace preauthkeys create --reusable --expiration 24h ``` + or docker: + ```shell + docker run -v ./private.key:/private.key -v ./config.json:/config.json headscale/headscale:x.x.x headscale -n myfirstnamespace preauthkeys create --reusable --expiration 24h + ``` 2. Use the authkey from your machine to register it ```shell diff --git a/k8s/README.md b/k8s/README.md index 0f60794..2f187ab 100644 --- a/k8s/README.md +++ b/k8s/README.md @@ -89,7 +89,6 @@ Use "headscale [command] --help" for more information about a command. # TODO / Ideas -- Github action to publish the docker image - Interpolate `email:` option to the ClusterIssuer from site configuration. This probably needs to be done with a transformer, kustomize vars don't seem to work. - Add kustomize examples for cloud-native ingress, load balancer