Skip to content

Commit

Permalink
Post Namespace.so migration clean-up (#523)
Browse files Browse the repository at this point in the history
- [x] De-provision the Dagger Engine on Fly.io
- [x] Remove the deploy config from fly.io dir
- [x] Update the INFRASTRUCTURE diagram
- [x] Cleanup secrets & variables from GitHub Actions

While at it, bump Actions versions to latest.

Also, split build, test & publish from the deploy steps so that it's
easier to see in Honeycomb.io how much each step takes.

Signed-off-by: Gerhard Lazu <[email protected]>
  • Loading branch information
gerhard authored Sep 2, 2024
1 parent c9252c6 commit 2b80e66
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 110 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/dagger_on_github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout code..."
uses: actions/checkout@v3
uses: actions/checkout@v4

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

- name: "Build, test, publish & deploy..."
- name: "Build, test & publish..."
env:
IMAGE_OWNER: "${{ vars.IMAGE_OWNER }}"
GHCR_USERNAME: "${{ github.actor }}"
Expand All @@ -29,7 +29,24 @@ jobs:
OBAN_LICENSE_KEY: "${{ secrets.OBAN_LICENSE_KEY }}"
run: |
cd magefiles
go run main.go -w ../ ci cd
go run main.go -w ../ ci
- name: "Deploy..."
if: ${{ github.repository == 'thechangelog/changelog.com' && github.ref_name == 'master' }}
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 }}"
run: |
cd magefiles
go run main.go -w ../ cd
- name: "Announce deploy in #dev Slack..."
if: ${{ github.repository == 'thechangelog/changelog.com' && github.ref_name == 'master' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dagger_on_k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
continue-on-error: true
steps:
- name: "Checkout code..."
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.20"
cache-dependency-path: "magefiles/go.sum"
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/dagger_on_namespace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
--privileged \
registry.dagger.io/engine:v0.6.4
- name: "Build, test, publish & deploy..."
- name: "Build, test & publish..."
env:
IMAGE_OWNER: "${{ vars.IMAGE_OWNER }}"
GHCR_USERNAME: "${{ github.actor }}"
Expand All @@ -39,7 +39,25 @@ jobs:
_EXPERIMENTAL_DAGGER_RUNNER_HOST: "docker-container://dagger-0-6-4"
run: |
cd magefiles
go run main.go -w ../ ci cd
go run main.go -w ../ ci
- name: "Deploy..."
if: ${{ github.repository == 'thechangelog/changelog.com' && github.ref_name == 'master' }}
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 ../ cd
- name: "Announce deploy in #dev Slack..."
if: ${{ github.repository == 'thechangelog/changelog.com' && github.ref_name == 'master' }}
Expand Down
33 changes: 17 additions & 16 deletions INFRASTRUCTURE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![shields.io](https://img.shields.io/badge/Last%20updated%20on-Mar.%2028%2C%202024-success?style=for-the-badge)](https://shipit.show/80)
[![shields.io](https://img.shields.io/badge/Last%20updated%20on-Sep.%202%2C%202024-success?style=for-the-badge)](https://shipit.show/80)

This diagram shows the current changelog.com setup:

Expand Down Expand Up @@ -33,9 +33,8 @@ graph TD
repo -.- |fly.io/changelog-2024-01-12| app
registry --> |ghcr.io/changelog/changelog-prod| app
dagger06 --> |flyctl deploy| app
runner --> |flyctl deploy| app
repo -.- |fly.io/dagger-engine-2023-05-20| dagger06
repo -.- |fly.io/dagger-engine-2024-03-28| dagger010
repo -.- |fly.io/pghero-2024-03-27| pghero
Expand All @@ -45,9 +44,6 @@ graph TD
proxy{fa:fa-globe Proxy}
proxy ==> |https| app
dagger06([ fa:fa-project-diagram Dagger Engine v0.6 2023-05-20 ]):::link
click dagger06 "https://fly.io/apps/dagger-engine-2023-05-20"
dagger010([ fa:fa-project-diagram Dagger Engine v0.10 2024-03-28 ]):::link
click dagger010 "https://fly.io/apps/dagger-engine-2024-03-28"
Expand All @@ -58,14 +54,9 @@ graph TD
pghero([ fa:fa-gem PgHero 2024-03-27 ]):::link
click pghero "https://fly.io/apps/pghero-2024-03-27"
automation --> |wireguard| dagger06
dagger06 --> |ghcr.io/changelog/changelog-runtime| registry
dagger06 --> |ghcr.io/changelog/changelog-prod| registry
grafana[ fa:fa-columns Grafana fly-metrics.net ]:::link
click grafana "https://fly-metrics.net"
grafana -.- |metrics| app
grafana -.- |metrics| dagger06
grafana -.- |metrics| dagger010
grafana -.- |metrics| pghero
end
Expand All @@ -81,6 +72,16 @@ graph TD
dbrw -.-> |replicate| dbro1
end
subgraph Namespace.so
runner([ fa:fa-person-running GitHub Runner ]):::link
click runner "https://cloud.namespace.so/9s8hfvousnlae/ghrunners"
automation --> |runs-on: namespace-profile-changelog| runner
runner --> |ghcr.io/changelog/changelog-runtime| registry
runner --> |ghcr.io/changelog/changelog-prod| registry
end
%% Secrets
secrets(( fa:fa-key 1Password )):::link
click secrets "https://changelog.1password.com/"
Expand Down Expand Up @@ -140,7 +141,7 @@ graph TD
```

> [!TIP]
> [Continue live editing this Mermaid diagram](https://mermaid.live/edit#pako:eNqdWHlv2zYU_yqEihYtEEk-4iPuuqFrurQo2gVzuwGLi4KSaImLRGok1cSN8933SOqgHDtNlz8cmXr38XuPvvFinhBv4T1-jDKlSrkIwzVnCl8RyQsSxLwIJcEizlYsFbjM0MfTFUPwF-dYylOyRjlll0gqwS_J4tHkJBrNZ0f2q39FE5UtxuX1c8tjP0HVK1CKniCQQJS0p7KKrIIzqt5UkT3Uf4KU_OYGrXG0WGM_pSqrIqQyEmeYpSTnadg-aXPR7e1isdBGdSLinMaXRhBaeY2bVpLx8LC0lbdijhwaJxchmKItiamIc-LHwHtZG41exopyhny0zGiJ3iq0Wn0-YI2W9aPWhNjIl-EVF5frnF_JUIKiL1QFmyLXtjY6uidcKV5gzXaxWrVR5DmIRac4TYlAZxwtT9-h8JCpnYgfNjjKeRQWWCoi4F9K1jQnsnsKUt6PsCApheLZPH26k_A0i0VAOXr27GB2Led-E7lIZd_OEseXYIbcyXCGVadb5kCElubzoGLN4ijt_DfcNm3QP_QrOP5qMF6-nP_5erTrNVSmH_g_o21gjd6f4a2pmn49Il-z7Y_t1kndvtro-GUVx0RK9CghX7fGJUtFWOK2bmMo2q7zDaSj89YfDUbH_mDoD0egtSz7XHVqjKo6k-GekvFLw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yvpDN39atGbivTuPNEG2CrVxNtjRQnD79HOr44ojlVddi4e9SWV1Sl6A1nZAMuRPtrq8foBLKiQdZw9keTBhJ9We6OvvASipHkRIPzJszgut4vL-2JEjjWWMzvGm8i4fq7h8ZxXpcx7CMAkylxouYulmbV3EnNq5xXyTrHggR_jJxiMzf_NkdxS-WkytI4FVnChYq4RbEmJPmOEENiCYMDktoygPz3F2VrwBPL7pTCe84oRAKgasfbX4mCm-5SwcXPXeKwqmQzEXK8gbUyFbwq6zfBw3rOErtYtIe7P4uK1s62OGEc5cRXhDEq0adSb0qHr7Ydv1ujhimIjKtSNXdcRXARDsfj8WAU1nzShQJHFiCfxb6Gbmtq6QBtnxBy9CA6pxa_Q2nD6JSCd-QVRMDATryFd6NfrDyVEd1eC3hMsLjUjt0CnV5hlxsWewslKnLkVSX0KTm1VxMP4p1LOC0x8xY33rW38GfjaTCdDQYn8-PRZDYZzo-8jbc4GQbD48lsPJoN4Hgyntweed84BwnDYDaejE-OB7CbDWYDIIfxAna_t7_amR_vjIK_DblRePsfsqFhlQ)
> [Continue live editing this Mermaid diagram](https://mermaid.live/edit#pako:eNqVWHlv2zYU_yqEihUtEEk-4nPrhqzp0qHYFsw7gMXDQEnPkhaJ1EgqiRfnu-9R1EE5VrvmD0em3v1-76AfnZBH4KydL74giVKFXPv-jjNF70HyHLyQ574EKsJky2JBi4T8crllBP_CjEp5CTuSpeyWSCX4LaxfzFbBZLk4M1_d-zRSyXpaPHxpeMwnqnqLSslLghJASXMqy8AouErV-zIwh_pPQMEfH8mOBusddeNUJWVAVAJhQlkMGY_99kmbS56e1uu1NqoTEWZpeFsJIluncdNIqjwclrZ1tsySk4bRjY-maEvCVIQZuCHy3tZGk4tQpZwRl2yStCDfK7Ld_jlgjZb1udb4tJIv_XsubncZv5e-REV_pcrb55m2tdHRPdFS8Zxqtpvtto0iz1AsuaRxDIJccbK5_ED8IVM7EZ9tcJDxwM-pVCDwXwy7NAPZPXkx70dYQJwiePavXh0lPE5C4a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MLxgnQ9QxWlGSFYPOHK6GlKX_UrNZd9nLAUenn0pZYtF-U1f3m9l8jqNl0gTTcqRTc7BUWg69vfzR2hZybIkxeDvcjXEU6ARhW9mlcSkAjRN3Ke5j_iL-EIQfNh-uLvf__Lr4vrwU51O4Ol4nKhH2fIWHG9K_FA2u9kh7Ejv13ef59G7VXuCaUwrWn_JhxG70h3ekvqNqN8pTbeji9423mXbEyC9vmlWB3ktrMdCvGrmtzMqdl9oAg15NdKikWHn4KdDxpUGapaoOG7ePWngFZUzecwZ7dCE4ja0eoxXIMvWShrPfHnQf17fe7ugvXiAYIQM9G_d-gvfuPry0J0pgf0Nf-HPjq0jY_p6gsZzXMMaFCadUDFbU7OWyWjePUvNWd-1dRgV4P08ssFVX-DZHYUtlpcrQWIgs8GYENih2ANEnhFQkhtAbkNTCAPPfX5aNAS8NuwWFHzhLMRLYqo68_RYUXlk3Cm9w9pZJVSmbaZjRPe69seBlUb_x_l_NGWK7F53g7o--vLWzBSduAzjoFOAsluTXQs-q4Ttqx29jtGLygspVqZrLqgKa--PpdDqa-DWftFuBJQs7n-l9Dd2hwtIAbZ8Qc_S_6CwsfoLShNGCgnPm5CBwX4qctfOoX2wdlYAurzU-RlTcaseekE7vFps9C521EiWcOWWBdQqX5u7UHBaU_cG5_dVZPzoPzhqvO1NvMV3NF7PVbDWZLednzt5ZLxfebLRcjueL0Wq2XM0mT2fOv5WAsTeejyYrPJ6frxbj1eT8zMFxg378YH6Oq36Ve_oPk-hbCQ)
Let's dig into how all the above pieces fit together.

Expand Down Expand Up @@ -209,9 +210,9 @@ workflow jobs perspective, it is fairly standard:
- **1/2. CI/CD**
- Uses Dagger Go SDK so that it works exactly the same locally as it does in
GitHub Actions
- [Starts a Dagger Engine as a Fly.io machine on-demand, then connects to
it](https://github.com/thechangelog/changelog.com/pull/471) so that caching
is reliable & persistent across workflow runs
- [Uses a Namespace.so GitHub
Runner](https://github.com/thechangelog/changelog.com/pull/522) so that
caching is reliable & persistent across workflow runs
- A successful run publishes a container image to
https://ghcr.io/thechangelog/changelog-runtime &
https://ghcr.io/thechangelog/changelog-prod
Expand Down Expand Up @@ -294,4 +295,4 @@ you very much!
## How to branch the production db instance?
See [`changelog/README.md`](changelog/README.md).
See [Enable changelog.com devs to create prod db forks with a single command](https://github.com/thechangelog/changelog.com/pull/508).
58 changes: 0 additions & 58 deletions fly.io/dagger-engine-2023-05-20/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions fly.io/dagger-engine-2023-05-20/fly.toml

This file was deleted.

0 comments on commit 2b80e66

Please sign in to comment.