Skip to content

Commit

Permalink
Make the time-to-deploy 2x quicker: 2mins vs 4mins
Browse files Browse the repository at this point in the history
This replaces our Dagger on Fly.io setup with Dagger on Namespace.so

Before this change, throughout August 2024:
- deploys took `4m 36s` 95% of the time
- `1` in `14` deploys failed

Let's see how the above changes after a few weeks of running.

This is the first part of the required change. The second part will
follow after this gets merged. We need to:
- Cleanup secrets & variables from GitHub Actions
- De-provision the Dagger Engine on Fly.io
- Remove the deploy config from fly.io dir
- Update the INFRASTRUCTURE diagram

We still keep K8s to see if we can improve on Namespace.so, the new
Speed King 🏎️

Signed-off-by: Gerhard Lazu <[email protected]>
  • Loading branch information
gerhard committed Sep 1, 2024
1 parent bb25a38 commit 21f1ed1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 102 deletions.
90 changes: 0 additions & 90 deletions .github/workflows/dagger_on_fly.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/dagger_on_namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Dagger on Namespace"

on:
workflow_call:

jobs:
run:
runs-on: namespace-profile-changelog
steps:
- name: "Checkout code..."
uses: namespacelabs/nscloud-checkout-action@v5

- uses: actions/setup-go@v5
with:
go-version: "1.20"
cache-dependency-path: "magefiles/go.sum"

- name: "Provision Dagger with local cache"
run: |
docker run \
--name dagger-0-6-4 \
--detach --restart always \
--volume /cache/dagger-0-6-4:/var/lib/dagger \
--privileged \
registry.dagger.io/engine:v0.6.4
- name: "Build, test, publish & deploy..."
env:
IMAGE_OWNER: "${{ vars.IMAGE_OWNER }}"
GHCR_USERNAME: "${{ github.actor }}"
GHCR_PASSWORD: "${{ secrets.GHCR_PASSWORD }}"
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
R2_API_HOST: "${{ secrets.R2_API_HOST }}"
R2_ACCESS_KEY_ID: "${{ secrets.R2_ACCESS_KEY_ID }}"
R2_SECRET_ACCESS_KEY: "${{ secrets.R2_SECRET_ACCESS_KEY }}"
R2_ASSETS_BUCKET: "${{ env.R2_ASSETS_BUCKET }}"
OBAN_KEY_FINGERPRINT: "${{ secrets.OBAN_KEY_FINGERPRINT }}"
OBAN_LICENSE_KEY: "${{ secrets.OBAN_LICENSE_KEY }}"
_EXPERIMENTAL_DAGGER_RUNNER_HOST: "docker-container://dagger-0-6-4"
run: |
cd magefiles
go run main.go -w ../ ci cd
- name: "Announce deploy in #dev Slack..."
if: ${{ github.repository == 'thechangelog/changelog.com' && github.ref_name == 'master' }}
uses: rtCamp/action-slack-notify@v2
env:
MSG_MINIMAL: "commit,actions url"
SLACK_CHANNEL: dev
SLACK_USERNAME: "GitHub Actions"
SLACK_FOOTER: "Just got shipped to https://changelog.com"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
25 changes: 13 additions & 12 deletions .github/workflows/ship_it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,29 @@ on:
jobs:
# In thechangelog/changelog repository (a.k.a. upstream),
# this is the preferred default:
dagger-on-fly:
if: ${{ contains(vars.RUNS_ON, 'fly') }}
uses: ./.github/workflows/dagger_on_fly.yml
dagger-on-namespace:
if: ${{ contains(vars.RUNS_ON, 'namespace') }}
uses: ./.github/workflows/dagger_on_namespace.yml
secrets: inherit

# When our Fly.io setup misbehaves, we want a fallback:
# Just in case Namespace.so misbehaves, we want a fallback:
# a.k.a. "Always run 2 of everything"
dagger-on-github-fallback:
needs: dagger-on-fly
needs: dagger-on-namespace
if: ${{ failure() }}
uses: ./.github/workflows/dagger_on_github.yml
secrets: inherit

# As forks will not have access to our Fly.io,
# we fallback to GitHub default:
dagger-on-github:
if: ${{ !contains(vars.RUNS_ON, 'fly') }}
uses: ./.github/workflows/dagger_on_github.yml
secrets: inherit

# This is an experimental job which only runs the CI part of our pipeline.
# In other words, this does not run CD, it does not deploy our app.
dagger-on-k8s:
if: ${{ contains(vars.RUNS_ON, 'k8s') }}
uses: ./.github/workflows/dagger_on_k8s.yml
secrets: inherit

# As forks will not have access to our Namespace.so,
# we fallback to GitHub default:
dagger-on-github:
if: ${{ !contains(vars.RUNS_ON, 'namespace') }}
uses: ./.github/workflows/dagger_on_github.yml
secrets: inherit

0 comments on commit 21f1ed1

Please sign in to comment.