Compare commits
No commits in common. "ee15efc8982be7748f479c85742c89031cfd31f5" and "659af9abc0ac4047e196f3ca3655bed07aed7672" have entirely different histories.
ee15efc898
...
659af9abc0
@ -354,18 +354,13 @@ fi
|
||||
|
||||
# Test API-Endpunkt
|
||||
log "${YELLOW}Teste Backend-API...${NC}"
|
||||
log "${YELLOW}HINWEIS: Der API-Server ist bei der ersten Installation oft noch nicht erreichbar${NC}"
|
||||
log "${YELLOW}Dies ist ein bekanntes Verhalten wegen der Netzwerkkonfiguration${NC}"
|
||||
log "${YELLOW}Bitte nach der Installation das System neu starten, danach sollte der API-Server erreichbar sein${NC}"
|
||||
|
||||
# Wir versuchen es trotzdem einmal, um zu sehen, ob er vielleicht doch läuft
|
||||
if curl -s http://localhost:5000/health 2>/dev/null | grep -q "healthy"; then
|
||||
if curl -s http://localhost:5000/health | grep -q "healthy"; then
|
||||
log "${GREEN}Backend-API ist erreichbar und funktioniert${NC}"
|
||||
else
|
||||
log "${YELLOW}Backend-API ist wie erwartet noch nicht erreichbar${NC}"
|
||||
log "${GREEN}Das ist völlig normal bei der Erstinstallation${NC}"
|
||||
log "${GREEN}Nach einem Neustart des Systems sollte der API-Server korrekt erreichbar sein${NC}"
|
||||
log "Container-Status prüfen mit: docker logs myp-backend"
|
||||
error_log "Backend-API ist nicht erreichbar. HTTP-Status:"
|
||||
curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/health
|
||||
log "Container-Logs:"
|
||||
docker logs myp-backend
|
||||
fi
|
||||
|
||||
# Initialisierung der Datenbank prüfen
|
||||
@ -396,8 +391,7 @@ else
|
||||
fi
|
||||
|
||||
log "${GREEN}=== Installation abgeschlossen ===${NC}"
|
||||
log "${YELLOW}WICHTIG: Nach der Erstinstallation ist ein Systemneustart erforderlich${NC}"
|
||||
log "${YELLOW}Danach ist das Backend unter http://localhost:5000 erreichbar${NC}"
|
||||
log "Das Backend ist unter http://localhost:5000 erreichbar"
|
||||
log "Anzeigen der Logs: docker logs -f myp-backend"
|
||||
|
||||
# Verwende die richtige Docker Compose Version für Hinweis
|
||||
|
@ -396,38 +396,19 @@ done
|
||||
|
||||
# Teste ob der Server erreichbar ist
|
||||
log "${YELLOW}Teste ob Frontend-Server erreichbar ist...${NC}"
|
||||
log "${YELLOW}HINWEIS: Bei der Erstinstallation kann es einige Minuten dauern, bis der Server erreichbar ist${NC}"
|
||||
log "${YELLOW}Bei anhaltenden Problemen kann ein Neustart des Systems helfen${NC}"
|
||||
|
||||
MAX_ATTEMPTS=3
|
||||
MAX_ATTEMPTS=12
|
||||
ATTEMPT=1
|
||||
|
||||
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
||||
log "Versuch $ATTEMPT/$MAX_ATTEMPTS..."
|
||||
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 2>/dev/null | grep -q "200\|304"; then
|
||||
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 | grep -q "200\|304"; then
|
||||
log "${GREEN}Frontend-Server ist erreichbar!${NC}"
|
||||
break
|
||||
else
|
||||
# Prüfe, ob der Container noch läuft oder Fehler aufweist
|
||||
CONTAINER_STATUS=$(docker inspect --format='{{.State.Status}}' myp-frontend 2>/dev/null || echo "nicht gefunden")
|
||||
|
||||
if [ "$CONTAINER_STATUS" != "running" ]; then
|
||||
log "${YELLOW}Container ist nicht aktiv (Status: $CONTAINER_STATUS). Prüfe Logs...${NC}"
|
||||
docker logs myp-frontend --tail 20
|
||||
|
||||
# Wenn der Container gestoppt wurde, starte ihn neu
|
||||
if [ "$CONTAINER_STATUS" = "exited" ] || [ "$CONTAINER_STATUS" = "created" ]; then
|
||||
log "${YELLOW}Versuche, den Container neuzustarten...${NC}"
|
||||
docker start myp-frontend
|
||||
sleep 10
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
|
||||
log "${YELLOW}Server noch nicht erreichbar. Das ist bei der Erstinstallation normal.${NC}"
|
||||
log "${GREEN}Der Container ist installiert und sollte nach einem System-Neustart korrekt funktionieren.${NC}"
|
||||
log "${GREEN}Beim ersten Start kann die Datenbank-Migration und der Build länger dauern.${NC}"
|
||||
log "Überprüfen Sie später den Container-Status mit: docker logs myp-frontend"
|
||||
log "${YELLOW}Server noch nicht erreichbar. Das ist normal, wenn der Next.js-Build länger dauert.${NC}"
|
||||
log "Überprüfen Sie den Container-Status mit: docker logs myp-frontend"
|
||||
log "Der Server sollte in wenigen Minuten verfügbar sein."
|
||||
else
|
||||
log "Server noch nicht erreichbar. Warte 10 Sekunden..."
|
||||
sleep 10
|
||||
@ -456,8 +437,7 @@ else
|
||||
fi
|
||||
|
||||
log "${GREEN}=== Installation abgeschlossen ===${NC}"
|
||||
log "${YELLOW}WICHTIG: Nach der Erstinstallation ist ein Systemneustart erforderlich${NC}"
|
||||
log "${YELLOW}Danach ist das Frontend unter http://localhost:3000 erreichbar${NC}"
|
||||
log "Das Frontend ist unter http://localhost:3000 erreichbar"
|
||||
log "Anzeigen der Logs: docker logs -f myp-frontend"
|
||||
|
||||
# Verwende die richtige Docker Compose Version für Hinweis
|
||||
|
@ -36,15 +36,10 @@ RUN echo '#!/bin/sh' > /app/startup.sh && \
|
||||
echo 'mkdir -p /app/db' >> /app/startup.sh && \
|
||||
echo 'echo "Starting application..."' >> /app/startup.sh && \
|
||||
echo 'echo "Attempting database migration..."' >> /app/startup.sh && \
|
||||
echo 'DB_FILE="/app/db/sqlite.db"' >> /app/startup.sh && \
|
||||
echo 'if [ ! -f "$DB_FILE" ]; then' >> /app/startup.sh && \
|
||||
echo ' echo "Creating empty database file..."' >> /app/startup.sh && \
|
||||
echo ' touch "$DB_FILE"' >> /app/startup.sh && \
|
||||
echo 'fi' >> /app/startup.sh && \
|
||||
echo 'NODE_ENV=production npx tsx ./src/server/db/migrate.ts || echo "Migration failed but continuing..."' >> /app/startup.sh && \
|
||||
echo 'NODE_ENV=production node -e "const { migrate } = require(\"drizzle-orm/better-sqlite3/migrator\"); const { db } = require(\"./src/server/db/index.js\"); try { console.log(\"Running migrations...\"); migrate(db, { migrationsFolder: \"./drizzle\" }); console.log(\"Migrations completed\"); } catch(e) { console.error(\"Migration error:\", e); }"' >> /app/startup.sh && \
|
||||
echo 'echo "Migration completed or skipped"' >> /app/startup.sh && \
|
||||
echo 'pnpm build || echo "Build failed, but continuing with existing build..."' >> /app/startup.sh && \
|
||||
echo 'pnpm start || pnpm dev' >> /app/startup.sh && \
|
||||
echo 'pnpm start' >> /app/startup.sh && \
|
||||
chmod +x /app/startup.sh
|
||||
|
||||
# Start the application
|
||||
|
Loading…
x
Reference in New Issue
Block a user