Feature Flag Service Tutorial · Module 10 of 10

Capstone & Production Deployment

Package the service for production: containerize, set up CI/CD, deploy to cloud, write runbooks, and document everything. By the end, your feature flag service is ready for real teams and real flags in production.

~6–8 hrsAdvancedOperations focus
← Back to Module 10 overview
What You'll Have at the End

Definition of Done

  • Multi-stage Dockerfile for backend and dashboard.
  • docker-compose.yml with all services (app, postgres, redis, grafana).
  • GitHub Actions CI/CD: lint, test, build, push, deploy.
  • Deployment guide for production platform.
  • On-call runbook for common issues: flag not updating, high latency, cache miss.
  • SLO document: 99.9% evaluation latency < 100ms.
  • Polished README with architecture, SDK usage, and examples.
  • All changes committed to git.
The Steps

Build It

STEP 1

Create production Dockerfile

Create Dockerfile:

# Backend build FROM node:20-alpine as backend-build WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build # Backend runtime FROM node:20-alpine as backend-runtime WORKDIR /app COPY --from=backend-build /app/node_modules ./node_modules COPY --from=backend-build /app/dist ./dist COPY --from=backend-build /app/package*.json ./ ENV NODE_ENV=production EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD node -e "require('http').get('http://localhost:3000/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})" CMD ["node", "dist/index.js"] # Dashboard build FROM node:20-alpine as dashboard-build WORKDIR /dashboard COPY dashboard/package*.json ./ RUN npm ci COPY dashboard ./ RUN npm run build # Nginx for dashboard FROM nginx:alpine as final COPY --from=dashboard-build /dashboard/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]