PAU OJ Online Judge
ProblemsLearnStudy plansContestsSubmissionsRank

Updates

Announcements and upcoming contests

Loading announcements…
Sign in for personal alertsBrowse contests
Log inSign up

PAU OJ

PrimeAsia University Online Judge

A real online judge for programming practice, university contests and coding assessments. Write code in your browser, get sandboxed verdicts, and track your progress.

Platform

  • Problems
  • Contests
  • Submissions
  • Ranking
  • Reviewers

Resources

  • User guide
  • Changelog
  • How judging works
  • System health
  • Create an account

© 2026 PrimeAsia University Online Judge. All rights reserved.

v0.9.0

  1. All tracks
  2. Master class
  3. CI/CD & Deployments

CI/CD & Deployments

CI/CD ও ডিপ্লয়মেন্ট

Topic 37 of 41Story · visual · design practice

In this lesson

  • Story & concept
    • কেন দরকার
    • মূল ধারণা
    • কোডে দেখি
    • ধাপে ধাপে
    • সাধারণ ভুল
      • ল্যাব: rollback plan লেখো
      • চিট শিট
      • প্রোডাকশন নোট
  • Visual story
  • Design practice
  • Checkpoint
  • Discussion
Back to track

0/0 solved

build once/deploy many, canary/blue-green, migrations আর rollback।

In this lesson

  • Story & concept
  • Visual story
  • Design practice
  • Checkpoint
  • Discussion
01

Step 1: Story & concept

Start with the production incident, then the design decision that fixes it.

কেন দরকার

শুক্রবার সন্ধ্যায় চলো-র deploy গেল, ১০ মিনিট পরে 5xx ৪০%। নুসরাত rollback করতে গিয়ে দেখল, image tag latest, পুরোনো image আর নেই; database migration already applied; আর config change আলাদা করে কোথাও লেখা নেই। দুই ঘণ্টা outage।

মাহিন বলল, "deploy মানে শুধু নতুন code নয়—image, migration, config, feature flag আর rollback plan একসাথে।" CI/CD-র লক্ষ্য দ্রুত deploy নয়; নিরাপদে, বারবার, একই ফলাফলে deploy। Build once, deploy many; একই immutable artifact staging আর production-এ যাবে।

মূল ধারণা

CI (Continuous Integration)। প্রতিটা commit-এ lint, typecheck, unit/contract test, build, image bake; fast feedback (≤১০ মিনিট)। Red build merge block।

CD (Continuous Delivery/Deployment)। Delivery মানে artifact ready, deploy manual approval; Deployment মানে স্বয়ংক্রিয়। Production-এ canary/blue-green/rolling—risk অনুযায়ী।

Build once। Image digest/tag commit SHA; staging-এ test করা same digest production-এ। latest নয়; rollback-এর জন্য পুরোনো tag রাখো।

Blue-green। পুরোনো stack (blue) চালু, নতুন (green) পুরো stack up; smoke pass হলে traffic switch; fail হলে switch back। DB migration backward-compatible হতে হবে।

Canary। ১–৫% traffic নতুন version-এ; SLO/error/latency দেখে ধীরে বাড়াও; fail হলে auto rollback। Feature flag দিয়ে code deploy আর feature enable আলাদা করো।

Migrations। Expand → migrate → contract: নতুন column nullable যোগ, dual-write/backfill, পরে পুরোনো সরাও। এক deploy-এ destructive drop নয়; rollback compatibility রাখো।

Secrets/config। Environment-specific, vault/CI secret; image-এ নয়। Config change-ও versioned/audited।

ধাপকীGate
CIlint, type, test, build, imagered block
Staging deploysame digestsmoke/E2E
Productioncanary/blue-greenSLO, error
Post-deployhealth, smoke, tracerollback ready
Rollbackprevious digest/configone command

কোডে দেখি

GitHub Actions-ধাঁচের minimal pipeline:

name: deploy
on:
  push:
    branches: [main]
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pnpm install --frozen-lockfile
      - run: pnpm lint && pnpm typecheck && pnpm test
      - run: docker build -t app:${{ github.sha }} .
      - run: docker push app:${{ github.sha }}
  deploy:
    needs: verify
    steps:
      - run: ./deploy.sh --image app:${{ github.sha }} --canary 5
      - run: ./smoke.sh
      - run: ./promote.sh --to 100
# rollback is a first-class command, not a guess
./deploy.sh --image app:$PREVIOUS_SHA --rollback

