Änderung: Aktualisierung des Deployment-Skripts und des Systemd-Services
Änderungen: - Anpassung der Berechtigungen für die .env-Datei von `640` auf `600`, um die Sicherheit zu erhöhen. - Hinzufügung von Befehlen zur Aktualisierung und zum Neuladen des Systemd-Services im deploy-backend.sh. - Änderung des Benutzers und der Gruppe für den Systemd-Service von `www-data` auf `yourpart`, um die Berechtigungen zu optimieren. Diese Anpassungen verbessern die Sicherheit und die Verwaltung des Backend-Deployments.
This commit is contained in:
@@ -39,9 +39,14 @@ if [ -f .env ]; then
|
|||||||
echo "Copying .env file..."
|
echo "Copying .env file..."
|
||||||
sudo cp .env /opt/yourpart/backend/
|
sudo cp .env /opt/yourpart/backend/
|
||||||
sudo chown yourpart:yourpart /opt/yourpart/backend/.env
|
sudo chown yourpart:yourpart /opt/yourpart/backend/.env
|
||||||
sudo chmod 640 /opt/yourpart/backend/.env
|
sudo chmod 600 /opt/yourpart/backend/.env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Systemd-Service aktualisieren und neu laden
|
||||||
|
echo "Updating systemd service..."
|
||||||
|
sudo cp yourpart.service /etc/systemd/system/
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
# Datenbank-Synchronisation durchführen
|
# Datenbank-Synchronisation durchführen
|
||||||
echo "Running database synchronization..."
|
echo "Running database synchronization..."
|
||||||
cd /opt/yourpart/backend
|
cd /opt/yourpart/backend
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ Wants=mysql.service redis-server.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=www-data
|
User=yourpart
|
||||||
Group=www-data
|
Group=yourpart
|
||||||
WorkingDirectory=/opt/yourpart/backend
|
WorkingDirectory=/opt/yourpart/backend
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
Environment=PORT=2020
|
Environment=PORT=2020
|
||||||
|
|||||||
Reference in New Issue
Block a user