@turboops/cli 1.0.0-dev.613 → 1.0.0-dev.615
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +225 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2039,17 +2039,17 @@ async function createDockerSetupWithAI(projectId, verbose = false) {
|
|
|
2039
2039
|
|
|
2040
2040
|
=== ZU ERSTELLENDE DATEIEN ===
|
|
2041
2041
|
|
|
2042
|
-
1. docker-compose.yml (Root-Ebene) -
|
|
2042
|
+
1. docker-compose.yml (Root-Ebene) - Datenbanken + Application Services
|
|
2043
|
+
WICHTIG: Keine Environment-Variablen f\xFCr Application Services!
|
|
2044
|
+
- Environment-Variablen f\xFCr api/app werden von TurboOps zur Deployment-Zeit injiziert
|
|
2045
|
+
- Datenbanken bekommen ihre Konfiguration (Credentials kommen von TurboOps)
|
|
2043
2046
|
\`\`\`yaml
|
|
2044
2047
|
services:
|
|
2045
|
-
# === DATENBANKEN
|
|
2048
|
+
# === DATENBANKEN ===
|
|
2046
2049
|
mongo:
|
|
2047
2050
|
image: mongo:7
|
|
2048
2051
|
volumes:
|
|
2049
2052
|
- mongo_data:/data/db
|
|
2050
|
-
environment:
|
|
2051
|
-
- MONGO_INITDB_ROOT_USERNAME=\${MONGO_USER:-admin}
|
|
2052
|
-
- MONGO_INITDB_ROOT_PASSWORD=\${MONGO_PASSWORD}
|
|
2053
2053
|
healthcheck:
|
|
2054
2054
|
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
|
2055
2055
|
interval: 30s
|
|
@@ -2068,17 +2068,13 @@ services:
|
|
|
2068
2068
|
retries: 3
|
|
2069
2069
|
restart: unless-stopped
|
|
2070
2070
|
|
|
2071
|
-
# === APPLICATION SERVICES ===
|
|
2071
|
+
# === APPLICATION SERVICES (keine environment - kommt von TurboOps!) ===
|
|
2072
2072
|
api:
|
|
2073
2073
|
build:
|
|
2074
2074
|
context: .
|
|
2075
2075
|
dockerfile: ./projects/api/Dockerfile # oder ./api/Dockerfile
|
|
2076
|
-
|
|
2077
|
-
- "3000
|
|
2078
|
-
environment:
|
|
2079
|
-
- NODE_ENV=production
|
|
2080
|
-
- MONGO_URI=mongodb://\${MONGO_USER:-admin}:\${MONGO_PASSWORD}@mongo:27017/app?authSource=admin
|
|
2081
|
-
- REDIS_URL=redis://redis:6379
|
|
2076
|
+
expose:
|
|
2077
|
+
- "3000"
|
|
2082
2078
|
depends_on:
|
|
2083
2079
|
mongo:
|
|
2084
2080
|
condition: service_healthy
|
|
@@ -2095,11 +2091,9 @@ services:
|
|
|
2095
2091
|
app:
|
|
2096
2092
|
build:
|
|
2097
2093
|
context: .
|
|
2098
|
-
dockerfile: ./projects/app/Dockerfile # oder ./
|
|
2099
|
-
|
|
2100
|
-
- "
|
|
2101
|
-
environment:
|
|
2102
|
-
- NUXT_PUBLIC_API_URL=http://api:3000
|
|
2094
|
+
dockerfile: ./projects/app/Dockerfile # oder ./api/Dockerfile
|
|
2095
|
+
expose:
|
|
2096
|
+
- "3000"
|
|
2103
2097
|
depends_on:
|
|
2104
2098
|
api:
|
|
2105
2099
|
condition: service_healthy
|
|
@@ -2116,16 +2110,24 @@ volumes:
|
|
|
2116
2110
|
\`\`\`
|
|
2117
2111
|
|
|
2118
2112
|
2. Dockerfile f\xFCr jeden Service (im jeweiligen Ordner)
|
|
2113
|
+
KRITISCH: IMMER --ignore-scripts bei npm ci verwenden!
|
|
2119
2114
|
\`\`\`dockerfile
|
|
2120
|
-
#
|
|
2121
|
-
FROM node:
|
|
2115
|
+
# Stage 1: Dependencies
|
|
2116
|
+
FROM node:22-alpine AS deps
|
|
2122
2117
|
WORKDIR /app
|
|
2123
2118
|
COPY package*.json ./
|
|
2124
|
-
|
|
2119
|
+
# KRITISCH: --ignore-scripts verhindert husky/prepare Fehler in Docker!
|
|
2120
|
+
RUN npm ci --ignore-scripts
|
|
2121
|
+
|
|
2122
|
+
# Stage 2: Builder
|
|
2123
|
+
FROM node:22-alpine AS builder
|
|
2124
|
+
WORKDIR /app
|
|
2125
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
2125
2126
|
COPY . .
|
|
2126
2127
|
RUN npm run build
|
|
2127
2128
|
|
|
2128
|
-
|
|
2129
|
+
# Stage 3: Runner (Production)
|
|
2130
|
+
FROM node:22-alpine AS runner
|
|
2129
2131
|
WORKDIR /app
|
|
2130
2132
|
ENV NODE_ENV=production
|
|
2131
2133
|
# Non-root user f\xFCr Sicherheit
|
|
@@ -2150,9 +2152,14 @@ dist
|
|
|
2150
2152
|
coverage
|
|
2151
2153
|
\`\`\`
|
|
2152
2154
|
|
|
2153
|
-
=== WICHTIGE REGELN ===
|
|
2155
|
+
=== WICHTIGE REGELN F\xDCR TURBOOPS ===
|
|
2156
|
+
- KRITISCH: IMMER \`npm ci --ignore-scripts\` verwenden (verhindert husky/prepare Fehler!)
|
|
2157
|
+
- KRITISCH: KEINE \`ports:\` \u2192 Verwende \`expose:\` (nur im Docker-Netzwerk sichtbar)
|
|
2158
|
+
- KRITISCH: KEINE \`environment:\` f\xFCr Application Services (api, app) \u2192 Env-Variablen werden von TurboOps zur Deployment-Zeit injiziert
|
|
2159
|
+
- Datenbank-Services (mongo, redis, etc.) OHNE environment - Credentials kommen von TurboOps
|
|
2160
|
+
- Ein Reverse-Proxy (Traefik) routet externe Anfragen
|
|
2154
2161
|
- Pr\xFCfe die tats\xE4chliche Projektstruktur (projects/, packages/, apps/, oder flach)
|
|
2155
|
-
- Passe Pfade entsprechend an
|
|
2162
|
+
- Passe Dockerfile-Pfade entsprechend an
|
|
2156
2163
|
- NestJS: CMD ["node", "dist/main.js"]
|
|
2157
2164
|
- Nuxt: CMD ["node", ".output/server/index.mjs"]
|
|
2158
2165
|
- Nutze wget statt curl f\xFCr healthchecks (curl nicht in alpine)
|
|
@@ -2625,23 +2632,112 @@ async function createDockerSetupWithAI2() {
|
|
|
2625
2632
|
|
|
2626
2633
|
**Wichtig: TurboOps ben\xF6tigt eine docker-compose.yml auf Root-Ebene!**
|
|
2627
2634
|
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2635
|
+
KRITISCHE ANFORDERUNGEN:
|
|
2636
|
+
|
|
2637
|
+
1. docker-compose.yml im Projekt-Root:
|
|
2638
|
+
- Services f\xFCr alle Komponenten (api, app, etc.)
|
|
2631
2639
|
- Verwende build-Direktive mit Pfad zu den Dockerfiles
|
|
2640
|
+
- KEINE version: Angabe (deprecated)
|
|
2632
2641
|
- Health-Checks f\xFCr alle Services
|
|
2633
|
-
- Production-geeignete Konfiguration
|
|
2634
2642
|
|
|
2635
|
-
2.
|
|
2636
|
-
- Multi-stage builds
|
|
2637
|
-
-
|
|
2638
|
-
-
|
|
2643
|
+
2. Dockerfiles - WICHTIGE REGELN:
|
|
2644
|
+
- Multi-stage builds (deps -> builder -> runner)
|
|
2645
|
+
- IMMER \`npm ci --ignore-scripts\` verwenden (verhindert husky/prepare Fehler!)
|
|
2646
|
+
- Non-root User f\xFCr Production
|
|
2647
|
+
- Minimales Base-Image (node:22-alpine)
|
|
2648
|
+
|
|
2649
|
+
3. .dockerignore auf Root-Ebene:
|
|
2650
|
+
- node_modules, .git, dist, .env*, *.log
|
|
2651
|
+
|
|
2652
|
+
4. Monorepo-Struktur beachten:
|
|
2653
|
+
- Pr\xFCfe projects/, packages/, apps/ Ordner
|
|
2654
|
+
- Context muss Root sein f\xFCr Monorepo-Zugriff
|
|
2655
|
+
|
|
2656
|
+
DOCKERFILE-TEMPLATE (STRIKT EINHALTEN!):
|
|
2657
|
+
\`\`\`dockerfile
|
|
2658
|
+
# Stage 1: Dependencies
|
|
2659
|
+
FROM node:22-alpine AS deps
|
|
2660
|
+
WORKDIR /app
|
|
2661
|
+
COPY package*.json ./
|
|
2662
|
+
# WICHTIG: --ignore-scripts verhindert husky/prepare Fehler!
|
|
2663
|
+
RUN npm ci --ignore-scripts
|
|
2664
|
+
|
|
2665
|
+
# Stage 2: Builder
|
|
2666
|
+
FROM node:22-alpine AS builder
|
|
2667
|
+
WORKDIR /app
|
|
2668
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
2669
|
+
COPY . .
|
|
2670
|
+
RUN npm run build
|
|
2671
|
+
|
|
2672
|
+
# Stage 3: Runner (Production)
|
|
2673
|
+
FROM node:22-alpine AS runner
|
|
2674
|
+
WORKDIR /app
|
|
2675
|
+
ENV NODE_ENV=production
|
|
2676
|
+
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
|
|
2677
|
+
USER nodejs
|
|
2678
|
+
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
|
|
2679
|
+
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
|
|
2680
|
+
COPY --from=builder --chown=nodejs:nodejs /app/package.json ./
|
|
2681
|
+
EXPOSE 3000
|
|
2682
|
+
CMD ["node", "dist/main.js"]
|
|
2683
|
+
\`\`\`
|
|
2684
|
+
|
|
2685
|
+
docker-compose.yml TEMPLATE:
|
|
2686
|
+
\`\`\`yaml
|
|
2687
|
+
services:
|
|
2688
|
+
# === DATENBANKEN (erkenne aus package.json: mongoose \u2192 mongo, ioredis \u2192 redis) ===
|
|
2689
|
+
mongo:
|
|
2690
|
+
image: mongo:7
|
|
2691
|
+
volumes:
|
|
2692
|
+
- mongo_data:/data/db
|
|
2693
|
+
healthcheck:
|
|
2694
|
+
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
|
2695
|
+
interval: 30s
|
|
2696
|
+
timeout: 10s
|
|
2697
|
+
retries: 3
|
|
2698
|
+
restart: unless-stopped
|
|
2699
|
+
|
|
2700
|
+
redis:
|
|
2701
|
+
image: redis:7-alpine
|
|
2702
|
+
volumes:
|
|
2703
|
+
- redis_data:/data
|
|
2704
|
+
healthcheck:
|
|
2705
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
2706
|
+
interval: 30s
|
|
2707
|
+
timeout: 10s
|
|
2708
|
+
retries: 3
|
|
2709
|
+
restart: unless-stopped
|
|
2710
|
+
|
|
2711
|
+
# === APPLICATION SERVICES (KEINE environment!) ===
|
|
2712
|
+
api:
|
|
2713
|
+
build:
|
|
2714
|
+
context: .
|
|
2715
|
+
dockerfile: projects/api/Dockerfile
|
|
2716
|
+
expose:
|
|
2717
|
+
- "3000"
|
|
2718
|
+
depends_on:
|
|
2719
|
+
mongo:
|
|
2720
|
+
condition: service_healthy
|
|
2721
|
+
redis:
|
|
2722
|
+
condition: service_healthy
|
|
2723
|
+
healthcheck:
|
|
2724
|
+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
|
|
2725
|
+
interval: 30s
|
|
2726
|
+
timeout: 10s
|
|
2727
|
+
retries: 3
|
|
2728
|
+
restart: unless-stopped
|
|
2639
2729
|
|
|
2640
|
-
|
|
2641
|
-
|
|
2730
|
+
volumes:
|
|
2731
|
+
mongo_data:
|
|
2732
|
+
redis_data:
|
|
2733
|
+
\`\`\`
|
|
2642
2734
|
|
|
2643
|
-
|
|
2644
|
-
|
|
2735
|
+
WICHTIG - TURBOOPS DEPLOYMENT:
|
|
2736
|
+
- KEINE \`ports:\` \u2192 Verwende \`expose:\` (nur im Docker-Netzwerk sichtbar)
|
|
2737
|
+
- KEINE \`environment:\` f\xFCr Application Services \u2192 Env-Variablen werden von TurboOps zur Deployment-Zeit injiziert
|
|
2738
|
+
- Datenbanken OHNE environment - Credentials kommen von TurboOps
|
|
2739
|
+
- Ein Reverse-Proxy (Traefik) routet externe Anfragen
|
|
2740
|
+
- Verhindert Port-Konflikte bei mehreren Projekten auf einem Server
|
|
2645
2741
|
|
|
2646
2742
|
Erstelle alle notwendigen Dateien.`;
|
|
2647
2743
|
const success = await aiToolsService.runWithPrompt(tool, prompt);
|
|
@@ -2711,41 +2807,117 @@ var DOCKER_SETUP_PROMPT = `Analysiere dieses Projekt und erstelle ein vollst\xE4
|
|
|
2711
2807
|
|
|
2712
2808
|
**Wichtig: TurboOps ben\xF6tigt eine docker-compose.yml auf Root-Ebene!**
|
|
2713
2809
|
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2810
|
+
KRITISCHE ANFORDERUNGEN:
|
|
2811
|
+
|
|
2812
|
+
1. docker-compose.yml im Projekt-Root:
|
|
2813
|
+
- Services f\xFCr alle Komponenten (api, app, etc.)
|
|
2717
2814
|
- Verwende build-Direktive mit Pfad zu den Dockerfiles
|
|
2815
|
+
- KEINE version: Angabe (deprecated)
|
|
2718
2816
|
- Health-Checks f\xFCr alle Services
|
|
2719
|
-
- Production-geeignete Konfiguration
|
|
2720
2817
|
|
|
2721
|
-
2.
|
|
2722
|
-
- Multi-stage builds
|
|
2723
|
-
-
|
|
2724
|
-
-
|
|
2818
|
+
2. Dockerfiles - WICHTIGE REGELN:
|
|
2819
|
+
- Multi-stage builds (deps -> builder -> runner)
|
|
2820
|
+
- IMMER \`npm ci --ignore-scripts\` verwenden (verhindert husky/prepare Fehler!)
|
|
2821
|
+
- Non-root User f\xFCr Production
|
|
2822
|
+
- Minimales Base-Image (node:22-alpine)
|
|
2823
|
+
|
|
2824
|
+
3. .dockerignore auf Root-Ebene:
|
|
2825
|
+
- node_modules, .git, dist, .env*, *.log
|
|
2826
|
+
|
|
2827
|
+
4. Monorepo-Struktur beachten:
|
|
2828
|
+
- Pr\xFCfe projects/, packages/, apps/ Ordner
|
|
2829
|
+
- Context muss Root sein f\xFCr Monorepo-Zugriff
|
|
2725
2830
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2831
|
+
DOCKERFILE-TEMPLATE (STRIKT EINHALTEN!):
|
|
2832
|
+
\`\`\`dockerfile
|
|
2833
|
+
# Stage 1: Dependencies
|
|
2834
|
+
FROM node:22-alpine AS deps
|
|
2835
|
+
WORKDIR /app
|
|
2836
|
+
COPY package*.json ./
|
|
2837
|
+
# WICHTIG: --ignore-scripts verhindert husky/prepare Fehler!
|
|
2838
|
+
RUN npm ci --ignore-scripts
|
|
2728
2839
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2840
|
+
# Stage 2: Builder
|
|
2841
|
+
FROM node:22-alpine AS builder
|
|
2842
|
+
WORKDIR /app
|
|
2843
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
2844
|
+
COPY . .
|
|
2845
|
+
RUN npm run build
|
|
2731
2846
|
|
|
2732
|
-
|
|
2847
|
+
# Stage 3: Runner (Production)
|
|
2848
|
+
FROM node:22-alpine AS runner
|
|
2849
|
+
WORKDIR /app
|
|
2850
|
+
ENV NODE_ENV=production
|
|
2851
|
+
|
|
2852
|
+
# Non-root user
|
|
2853
|
+
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
|
|
2854
|
+
USER nodejs
|
|
2855
|
+
|
|
2856
|
+
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
|
|
2857
|
+
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
|
|
2858
|
+
COPY --from=builder --chown=nodejs:nodejs /app/package.json ./
|
|
2859
|
+
|
|
2860
|
+
EXPOSE 3000
|
|
2861
|
+
CMD ["node", "dist/main.js"]
|
|
2862
|
+
\`\`\`
|
|
2863
|
+
|
|
2864
|
+
docker-compose.yml TEMPLATE:
|
|
2733
2865
|
\`\`\`yaml
|
|
2734
|
-
version: '3.8'
|
|
2735
2866
|
services:
|
|
2867
|
+
# === DATENBANKEN (erkenne aus package.json: mongoose \u2192 mongo, ioredis \u2192 redis) ===
|
|
2868
|
+
mongo:
|
|
2869
|
+
image: mongo:7
|
|
2870
|
+
volumes:
|
|
2871
|
+
- mongo_data:/data/db
|
|
2872
|
+
healthcheck:
|
|
2873
|
+
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
|
2874
|
+
interval: 30s
|
|
2875
|
+
timeout: 10s
|
|
2876
|
+
retries: 3
|
|
2877
|
+
restart: unless-stopped
|
|
2878
|
+
|
|
2879
|
+
redis:
|
|
2880
|
+
image: redis:7-alpine
|
|
2881
|
+
volumes:
|
|
2882
|
+
- redis_data:/data
|
|
2883
|
+
healthcheck:
|
|
2884
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
2885
|
+
interval: 30s
|
|
2886
|
+
timeout: 10s
|
|
2887
|
+
retries: 3
|
|
2888
|
+
restart: unless-stopped
|
|
2889
|
+
|
|
2890
|
+
# === APPLICATION SERVICES (KEINE environment!) ===
|
|
2736
2891
|
api:
|
|
2737
2892
|
build:
|
|
2738
2893
|
context: .
|
|
2739
|
-
dockerfile:
|
|
2740
|
-
|
|
2741
|
-
- "3000
|
|
2894
|
+
dockerfile: projects/api/Dockerfile
|
|
2895
|
+
expose:
|
|
2896
|
+
- "3000"
|
|
2897
|
+
depends_on:
|
|
2898
|
+
mongo:
|
|
2899
|
+
condition: service_healthy
|
|
2900
|
+
redis:
|
|
2901
|
+
condition: service_healthy
|
|
2742
2902
|
healthcheck:
|
|
2743
|
-
test: ["CMD", "
|
|
2903
|
+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
|
|
2744
2904
|
interval: 30s
|
|
2745
2905
|
timeout: 10s
|
|
2746
2906
|
retries: 3
|
|
2907
|
+
restart: unless-stopped
|
|
2908
|
+
|
|
2909
|
+
volumes:
|
|
2910
|
+
mongo_data:
|
|
2911
|
+
redis_data:
|
|
2747
2912
|
\`\`\`
|
|
2748
2913
|
|
|
2914
|
+
WICHTIG - TURBOOPS DEPLOYMENT:
|
|
2915
|
+
- KEINE \`ports:\` \u2192 Verwende \`expose:\` (nur im Docker-Netzwerk sichtbar)
|
|
2916
|
+
- KEINE \`environment:\` f\xFCr Application Services \u2192 Env-Variablen werden von TurboOps zur Deployment-Zeit injiziert
|
|
2917
|
+
- Datenbanken OHNE environment - Credentials kommen von TurboOps
|
|
2918
|
+
- Ein Reverse-Proxy (Traefik) routet externe Anfragen
|
|
2919
|
+
- Verhindert Port-Konflikte bei mehreren Projekten auf einem Server
|
|
2920
|
+
|
|
2749
2921
|
Erstelle alle notwendigen Dateien.`;
|
|
2750
2922
|
var dockerCommand = new Command6("docker").description("Manage Docker configuration");
|
|
2751
2923
|
dockerCommand.command("generate").description("Docker-Setup (docker-compose + Dockerfiles) mit AI erstellen").option("-f, --force", "Bestehende Dateien \xFCberschreiben").action(async (options) => {
|