From 397db1c2de0fe2d3ff11e347027eefd30da06500 Mon Sep 17 00:00:00 2001 From: Jaime Pillora Date: Mon, 5 Aug 2024 13:25:07 +1000 Subject: [PATCH] fix type, enable auto deploy to fly --- .github/Dockerfile.fly | 2 ++ .github/workflows/ci.yml | 11 ++++++++ fly.toml | 56 ++++++++++++++++++-------------------- handler/handler.go | 2 +- handler/handler_execute.go | 2 +- scripts/install.sh.tmpl | 2 +- scripts/install.txt.tmpl | 2 +- 7 files changed, 44 insertions(+), 33 deletions(-) create mode 100644 .github/Dockerfile.fly diff --git a/.github/Dockerfile.fly b/.github/Dockerfile.fly new file mode 100644 index 0000000..b191262 --- /dev/null +++ b/.github/Dockerfile.fly @@ -0,0 +1,2 @@ +FROM ghcr.io/jpillora/installer +ENTRYPOINT ["/app/bin"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af14060..229f2cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,4 +87,15 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + deploy: + name: Deploy to Fly + needs: release_docker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + diff --git a/fly.toml b/fly.toml index c642b51..1fbb72a 100644 --- a/fly.toml +++ b/fly.toml @@ -3,40 +3,38 @@ app = "installer" kill_signal = "SIGINT" kill_timeout = 5 -processes = [] [build] - builder = "paketobuildpacks/builder:base" - buildpacks = ["gcr.io/paketo-buildpacks/go"] +dockerfile = ".github/Dockerfile.fly" [env] - PORT = "8080" +PORT = "8080" [experimental] - auto_rollback = true +auto_rollback = true [[services]] - http_checks = [] - internal_port = 8080 - processes = ["app"] - protocol = "tcp" - script_checks = [] - [services.concurrency] - hard_limit = 25 - soft_limit = 20 - type = "connections" - - [[services.ports]] - force_https = true - handlers = ["http"] - port = 80 - - [[services.ports]] - handlers = ["tls", "http"] - port = 443 - - [[services.tcp_checks]] - grace_period = "1s" - interval = "15s" - restart_limit = 0 - timeout = "2s" +http_checks = [] +internal_port = 8080 +processes = ["app"] +protocol = "tcp" +script_checks = [] +[services.concurrency] +hard_limit = 25 +soft_limit = 20 +type = "connections" + +[[services.ports]] +force_https = true +handlers = ["http"] +port = 80 + +[[services.ports]] +handlers = ["tls", "http"] +port = 443 + +[[services.tcp_checks]] +grace_period = "1s" +interval = "15s" +restart_limit = 0 +timeout = "2s" diff --git a/handler/handler.go b/handler/handler.go index 1fa1024..6168622 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -39,7 +39,7 @@ type Query struct { type Result struct { Query - ResolvedResolve string + ResolvedRelease string Timestamp time.Time Assets Assets M1Asset bool diff --git a/handler/handler_execute.go b/handler/handler_execute.go index f10cafd..b5768a9 100644 --- a/handler/handler_execute.go +++ b/handler/handler_execute.go @@ -58,7 +58,7 @@ func (h *Handler) execute(q Query) (Result, error) { result := Result{ Timestamp: ts, Query: q, - ResolvedResolve: release, + ResolvedRelease: release, Assets: assets, M1Asset: assets.HasM1(), } diff --git a/scripts/install.sh.tmpl b/scripts/install.sh.tmpl index 980eb39..5d125df 100644 --- a/scripts/install.sh.tmpl +++ b/scripts/install.sh.tmpl @@ -19,7 +19,7 @@ function install { PROG="{{ .Program }}" ASPROG="{{ .AsProgram }}" MOVE="{{ .MoveToPath }}" - RELEASE="{{ .Release }}" # {{ .ResolvedResolve }} + RELEASE="{{ .Release }}" # {{ .ResolvedRelease }} INSECURE="{{ .Insecure }}" OUT_DIR="{{ if .MoveToPath }}/usr/local/bin{{ else }}$(pwd){{ end }}" GH="https://github.com" diff --git a/scripts/install.txt.tmpl b/scripts/install.txt.tmpl index 71243a3..b0c6c5c 100644 --- a/scripts/install.txt.tmpl +++ b/scripts/install.txt.tmpl @@ -2,7 +2,7 @@ repository: https://github.com/{{ .User }}/{{ .Program }} user: {{ .User }} program: {{ .Program }}{{if .AsProgram }} as: {{ .AsProgram }}{{end}} -release: {{ .ResolvedResolve }} +release: {{ .ResolvedRelease }} move-into-path: {{ .MoveToPath }} sudo-move: {{ .SudoMove }} used-search: {{ .Search }}