From 4ae3570e747920e7b1123010075cf8e964e9e67b Mon Sep 17 00:00:00 2001 From: Tine Date: Sun, 18 Feb 2024 08:51:05 +0100 Subject: [PATCH] ci(deploy): trying to fix deploy --- cmd/zdravko/main.go | 20 +++++++++++++------- deploy/fly.toml | 7 +++---- justfile | 6 ++++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/cmd/zdravko/main.go b/cmd/zdravko/main.go index ddf6269..9740f09 100644 --- a/cmd/zdravko/main.go +++ b/cmd/zdravko/main.go @@ -69,6 +69,10 @@ func main() { for _, s := range servers { srv := s + if srv == nil { + continue + } + println("Starting", srv.Name()) wg.Add(1) go func() { @@ -85,13 +89,15 @@ func main() { go func() { for sig := range c { log.Printf("Received signal: %v", sig) - for _, s := range servers { - if s != nil { - println("Stopping", s.Name()) - err := s.Stop() - if err != nil { - log.Fatalf("Unable to stop server %s: %v", s.Name(), err) - } + for _, srv := range servers { + if srv == nil { + continue + } + + println("Stopping", srv.Name()) + err := srv.Stop() + if err != nil { + log.Fatalf("Unable to stop server %s: %v", srv.Name(), err) } } } diff --git a/deploy/fly.toml b/deploy/fly.toml index a034f57..6436119 100644 --- a/deploy/fly.toml +++ b/deploy/fly.toml @@ -40,10 +40,9 @@ primary_region = 'waw' auto_start_machines = true min_machines_running = 0 processes = ['server'] - -[[services.ports]] - port = 7233 - handlers = ['tls'] + [[services.ports]] + port = 7233 + handlers = ['tls'] [[vm]] cpu_kind = 'shared' diff --git a/justfile b/justfile index cfb15b6..a1dc68b 100644 --- a/justfile +++ b/justfile @@ -3,11 +3,13 @@ set shell := ["devbox", "run"] # Load dotenv set dotenv-load +GIT_SHA := `git rev-parse --short HEAD` +DOCKER_IMAGE := "ghcr.io/mentos1386/zdravko:sha-"+GIT_SHA STATIC_DIR := "./web/static" # Build the application build: - docker build -f build/Dockerfile -t ghcr.io/mentos1386/zdravko:latest . + docker build -f build/Dockerfile -t {{DOCKER_IMAGE}} . # Run full development environment run: @@ -20,7 +22,7 @@ run-zdravko: # Deploy the application to fly.io deploy: - fly deploy --ha=false -c deploy/fly.toml + fly deploy --ha=false --smoke-checks=false -c deploy/fly.toml -i {{DOCKER_IMAGE}} # Start devbox shell shell: