From fd6f03d11d167f52d6e92a5ba03761e7c9e56865 Mon Sep 17 00:00:00 2001 From: rajdip-b Date: Wed, 12 Jun 2024 21:56:16 +0530 Subject: [PATCH] chore(fly): Update fly config --- .github/workflows/deploy.yml | 3 ++- fly.prod.toml | 33 +++++++++++++++++++++++++++++++++ fly.toml => fly.stage.toml | 4 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 fly.prod.toml rename fly.toml => fly.stage.toml (90%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5be9daf..7c1b9c9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,6 +35,7 @@ jobs: env: DATABASE_URL: ${{ secrets.DATABASE_URL }} DATABASE_APP_NAME: ${{ vars.DATABASE_APP_NAME }} + FLY_CONFIG_FILE_NAME: ${{ github.ref == 'refs/heads/main' && 'fly.prod.toml' || 'flu.stage.toml' }} run: | ~/.fly/bin/fly proxy 5432:5432 $DATABASE_APP_NAME.flycast --app $DATABASE_APP_NAME --access-token $FLY_ACCESS_TOKEN & pnpm db:deploy-migrations @@ -44,7 +45,7 @@ jobs: FLY_APP_NAME: ${{ vars.FLY_APP_NAME }} run: | ~/.fly/bin/fly deploy \ - --config fly.toml \ + --config \ --dockerfile Dockerfile \ --app $FLY_APP_NAME \ --access-token $FLY_ACCESS_TOKEN diff --git a/fly.prod.toml b/fly.prod.toml new file mode 100644 index 0000000..31dc8d9 --- /dev/null +++ b/fly.prod.toml @@ -0,0 +1,33 @@ +primary_region = "syd" + +[http_service] + internal_port = 4200 + force_https = true + auto_stop_machines = false + auto_start_machines = false + min_machines_running = 1 + [http_service.concurrency] + type = "requests" + soft_limit = 500 + hard_limit = 750 + +[http_service.tls_options] + alpn = ["h2", "http/1.1"] + versions = ["TLSv1.2", "TLSv1.3"] + default_self_signed = true + +[[http_service.checks]] + grace_period = "10s" + interval = "30s" + method = "GET" + timeout = "10s" + path = "/api/health" + protocol = "http" + port = 4200 + tls_skip_verify = true + +[[vm]] + size = "shared-cpu-1x" + memory = "512mb" + cpus = 1 + cpu_kind = "shared" diff --git a/fly.toml b/fly.stage.toml similarity index 90% rename from fly.toml rename to fly.stage.toml index fbaf08f..cc532d5 100644 --- a/fly.toml +++ b/fly.stage.toml @@ -3,8 +3,8 @@ primary_region = "syd" [http_service] internal_port = 4200 force_https = true - auto_stop_machines = false - auto_start_machines = false + auto_stop_machines = true + auto_start_machines = true min_machines_running = 0 [http_service.concurrency] type = "requests"