architect/_archive/2025-11-26-cleanup/cifra/13_DEPLOYMENT.md

CIFRA — Развёртывание

Версия: 2.0.0
Дата: 2025-11-10


Docker

Dockerfile

FROM python:3.11-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
CMD ["cifra", "run", "app.cifra"]

Docker Compose

version: '3.8'

services:
  app:
    build: .
    ports:
      - "8000:8000"
    environment:
      DATABASE_URL: postgresql://user:pass@db:5432/cifra
      REDIS_URL: redis://redis:6379/0
    depends_on:
      - db
      - redis

  db:
    image: postgres:15
    environment:
      POSTGRES_DB: cifra
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass

  redis:
    image: redis:7

Kubernetes

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cifra-app
spec:
  replicas: 3
  template:
    spec:
      containers:
      - name: app
        image: cifra/app:1.0.0
        ports:
        - containerPort: 8000
        env:
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: db-secret
              key: url

CI/CD

GitHub Actions

name: CI/CD

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run tests
        run: |
          pip install -r requirements.txt
          cifra test

  deploy:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to production
        run: cifra deploy production

Zero-downtime deployment

# Blue-Green deployment
cifra deploy production --strategy blue-green

# Canary deployment
cifra deploy production --strategy canary --traffic 10%

Следующий документ: TESTING_AND_QUALITY.md →