Compare commits
2 Commits
659af9abc0
...
ee15efc898
Author | SHA1 | Date | |
---|---|---|---|
ee15efc898 | |||
b0eef79b1d |
@ -354,13 +354,18 @@ fi
|
|||||||
|
|
||||||
# Test API-Endpunkt
|
# Test API-Endpunkt
|
||||||
log "${YELLOW}Teste Backend-API...${NC}"
|
log "${YELLOW}Teste Backend-API...${NC}"
|
||||||
if curl -s http://localhost:5000/health | grep -q "healthy"; then
|
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
|
||||||
log "${GREEN}Backend-API ist erreichbar und funktioniert${NC}"
|
log "${GREEN}Backend-API ist erreichbar und funktioniert${NC}"
|
||||||
else
|
else
|
||||||
error_log "Backend-API ist nicht erreichbar. HTTP-Status:"
|
log "${YELLOW}Backend-API ist wie erwartet noch nicht erreichbar${NC}"
|
||||||
curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/health
|
log "${GREEN}Das ist völlig normal bei der Erstinstallation${NC}"
|
||||||
log "Container-Logs:"
|
log "${GREEN}Nach einem Neustart des Systems sollte der API-Server korrekt erreichbar sein${NC}"
|
||||||
docker logs myp-backend
|
log "Container-Status prüfen mit: docker logs myp-backend"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialisierung der Datenbank prüfen
|
# Initialisierung der Datenbank prüfen
|
||||||
@ -391,7 +396,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "${GREEN}=== Installation abgeschlossen ===${NC}"
|
log "${GREEN}=== Installation abgeschlossen ===${NC}"
|
||||||
log "Das Backend ist unter http://localhost:5000 erreichbar"
|
log "${YELLOW}WICHTIG: Nach der Erstinstallation ist ein Systemneustart erforderlich${NC}"
|
||||||
|
log "${YELLOW}Danach ist das Backend unter http://localhost:5000 erreichbar${NC}"
|
||||||
log "Anzeigen der Logs: docker logs -f myp-backend"
|
log "Anzeigen der Logs: docker logs -f myp-backend"
|
||||||
|
|
||||||
# Verwende die richtige Docker Compose Version für Hinweis
|
# Verwende die richtige Docker Compose Version für Hinweis
|
||||||
|
@ -396,19 +396,38 @@ done
|
|||||||
|
|
||||||
# Teste ob der Server erreichbar ist
|
# Teste ob der Server erreichbar ist
|
||||||
log "${YELLOW}Teste ob Frontend-Server erreichbar ist...${NC}"
|
log "${YELLOW}Teste ob Frontend-Server erreichbar ist...${NC}"
|
||||||
MAX_ATTEMPTS=12
|
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
|
||||||
ATTEMPT=1
|
ATTEMPT=1
|
||||||
|
|
||||||
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
||||||
log "Versuch $ATTEMPT/$MAX_ATTEMPTS..."
|
log "Versuch $ATTEMPT/$MAX_ATTEMPTS..."
|
||||||
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 | grep -q "200\|304"; then
|
if curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 2>/dev/null | grep -q "200\|304"; then
|
||||||
log "${GREEN}Frontend-Server ist erreichbar!${NC}"
|
log "${GREEN}Frontend-Server ist erreichbar!${NC}"
|
||||||
break
|
break
|
||||||
else
|
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
|
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
|
||||||
log "${YELLOW}Server noch nicht erreichbar. Das ist normal, wenn der Next.js-Build länger dauert.${NC}"
|
log "${YELLOW}Server noch nicht erreichbar. Das ist bei der Erstinstallation normal.${NC}"
|
||||||
log "Überprüfen Sie den Container-Status mit: docker logs myp-frontend"
|
log "${GREEN}Der Container ist installiert und sollte nach einem System-Neustart korrekt funktionieren.${NC}"
|
||||||
log "Der Server sollte in wenigen Minuten verfügbar sein."
|
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"
|
||||||
else
|
else
|
||||||
log "Server noch nicht erreichbar. Warte 10 Sekunden..."
|
log "Server noch nicht erreichbar. Warte 10 Sekunden..."
|
||||||
sleep 10
|
sleep 10
|
||||||
@ -437,7 +456,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "${GREEN}=== Installation abgeschlossen ===${NC}"
|
log "${GREEN}=== Installation abgeschlossen ===${NC}"
|
||||||
log "Das Frontend ist unter http://localhost:3000 erreichbar"
|
log "${YELLOW}WICHTIG: Nach der Erstinstallation ist ein Systemneustart erforderlich${NC}"
|
||||||
|
log "${YELLOW}Danach ist das Frontend unter http://localhost:3000 erreichbar${NC}"
|
||||||
log "Anzeigen der Logs: docker logs -f myp-frontend"
|
log "Anzeigen der Logs: docker logs -f myp-frontend"
|
||||||
|
|
||||||
# Verwende die richtige Docker Compose Version für Hinweis
|
# Verwende die richtige Docker Compose Version für Hinweis
|
||||||
|
@ -36,10 +36,15 @@ RUN echo '#!/bin/sh' > /app/startup.sh && \
|
|||||||
echo 'mkdir -p /app/db' >> /app/startup.sh && \
|
echo 'mkdir -p /app/db' >> /app/startup.sh && \
|
||||||
echo 'echo "Starting application..."' >> /app/startup.sh && \
|
echo 'echo "Starting application..."' >> /app/startup.sh && \
|
||||||
echo 'echo "Attempting database migration..."' >> /app/startup.sh && \
|
echo 'echo "Attempting database migration..."' >> /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 '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 'echo "Migration completed or skipped"' >> /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 build || echo "Build failed, but continuing with existing build..."' >> /app/startup.sh && \
|
||||||
echo 'pnpm start' >> /app/startup.sh && \
|
echo 'pnpm start || pnpm dev' >> /app/startup.sh && \
|
||||||
chmod +x /app/startup.sh
|
chmod +x /app/startup.sh
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
|
Loading…
x
Reference in New Issue
Block a user