Docker mit traefik und portainer
This commit is contained in:
93
setup-dev.sh
Executable file
93
setup-dev.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Farben für Output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${GREEN}Rezepte Klaus - Development Setup${NC}"
|
||||
echo "================================================"
|
||||
|
||||
# Node.js Version prüfen
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo -e "${RED}❌ Node.js ist nicht installiert${NC}"
|
||||
echo "Bitte installiere Node.js: https://nodejs.org/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NODE_VERSION=$(node --version)
|
||||
echo -e "${GREEN}✅ Node.js Version: ${NODE_VERSION}${NC}"
|
||||
|
||||
# Überprüfe ob MySQL läuft (lokal)
|
||||
if command -v mysql &> /dev/null; then
|
||||
if mysql -u root -e "SELECT 1;" &> /dev/null; then
|
||||
echo -e "${GREEN}✅ MySQL ist verfügbar${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ MySQL läuft nicht oder benötigt Passwort${NC}"
|
||||
fi
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ MySQL nicht gefunden - Docker MySQL wird empfohlen${NC}"
|
||||
fi
|
||||
|
||||
# Environment-Datei für Development
|
||||
if [ ! -f .env ]; then
|
||||
echo -e "${YELLOW}📝 Kopiere .env.development zu .env${NC}"
|
||||
cp .env.development .env
|
||||
else
|
||||
echo -e "${GREEN}✅ .env Datei bereits vorhanden${NC}"
|
||||
fi
|
||||
|
||||
# Backend Setup
|
||||
echo -e "${BLUE}🔧 Backend Setup...${NC}"
|
||||
cd nodejs-version/backend
|
||||
|
||||
if [ ! -d node_modules ]; then
|
||||
echo -e "${YELLOW}📦 Installiere Backend Dependencies...${NC}"
|
||||
npm install
|
||||
else
|
||||
echo -e "${GREEN}✅ Backend Dependencies bereits installiert${NC}"
|
||||
fi
|
||||
|
||||
# Prisma Setup
|
||||
echo -e "${YELLOW}🗃️ Generiere Prisma Client...${NC}"
|
||||
npx prisma generate
|
||||
|
||||
# Frontend Setup
|
||||
echo -e "${BLUE}🎨 Frontend Setup...${NC}"
|
||||
cd ../../frontend
|
||||
|
||||
if [ ! -d node_modules ]; then
|
||||
echo -e "${YELLOW}📦 Installiere Frontend Dependencies...${NC}"
|
||||
npm install
|
||||
else
|
||||
echo -e "${GREEN}✅ Frontend Dependencies bereits installiert${NC}"
|
||||
fi
|
||||
|
||||
# Upload Ordner erstellen
|
||||
cd ..
|
||||
echo -e "${YELLOW}📁 Erstelle Upload-Ordner...${NC}"
|
||||
mkdir -p uploads
|
||||
|
||||
# Legacy Uploads kopieren falls vorhanden
|
||||
if [ -d "upload" ]; then
|
||||
echo -e "${YELLOW}📋 Kopiere bestehende Uploads...${NC}"
|
||||
cp -r upload/* uploads/ 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}🎉 Development Setup abgeschlossen!${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}Development Server starten:${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Backend (Terminal 1):${NC}"
|
||||
echo " cd nodejs-version/backend"
|
||||
echo " npm run dev"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Frontend (Terminal 2):${NC}"
|
||||
echo " cd frontend"
|
||||
echo " npm run dev"
|
||||
echo ""
|
||||
echo -e "${GREEN}Dann öffne: http://localhost:5173${NC}"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user