feat: add trading platform K8s deployment infrastructure
- Add Helm chart with 19 templates (Deployments, Services, Ingress, ConfigMaps, Secrets, NetworkPolicy, cert-manager) - Add Dockerfiles for 4 microservices (dashboard, data-service, execute-service, news-service) - Add CI/CD workflows (build-test, build-push, deploy) - Add raw K8s manifests, per-service Helm charts, and deploy scripts - Add SOPS-encrypted secrets template and config - Configure deployment to customer1 namespace - Include infrastructure components: PostgreSQL, Redis, Kafka
This commit is contained in:
parent
af4cb3d321
commit
d079d1239f
115 changed files with 5917 additions and 0 deletions
10
trading-platform/dockerfiles/dashboard/.dockerignore
Normal file
10
trading-platform/dockerfiles/dashboard/.dockerignore
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
node_modules/
|
||||
.next/
|
||||
out/
|
||||
dist/
|
||||
.env*
|
||||
.git/
|
||||
.vscode/
|
||||
coverage/
|
||||
.idea/
|
||||
*.log
|
||||
31
trading-platform/dockerfiles/dashboard/Dockerfile
Normal file
31
trading-platform/dockerfiles/dashboard/Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Multi-stage build for Next.js dashboard
|
||||
# ---- Builder ----
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# ---- Production ----
|
||||
FROM node:20-alpine AS runner
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=20s --retries=3 \\
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT}/ || exit 1
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
10
trading-platform/dockerfiles/data-service/.dockerignore
Normal file
10
trading-platform/dockerfiles/data-service/.dockerignore
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Python Docker ignores
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.venv/
|
||||
venv/
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
.git/
|
||||
.env
|
||||
tests/
|
||||
23
trading-platform/dockerfiles/data-service/Dockerfile
Normal file
23
trading-platform/dockerfiles/data-service/Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Multi-stage build for data-service (Postgres + Redis + Kafka consumers)
|
||||
FROM python:3.12-slim AS builder
|
||||
WORKDIR /build
|
||||
COPY pyproject.toml .
|
||||
RUN pip install --no-cache-dir --prefix=/install .
|
||||
|
||||
FROM python:3.12-slim
|
||||
RUN useradd -m --system appuser
|
||||
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
WORKDIR /app
|
||||
COPY --chown=appuser:appuser data_service/ ./data_service/
|
||||
COPY --chown=appuser:appuser pyproject.toml alembic.ini ./
|
||||
|
||||
USER appuser
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=15s --retries=3 \\
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "data_service.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
10
trading-platform/dockerfiles/execute-service/.dockerignore
Normal file
10
trading-platform/dockerfiles/execute-service/.dockerignore
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Python Docker ignores
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.venv/
|
||||
venv/
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
.git/
|
||||
.env
|
||||
tests/
|
||||
23
trading-platform/dockerfiles/execute-service/Dockerfile
Normal file
23
trading-platform/dockerfiles/execute-service/Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Multi-stage build for execute-service (Hyperliquid + Solana trading engine)
|
||||
FROM python:3.12-slim AS builder
|
||||
WORKDIR /build
|
||||
COPY pyproject.toml ./
|
||||
RUN pip install --no-cache-dir --prefix=/install .
|
||||
|
||||
FROM python:3.12-slim
|
||||
RUN useradd -m --system appuser
|
||||
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
WORKDIR /app
|
||||
COPY --chown=appuser:appuser app/ ./app/
|
||||
COPY --chown=appuser:appuser pyproject.toml ./
|
||||
|
||||
USER appuser
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=15s --retries=3 \\
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
10
trading-platform/dockerfiles/news-service/.dockerignore
Normal file
10
trading-platform/dockerfiles/news-service/.dockerignore
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Python Docker ignores
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.venv/
|
||||
venv/
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
.git/
|
||||
.env
|
||||
tests/
|
||||
30
trading-platform/dockerfiles/news-service/Dockerfile
Normal file
30
trading-platform/dockerfiles/news-service/Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Multi-stage build for news-service (CNPG connector + Kafka producer)
|
||||
FROM python:3.12-slim AS builder
|
||||
WORKDIR /build
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
FROM python:3.12-slim
|
||||
RUN useradd -m --system appuser
|
||||
|
||||
# Copy installed deps from builder
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
# Install system deps for NLTK
|
||||
RUN apt-get update && \\
|
||||
apt-get install -y --no-install-recommends gcc libpq-dev && \\
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download NLTK data as root before switching user
|
||||
RUN python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab'); nltk.download('averaged_perceptron_tagger')"
|
||||
|
||||
WORKDIR /app
|
||||
COPY --chown=appuser:appuser . .
|
||||
USER appuser
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=15s --retries=3 \\
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
|
||||
Loading…
Reference in a new issue