Update .gitea/workflows/deploy.yaml
Local Build and Deploy / deploy (push) Failing after 48s

This commit is contained in:
remco committed 2026-07-18 16:05:15 +02:00
1 parent d488162bec
commit 2b766bfd13
1 file changed
+20 -21
+20 -21
View File
@@ -24,29 +24,31 @@ jobs:
} }
trap 'error_handler $LINENO' ERR trap 'error_handler $LINENO' ERR
# Zorg dat de permanente opslagmap buiten het project bestaat # Maak permanente mappen aan buiten het project voor je uploads en afbeeldingen
sudo mkdir -p /var/www/atom-media sudo mkdir -p /var/www/atom-media/uploads
sudo mkdir -p /var/www/atom-media/imaging
sudo chown -R www-data:www-data /var/www/atom-media sudo chown -R www-data:www-data /var/www/atom-media
sudo chmod -R 775 /var/www/atom-media sudo chmod -R 775 /var/www/atom-media
# Red de huidige live uploads (nieuws, logo's) EERST voordat Git of de build iets wist
cd /var/www/atom-nexst/
if [ -d .next/standalone/public ]; then
echo "Backing up current live images and uploads..."
rsync -av --ignore-existing .next/standalone/public/ /var/www/atom-media/ || true
fi
# 2. Cleanup & Git Sync # 2. Cleanup & Git Sync
docker image prune -f docker image prune -f
cd /var/www/atom-nexst/
git config --global --add safe.directory /var/www/atom-nexst git config --global --add safe.directory /var/www/atom-nexst
git remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/ git remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/
git fetch origin --prune git fetch origin --prune
git reset --hard origin/main git reset --hard origin/main
# Sluit de public map uit zodat Git clean de lokale werkmap niet leegtrekt # Sluit de specifieke mediamappen uit van git clean zodat de lokale links blijven bestaan
git clean -fd -e .env -e .env.local -e .env.production -e .env*.local -e .next -e public git clean -fd -e .env -e .env.local -e .env.production -e .env*.local -e .next -e public/uploads -e public/imaging
# Zorg dat de basismap public bestaat
mkdir -p public
# Herstel symlinks in de hoofdmap indien nodig
[ -L public/uploads ] || { rm -rf public/uploads && ln -s /var/www/atom-media/uploads public/uploads; }
[ -L public/imaging ] || { rm -rf public/imaging && ln -s /var/www/atom-media/imaging public/imaging; }
# Verwijder oude builds, behoud de cache voor snelheid # Verwijder oude builds, behoud de cache voor snelheid
find .next -mindepth 1 -maxdepth 1 ! -name 'cache' -exec rm -rf {} + 2>/dev/null || true find .next -mindepth 1 -maxdepth 1 ! -name 'cache' -exec rm -rf {} + 2>/dev/null || true
@@ -72,21 +74,19 @@ jobs:
# 6. Sync Standalone Bundle # 6. Sync Standalone Bundle
echo "Preparing standalone bundle paths..." echo "Preparing standalone bundle paths..."
# Kopieer de schone, nieuw gebouwde public-map naar standalone
cp -r public .next/standalone/ cp -r public .next/standalone/
cp -r .next/static .next/standalone/.next/ cp -r .next/static .next/standalone/.next/
cp -r node_modules/@prisma .next/standalone/node_modules/ 2>/dev/null || true cp -r node_modules/@prisma .next/standalone/node_modules/ 2>/dev/null || true
cp .env .next/standalone/.env cp .env .next/standalone/.env
# Kopieer nu alle bewaarde nieuws-images, logo's en uploads terug over de standalone public-map heen # Koppel de symlinks keihard binnen de vers gebouwde standalone public-map
if [ -d /var/www/atom-media ]; then rm -rf .next/standalone/public/uploads
echo "Restoring all news images and uploads to production..." ln -s /var/www/atom-media/uploads .next/standalone/public/uploads
rsync -av /var/www/atom-media/ .next/standalone/public/
fi
# 7. Permissions (GEBRACHT VÓÓR HET HERSTARTEN) rm -rf .next/standalone/public/imaging
# We forceren de rechten NU op alle gekopieerde bestanden, inclusief de teruggezette rsync-bestanden ln -s /var/www/atom-media/imaging .next/standalone/public/imaging
# 7. Permissions
sudo chown -R www-data:www-data /var/www/atom-nexst/ sudo chown -R www-data:www-data /var/www/atom-nexst/
sudo chmod -R g+rw /var/www/atom-nexst/ sudo chmod -R g+rw /var/www/atom-nexst/
@@ -95,7 +95,6 @@ jobs:
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl restart atom-nexst.service sudo systemctl restart atom-nexst.service
# Geef Node.js 3 seconden de tijd om op te starten en de databaseverbinding te openen
sleep 3 sleep 3
if ! systemctl is-active --quiet atom-nexst.service; then if ! systemctl is-active --quiet atom-nexst.service; then
echo "ERROR: atom-nexst.service failed to start! Check logs using: journalctl -u atom-nexst.service" >&2 echo "ERROR: atom-nexst.service failed to start! Check logs using: journalctl -u atom-nexst.service" >&2