Files
harheimertc/production-setup.sh

69 lines
1.6 KiB
Bash
Executable File

# Harheimer TC - Production Server Setup
# PM2 Konfiguration für Nuxt 3 Backend
# PM2 installieren
npm install -g pm2
# Environment-Datei erstellen
cat > .env.production << EOF
NODE_ENV=production
PORT=3100
SMTP_HOST=your-smtp-host
SMTP_PORT=587
SMTP_USER=j.dichmann@gmx.de
SMTP_PASS=your-password
SMTP_FROM=j.dichmann@gmx.de
SMTP_TO=j.dichmann@gmx.de
EOF
# PM2 Ecosystem-Datei erstellen
cat > ecosystem.config.js << EOF
module.exports = {
apps: [{
name: 'harheimertc',
script: 'npm',
args: 'run start',
cwd: '/var/www/harheimertc',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G',
env: {
NODE_ENV: 'production',
PORT: 3100
},
error_file: '/var/log/pm2/harheimertc-error.log',
out_file: '/var/log/pm2/harheimertc-out.log',
log_file: '/var/log/pm2/harheimertc-combined.log',
time: true
}]
}
EOF
# PM2 starten
pm2 start ecosystem.config.js
pm2 save
pm2 startup
# Apache-Konfiguration für Backend-Proxy
cat > /etc/apache2/sites-available/harheimertc-api.tsschulz.de.conf << EOF
<VirtualHost *:443>
ServerName harheimertc-api.tsschulz.de
ServerAdmin admin@tsschulz.de
# SSL-Konfiguration
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/harheimertc-api.tsschulz.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/harheimertc-api.tsschulz.de/privkey.pem
# Proxy zu Nuxt Backend
ProxyPreserveHost On
ProxyPass / http://localhost:3100/
ProxyPassReverse / http://localhost:3100/
# Logs
ErrorLog \${APACHE_LOG_DIR}/harheimertc-api-error.log
CustomLog \${APACHE_LOG_DIR}/harheimertc-api-access.log combined
</VirtualHost>
EOF