From fb0eee3df249847e5dab8292728e9cdbb4564fd0 Mon Sep 17 00:00:00 2001 From: yaroslav Date: Wed, 31 Dec 2025 10:20:20 +0100 Subject: [PATCH 1/8] Update README with my version note --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c2bec0368b7..db6ad6f54fb 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ Run the server: go build -o notely && ./notely ``` -*This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. +_This starts the server in non-database mode._ It will serve a simple webpage at `http://localhost:8080`. -You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! +You do _not_ need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! + +Yaroslav's version of Boot.dev's Notely app. From 9a4a3aca98da7f87c051ac2a0056599c350a1d99 Mon Sep 17 00:00:00 2001 From: yaroslav Date: Tue, 6 Jan 2026 13:15:30 +0100 Subject: [PATCH 2/8] Add CD workflow --- .DS_Store | Bin 0 -> 10244 bytes .github/workflows/cd.yml | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .DS_Store create mode 100644 .github/workflows/cd.yml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4d41e101b489f5f6d1772ed7fe115e46463f1cb1 GIT binary patch literal 10244 zcmeHNL2nyH6n>M0*iIUkq3bv0K}B}`W~g+l`bGhzW?ecuTD`t%ytXet*JO(Lg+vn>a=(a~RpWLW`|)_hFTL^nZdvh&@`bVS3lq;z zT2s>(r)H*RXJ=n{@zUihS6-@F7wdLouNAPTccdqSir01SwF0+U?br?1Z*4`+XHnIC zwBLz2fgk^tca>S37(w+;oBvvQKAg+YSQTZ#k922cBJbyj8yH|4^`jrrSB99rSe*QD^J(x9eSTO zX^$S!m-ID#OFz=j^c($2k3~*g7FWeJaYMW9^3v_*`$&(=NiLes_Isp&Lel()fUEY9r|SP?-SvDia_Xo6ks?WJYCz z<(z}XZl7DQWFB=UWX4WI=FHqOgb%+|RvM!v5wDju7TJPLEKJbIe(?F7DC-dPHeId@TR8nV}yFBMkX`*2=9N#)?SxVKmEjIICw E0Xjj5*#H0l literal 0 HcmV?d00001 diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000000..0f3cdd6648f --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,22 @@ +name: CD + +on: + push: + branches: [main] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Build production binary + run: ./scripts/buildprod.sh From e996e2656dc6e181d2e24adff9daea2dd480a6db Mon Sep 17 00:00:00 2001 From: yaroslav Date: Tue, 6 Jan 2026 22:48:51 +0100 Subject: [PATCH 3/8] Automate Docker build and push to Artifact Registry --- .github/workflows/cd.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0f3cdd6648f..a293c387e0a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,3 +20,14 @@ jobs: - name: Build production binary run: ./scripts/buildprod.sh + + - name: Authenticate to GCP + uses: google-github-actions/setup-gcloud@v2 + with: + project_id: notely-483516 + service_account_key: ${{ secrets.GCP_CREDENTIALS }} + + - name: Build and push Docker image + run: | + gcloud builds submit \ + --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . \ No newline at end of file From c849b24ae17cdd34757a4a5a82025f6974725a3d Mon Sep 17 00:00:00 2001 From: yaroslav Date: Wed, 7 Jan 2026 11:59:13 +0100 Subject: [PATCH 4/8] Fix gcloud builds submit command --- .github/workflows/cd.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a293c387e0a..66fe5e989c9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -29,5 +29,6 @@ jobs: - name: Build and push Docker image run: | - gcloud builds submit \ - --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . \ No newline at end of file + gcloud builds submit \ + --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . + \ No newline at end of file From 694d0eca06140b4e843088dbeae9bf8d32eb56b8 Mon Sep 17 00:00:00 2001 From: yaroslav Date: Wed, 7 Jan 2026 12:54:13 +0100 Subject: [PATCH 5/8] Fix GCP authentication in CD workflow --- .github/workflows/cd.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 66fe5e989c9..f686aad208b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,13 +22,15 @@ jobs: run: ./scripts/buildprod.sh - name: Authenticate to GCP + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_CREDENTIALS }} + + - name: Set up gcloud uses: google-github-actions/setup-gcloud@v2 with: project_id: notely-483516 - service_account_key: ${{ secrets.GCP_CREDENTIALS }} - + - name: Build and push Docker image - run: | - gcloud builds submit \ - --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . \ No newline at end of file From 4b88e819f7d85e40e1363f414ccb8ff8f5e69581 Mon Sep 17 00:00:00 2001 From: yaroslav Date: Wed, 7 Jan 2026 22:02:28 +0100 Subject: [PATCH 6/8] Auto-deploy to Cloud Run and update title --- .github/workflows/cd.yml | 10 +++++++++- static/index.html | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f686aad208b..828e2cef727 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -33,4 +33,12 @@ jobs: - name: Build and push Docker image run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . - \ No newline at end of file + + - name: Deploy to Cloud Run + run: | + gcloud run deploy notely \ + --image us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest \ + --region us-central1 \ + --allow-unauthenticated \ + --project notely-483516 \ + --max-instances=4 diff --git a/static/index.html b/static/index.html index 72be101028c..35dfb89ce1b 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,7 @@ -

Notely

+

Welcome to Notely

@@ -190,4 +190,4 @@

Your Notes

- + \ No newline at end of file From cf2a66d630f1b965b1d3cb6101f4bc013ec7ac04 Mon Sep 17 00:00:00 2001 From: yaroslav Date: Thu, 8 Jan 2026 00:53:37 +0100 Subject: [PATCH 7/8] Work on CD pipeline --- .github/workflows/cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 828e2cef727..5ec9b7d3aef 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,6 +9,9 @@ jobs: name: Deploy runs-on: ubuntu-latest + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + steps: - name: Checkout code uses: actions/checkout@v4 From 5b5759ae46b8ad6384e9f4725335cb3dede53b5a Mon Sep 17 00:00:00 2001 From: yaroslav Date: Thu, 8 Jan 2026 01:19:13 +0100 Subject: [PATCH 8/8] Run database migrations during CD --- .github/workflows/cd.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5ec9b7d3aef..d727346c81b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -21,6 +21,9 @@ jobs: with: go-version: '1.22' + - name: Install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest + - name: Build production binary run: ./scripts/buildprod.sh @@ -37,6 +40,9 @@ jobs: - name: Build and push Docker image run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . + - name: Run database migrations + run: ./scripts/migrateup.sh + - name: Deploy to Cloud Run run: | gcloud run deploy notely \