mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
Created comprehensive production and development deployment configurations in `/deployment` folder: **Production Stack (docker-compose.production.yml):** - PostgreSQL 16 with persistent storage - C++ DBAL Daemon (optimized, daemon mode) - MetaBuilder App (production build) - Nginx reverse proxy with SSL/TLS - Redis cache layer - Health checks and auto-restart - Resource limits configured - Isolated network (172.20.0.0/16) **Development Stack (docker-compose.development.yml):** - PostgreSQL 16 (port 5433) - C++ DBAL Daemon (debug mode, interactive) - MetaBuilder App (hot-reload with Vite) - Redis cache (port 6380) - Mailhog (email testing, port 8025) - Adminer (DB UI, port 8082) - Redis Commander (Redis UI, port 8083) - Full source mounting for live changes - Isolated network (172.21.0.0/16) **Supporting Files:** - Dockerfile.app - Production app build (multi-stage) - Dockerfile.app.dev - Development with hot-reload - init-db.sh - PostgreSQL initialization script - production.conf - Nginx config with SSL - config.yaml - DBAL daemon configuration - .env.production.example - Production environment template - .env.development.example - Development environment template - README.md - Complete deployment guide - start.sh - Quick start interactive script - .gitignore - Protect secrets and generated files **Fire-and-Forget Features:** - Single command startup: `./deployment/start.sh` - Auto environment detection - SSL certificate generation - Health checks for all services - Automatic retries and restarts - Volume persistence - Complete documentation **Usage:** ```bash # Quick start (interactive) cd deployment && ./start.sh # Or directly docker-compose -f deployment/docker-compose.production.yml up -d docker-compose -f deployment/docker-compose.development.yml up ``` **Services Access:** Production: - App: https://localhost - API: https://localhost/api/dbal/ Development: - App: http://localhost:5173 - API: http://localhost:8081 - DB UI: http://localhost:8082 - Redis UI: http://localhost:8083 - Email: http://localhost:8025 Complete, tested, and production-ready deployment. Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
55 lines
1.1 KiB
Erlang
55 lines
1.1 KiB
Erlang
# Production Dockerfile for MetaBuilder App
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
COPY prisma ./prisma/
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production && \
|
|
npm cache clean --force
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Generate Prisma client
|
|
RUN npm run db:generate
|
|
|
|
# Build application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies only
|
|
RUN apk add --no-cache \
|
|
tini \
|
|
curl
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/package.json ./
|
|
COPY --from=builder /app/prisma ./prisma
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1000 metabuilder && \
|
|
adduser -D -u 1000 -G metabuilder metabuilder && \
|
|
chown -R metabuilder:metabuilder /app
|
|
|
|
USER metabuilder
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s \
|
|
CMD curl -f http://localhost:3000/ || exit 1
|
|
|
|
# Use tini to handle signals properly
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
|
|
# Start application
|
|
CMD ["node", "dist/index.js"]
|