Files
marcoandClaude Sonnet 4.6 e09d3e924f
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
Add release workflow, install.sh and update.sh for customer deployment
- release.yml: triggered by git tag v*, builds assets, creates ZIP,
  attaches to Gitea release
- install.sh: interactive first-time setup (DB config, key:generate,
  migrate, seed, cache)
- update.sh: update existing installation (clear caches, migrate, rebuild)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 11:35:10 +02:00

113 lines
3.1 KiB
Bash

#!/bin/bash
# WITshop Erstinstallation
# Ausführen mit: bash install.sh
set -e
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
echo ""
echo "=================================="
echo " WITshop Erstinstallation"
echo "=================================="
echo ""
# PHP-Pfad ermitteln
PHP=$(which php 2>/dev/null || echo "/opt/plesk/php/8.4/bin/php")
COMPOSER=$(which composer 2>/dev/null || echo "/usr/local/psa/var/modules/composer/composer.phar")
echo -e "${YELLOW}Verwendetes PHP:${NC} $PHP"
echo -e "${YELLOW}Composer:${NC} $COMPOSER"
echo ""
# .env erstellen
if [ -f ".env" ]; then
echo -e "${YELLOW}HINWEIS: .env existiert bereits. Wird nicht überschrieben.${NC}"
else
echo "--- Datenbank & Shop konfigurieren ---"
echo ""
read -p "Shop-Name: " SHOP_NAME
read -p "Shop-URL (z.B. https://shop.kunde.de): " APP_URL
read -p "Datenbank-Host [127.0.0.1]: " DB_HOST; DB_HOST=${DB_HOST:-127.0.0.1}
read -p "Datenbank-Name: " DB_DATABASE
read -p "Datenbank-Benutzer: " DB_USERNAME
read -s -p "Datenbank-Passwort: " DB_PASSWORD; echo ""
read -p "Shop-E-Mail (Absender): " MAIL_FROM
read -p "SMTP-Host: " SMTP_HOST
read -p "SMTP-Port [587]: " SMTP_PORT; SMTP_PORT=${SMTP_PORT:-587}
read -p "SMTP-Benutzer: " SMTP_USER
read -s -p "SMTP-Passwort: " SMTP_PASS; echo ""
cat > .env << EOF
APP_NAME="${SHOP_NAME}"
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=${APP_URL}
LOG_CHANNEL=stack
LOG_LEVEL=error
DB_CONNECTION=mysql
DB_HOST=${DB_HOST}
DB_PORT=3306
DB_DATABASE=${DB_DATABASE}
DB_USERNAME=${DB_USERNAME}
DB_PASSWORD=${DB_PASSWORD}
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=sync
MAIL_MAILER=smtp
MAIL_HOST=${SMTP_HOST}
MAIL_PORT=${SMTP_PORT}
MAIL_USERNAME=${SMTP_USER}
MAIL_PASSWORD=${SMTP_PASS}
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=${MAIL_FROM}
MAIL_FROM_NAME="${SHOP_NAME}"
EOF
echo -e "${GREEN}✓ .env erstellt${NC}"
fi
echo ""
echo "--- Abhängigkeiten installieren ---"
$PHP -d open_basedir="" $COMPOSER install --no-dev --optimize-autoloader --no-interaction
echo -e "${GREEN}✓ Composer${NC}"
echo ""
echo "--- App-Key generieren ---"
$PHP -d open_basedir="" artisan key:generate --force
echo -e "${GREEN}✓ APP_KEY gesetzt${NC}"
echo ""
echo "--- Storage-Links & Berechtigungen ---"
$PHP -d open_basedir="" artisan storage:link 2>/dev/null || true
chmod -R 775 storage bootstrap/cache
echo -e "${GREEN}✓ Berechtigungen gesetzt${NC}"
echo ""
echo "--- Datenbank einrichten ---"
$PHP -d open_basedir="" artisan migrate --force
$PHP -d open_basedir="" artisan db:seed --force
echo -e "${GREEN}✓ Datenbank eingerichtet${NC}"
echo ""
echo "--- Cache aufbauen ---"
$PHP -d open_basedir="" artisan config:cache
$PHP -d open_basedir="" artisan route:cache
$PHP -d open_basedir="" artisan view:cache
echo -e "${GREEN}✓ Cache erstellt${NC}"
echo ""
echo "=================================="
echo -e "${GREEN} Installation abgeschlossen!${NC}"
echo "=================================="
echo ""
echo "Nächste Schritte:"
echo " 1. In Plesk: Dokumenten-Stammverzeichnis auf 'public' setzen"
echo " 2. Admin-Login: ${APP_URL}/admin"
echo " Standard-Zugangsdaten aus dem Seeder (bitte sofort ändern!)"
echo ""