Image tag commit SHA; latest নেই। Canary ৫% → smoke → ৫০% → ১০০%; প্রতিটা ধাপে error/latency gate।

ধাপে ধাপে

১. Pipeline দ্রুত করো। Lint/type/unit/contract/build ≤১০ মিনিট; integration/E2E আলাদা job। Cache dependency।

২. Immutable artifact। Commit SHA tag, SBOM, signed image; staging same digest।

৩. Migration expand/contract। নতুন column nullable, backfill, dual-read, পরে drop। Rollback-compatible।

৪. Deploy strategy। Low-risk canary, database-heavy blue-green, stateless rolling; health check + smoke।

৫. Rollback drill। Previous image/config one command; rollback staging-এ মাসে একবার practice। Feature flag kill switch।

সাধারণ ভুল

  • latest image tag। কোন commit চলছে বোঝা যায় না, rollback-ও অনুমান; SHA tag ব্যবহার করো।
  • Build once না করা। Staging-এ এক build, production-এ আরেক—তাহলে staging test অর্থহীন।
  • Destructive migration আগে। Rollback-এ পুরোনো code নতুন schema-য় ভাঙবে; expand/contract করো।
  • Canary ছাড়া সব traffic একসাথে। ৫% দিয়ে error/latency দেখে বাড়াও।
  • Rollback plan না রাখা। পুরোনো image/config না থাকলে outage-এ হাতে-কলমে debug।
  • Deploy-এ secret/image-এ config। Vault/env inject; image immutable রাখো।

ল্যাব: rollback plan লেখো

একটা deploy-এ নতুন column যোগ করলে আর code বদলালে—কোন ক্রমে deploy করবে? যদি ৫ মিনিট পরে rollback লাগে, DB column/backfill কী হবে? কাগজে expand → deploy → backfill → contract ক্রম লেখো, আর প্রতিটা ধাপে rollback action।

চিট শিট

প্রোডাকশন নোট

Deploy আর migration একসাথে করলে rollback জটিল; backward-compatible migration আগে, code পরে। Healthcheck শুধু process নয়, DB/Redis/queue dependency দেখুক। Deploy log-এ commit, image digest, migration version, operator—সব থাকুক; incident review-তে এটাই timeline।

02

Step 2: Visual story

See the mental model first — the animation and the steps below it say the same thing.

Concept visual

একবার বিল্ড, অনেকবার ডিপ্লয়

একই immutable image সব পরিবেশে যায়, তাই staging-এ যা চলেছে প্রোডে-ও সেটাই চলে।

test✓ pass
build✓ pass
sign✓ pass
gateapprove
deployprod
canaryprod
jobs সিরিয়ালি চলেgate ছাড়া deploy নয়
  1. 1build একবার করোimage tag = git SHA
  2. 2migration আলাদা ধাপেপুরোনো কোডও চলতে থাকে
  3. 3blue-green বা canary৫% রিকোয়েস্ট দিয়ে শুরু
  4. 4feature flag দিয়ে খোলোdeploy আর release আলাদা
  5. 5rollback এক ক্লিকেআগের SHA-তে ফেরা
5টি ধাপে দেখা হচ্ছেগতি কমালে স্থির
03

Step 3: Design practice

Write a short design on paper or in a note, then compare it with the rubric. This is not a judge submission.

Design practice

Friday rollback

20 min

image `latest`, migration applied, rollback নেই।

তোমার কাজ

  1. 1pipeline stages/gates আঁকো।
  2. 2expand/contract migration plan দাও।
  3. 3canary/rollback drill লেখো।

ভালো উত্তরে কী থাকবে

  • immutable artifact
  • migration compatibility
  • canary/rollback
04

Step 4: Checkpoint

One timed attempt. Solve every problem to earn the module badge.

Final checkpoint

Ready to prove this module?

45 minutes3 problemsScale Architect badge
Go to checkpoint
05

Step 5: Discussion

Ask questions, share an approach or leave a study tip for this lesson.

Was this lesson helpful?

Your reaction helps other learners judge these notes.

Sign in to react

Discussion

0 comments

Sign in to ask a question or share an approach.

Sign in to comment

No comments yet

Be the first to ask a question or leave a study tip.

Topic 37 of 41

PreviousTestingটেস্টিংTopic 36 of 41
NextHLD & LLDHLD ও LLDTopic 38 of 41
Back to track: System Design MasterclassAll learning tracks
প্রশ্নউত্তর
Image tag?commit SHA
Build?once, same digest
DB?expand/contract
Deploy?canary/blue-green
Rollback?previous digest/config
Feature?flag separate