From 6468c35f60c4c1fa98aeb1d17bf8834b20a0d8ab Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 09:41:45 +0300 Subject: [PATCH 01/12] add fly.toml --- fly-pro.toml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 fly-pro.toml diff --git a/fly-pro.toml b/fly-pro.toml new file mode 100644 index 000000000..8101a44c6 --- /dev/null +++ b/fly-pro.toml @@ -0,0 +1,39 @@ +# fly.toml app configuration file generated for next-backend on 2024-07-19T08:47:44+01:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'next-backend' +primary_region = 'lhr' +kill_signal = 'SIGINT' +kill_timeout = '5s' + +[env] + DIGGER_HOSTNAME = 'https://ui-backend.digger.dev' + +[build] + dockerfile = 'Dockerfile_backend' + +[[services]] + protocol = 'tcp' + internal_port = 3000 + processes = ['app'] + + [[services.ports]] + port = 80 + handlers = ['http'] + force_https = true + + [[services.ports]] + port = 443 + handlers = ['tls', 'http'] + + [services.concurrency] + type = 'connections' + hard_limit = 25 + soft_limit = 20 + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 From 3ecd9662889c14531d5bcc12d823ca34a61a5ed5 Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 09:51:22 +0300 Subject: [PATCH 02/12] deploy pro --- .github/workflows/pro-deploy.yml | 19 ++++++++++++++++ Dockerfile | 14 ++++++++++++ fly-pro.toml | 38 +++++++++++--------------------- 3 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/pro-deploy.yml create mode 100644 Dockerfile diff --git a/.github/workflows/pro-deploy.yml b/.github/workflows/pro-deploy.yml new file mode 100644 index 000000000..56860cb25 --- /dev/null +++ b/.github/workflows/pro-deploy.yml @@ -0,0 +1,19 @@ +# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ + +name: Fly Deploy +on: + push: + branches: + - main + - pro +jobs: + deploy: + name: Deploy app + runs-on: ubuntu-latest + concurrency: deploy-group # optional: ensure only one action runs at a time + steps: + - uses: actions/checkout@v4 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLYIO_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..fa878e19b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +ARG GO_VERSION=1 +FROM golang:${GO_VERSION}-bookworm as builder + +WORKDIR /usr/src/app +COPY go.mod go.sum ./ +RUN go mod download && go mod verify +COPY . . +RUN go build -v -o /run-app . + + +FROM debian:bookworm + +COPY --from=builder /run-app /usr/local/bin/ +CMD ["run-app"] diff --git a/fly-pro.toml b/fly-pro.toml index 8101a44c6..928bbc348 100644 --- a/fly-pro.toml +++ b/fly-pro.toml @@ -1,38 +1,26 @@ -# fly.toml app configuration file generated for next-backend on 2024-07-19T08:47:44+01:00 +# fly.toml app configuration file generated for digger-pro on 2025-02-18T09:50:24+03:00 # # See https://fly.io/docs/reference/configuration/ for information about how to use this file. # -app = 'next-backend' +app = 'digger-pro' primary_region = 'lhr' -kill_signal = 'SIGINT' -kill_timeout = '5s' - -[env] - DIGGER_HOSTNAME = 'https://ui-backend.digger.dev' [build] - dockerfile = 'Dockerfile_backend' + [build.args] + GO_VERSION = '1.22.4' -[[services]] - protocol = 'tcp' - internal_port = 3000 +[env] + PORT = '8080' + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 processes = ['app'] - [[services.ports]] - port = 80 - handlers = ['http'] - force_https = true - - [[services.ports]] - port = 443 - handlers = ['tls', 'http'] - - [services.concurrency] - type = 'connections' - hard_limit = 25 - soft_limit = 20 - [[vm]] memory = '1gb' cpu_kind = 'shared' From 7f4719e51b31f2a1ae0e71faf0c39a74bdf6e9be Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 10:01:12 +0300 Subject: [PATCH 03/12] pass config file for fly toml --- .github/workflows/pro-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pro-deploy.yml b/.github/workflows/pro-deploy.yml index 56860cb25..0c47fb7b5 100644 --- a/.github/workflows/pro-deploy.yml +++ b/.github/workflows/pro-deploy.yml @@ -1,10 +1,10 @@ # See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ -name: Fly Deploy +name: Deploy pro-backend on: push: branches: - - main + - develop - pro jobs: deploy: From 56c08285ed19f4a47f1b7f2c9d05ec6b5274e482 Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 10:05:18 +0300 Subject: [PATCH 04/12] update file --- .github/workflows/pro-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pro-deploy.yml b/.github/workflows/pro-deploy.yml index 0c47fb7b5..ad5193f3b 100644 --- a/.github/workflows/pro-deploy.yml +++ b/.github/workflows/pro-deploy.yml @@ -14,6 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --remote-only + - run: flyctl deploy --remote-only --config fly-pro.toml env: FLY_API_TOKEN: ${{ secrets.FLYIO_TOKEN }} From 2f09ebab7a330d7518e35ffe49382dfcac90e7a5 Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 10:07:46 +0300 Subject: [PATCH 05/12] add pro token --- .github/workflows/pro-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pro-deploy.yml b/.github/workflows/pro-deploy.yml index ad5193f3b..6f37d4212 100644 --- a/.github/workflows/pro-deploy.yml +++ b/.github/workflows/pro-deploy.yml @@ -16,4 +16,4 @@ jobs: - uses: superfly/flyctl-actions/setup-flyctl@master - run: flyctl deploy --remote-only --config fly-pro.toml env: - FLY_API_TOKEN: ${{ secrets.FLYIO_TOKEN }} + FLY_API_TOKEN: ${{ secrets.FLYIO_PRO_TOKEN }} From 0981083a8281c88530b8a039bf584db8e6e62094 Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 10:10:12 +0300 Subject: [PATCH 06/12] change pro dockerfile --- fly-pro.toml | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/fly-pro.toml b/fly-pro.toml index 928bbc348..96c22f6c3 100644 --- a/fly-pro.toml +++ b/fly-pro.toml @@ -6,21 +6,31 @@ app = 'digger-pro' primary_region = 'lhr' +[env] + DIGGER_HOSTNAME = 'https://ui-backend.digger.dev' + [build] - [build.args] - GO_VERSION = '1.22.4' + dockerfile = 'Dockerfile_backend' -[env] - PORT = '8080' - -[http_service] - internal_port = 8080 - force_https = true - auto_stop_machines = 'stop' - auto_start_machines = true - min_machines_running = 0 +[[services]] + protocol = 'tcp' + internal_port = 3000 processes = ['app'] + [[services.ports]] + port = 80 + handlers = ['http'] + force_https = true + + [[services.ports]] + port = 443 + handlers = ['tls', 'http'] + + [services.concurrency] + type = 'connections' + hard_limit = 25 + soft_limit = 20 + [[vm]] memory = '1gb' cpu_kind = 'shared' From 728af8979845d51cbe97431f68755a3900f13c72 Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 10:26:31 +0300 Subject: [PATCH 07/12] deploy --- fly-pro.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fly-pro.toml b/fly-pro.toml index 96c22f6c3..b8878d64f 100644 --- a/fly-pro.toml +++ b/fly-pro.toml @@ -7,7 +7,7 @@ app = 'digger-pro' primary_region = 'lhr' [env] - DIGGER_HOSTNAME = 'https://ui-backend.digger.dev' + DIGGER_CLOUD_HOSTNAME = 'https://ui-backend.digger.dev' [build] dockerfile = 'Dockerfile_backend' From 78b8501ab0bd73b6aff9db0a60d593af7368276b Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 10:29:50 +0300 Subject: [PATCH 08/12] upgrade atlas version --- Dockerfile_backend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile_backend b/Dockerfile_backend index 6e883720b..3da57fffc 100644 --- a/Dockerfile_backend +++ b/Dockerfile_backend @@ -20,7 +20,7 @@ RUN go build -ldflags="-X 'main.Version=${COMMIT_SHA}'" -o backend_exe ./backend # Multi-stage build will just copy the binary to an alpine image. FROM ubuntu:24.04 as runner -ENV ATLAS_VERSION v0.28.0 +ENV ATLAS_VERSION v0.30.0 ARG COMMIT_SHA WORKDIR /app From b7cd8c508a9184bcab58c05c7f6092202b1be97e Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 11:05:17 +0300 Subject: [PATCH 09/12] use newest atlas version --- Dockerfile_backend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile_backend b/Dockerfile_backend index 3da57fffc..dd0df4212 100644 --- a/Dockerfile_backend +++ b/Dockerfile_backend @@ -20,7 +20,7 @@ RUN go build -ldflags="-X 'main.Version=${COMMIT_SHA}'" -o backend_exe ./backend # Multi-stage build will just copy the binary to an alpine image. FROM ubuntu:24.04 as runner -ENV ATLAS_VERSION v0.30.0 +ENV ATLAS_VERSION v0.31.1 ARG COMMIT_SHA WORKDIR /app From 1ed067f238b5d43302c6768c72a53cb9ea67536b Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 11:08:08 +0300 Subject: [PATCH 10/12] update fly version --- Dockerfile_backend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile_backend b/Dockerfile_backend index dd0df4212..a0ca598ee 100644 --- a/Dockerfile_backend +++ b/Dockerfile_backend @@ -20,7 +20,7 @@ RUN go build -ldflags="-X 'main.Version=${COMMIT_SHA}'" -o backend_exe ./backend # Multi-stage build will just copy the binary to an alpine image. FROM ubuntu:24.04 as runner -ENV ATLAS_VERSION v0.31.1 +ENV ATLAS_VERSION v0.31.0 ARG COMMIT_SHA WORKDIR /app From 516863d19a931a44c2e890ffab40dbfae3275dac Mon Sep 17 00:00:00 2001 From: motatoes Date: Tue, 18 Feb 2025 11:13:07 +0300 Subject: [PATCH 11/12] using jwt auth --- fly-pro.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/fly-pro.toml b/fly-pro.toml index b8878d64f..c24a3a6c6 100644 --- a/fly-pro.toml +++ b/fly-pro.toml @@ -8,6 +8,7 @@ primary_region = 'lhr' [env] DIGGER_CLOUD_HOSTNAME = 'https://ui-backend.digger.dev' + JWT_AUTH = 'true' [build] dockerfile = 'Dockerfile_backend' From 0c0db3a741ecffac1a1c6d8d936889dc92494013 Mon Sep 17 00:00:00 2001 From: motatoes Date: Wed, 19 Feb 2025 09:21:30 +0300 Subject: [PATCH 12/12] remove dockerfile --- Dockerfile | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index fa878e19b..000000000 --- a/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG GO_VERSION=1 -FROM golang:${GO_VERSION}-bookworm as builder - -WORKDIR /usr/src/app -COPY go.mod go.sum ./ -RUN go mod download && go mod verify -COPY . . -RUN go build -v -o /run-app . - - -FROM debian:bookworm - -COPY --from=builder /run-app /usr/local/bin/ -CMD ["run-app"]