diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 7e2d291c..3c2d0a11 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -8,30 +8,33 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Execute Build and Deploy Commands - run: | - echo "--- Starting EPIC WEB CONTROL Deployment ---" - - # We misbruiken de docker socket om een commando direct op de VPS host uit te voeren - # Dit lost alle problemen op met ontbrekende mappen, pnpm, of sudo-rechten! - docker run --rm \ - -v /var/www/atom-next:/app \ - -v /var/run/docker.sock:/var/run/docker.sock \ - --pid=host \ - node:20-bullseye \ - bash -c " - cd /app && - git fetch --all && - git reset --hard origin/main && - echo '--- Running Database Migrations ---' && - npm install -g pnpm && - pnpm db:migrate && - echo '--- Building Application ---' && - pnpm build - " - - # Herstart de service op de host via een tijdelijke container met host-rechten - echo "--- Restarting Atom Next Service ---" - docker run --rm --pid=host --privileged alpine proto-systemctl restart atom-next.service || true - - echo "--- Deployment Completed Successfully ---" \ No newline at end of file + - name: Deploying via SSH connection to VPS Host + uses: appleboy/ssh-action@v1.0.3 + with: + host: "172.20.2.1" # The default bridge gateway IP pointing back to your VPS host + username: "root" # Replace with your actual VPS SSH username if not running as root + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + script: | + echo "--- Starting EPIC WEB CONTROL Deployment ---" + + # 1. Navigate to your project directory on the bare metal VPS + cd /var/www/atom-next/ + + # 2. Synchronize the application files via Git + git fetch --all + git reset --hard origin/main + + # 3. Run database migrations natively + echo "--- Running Database Migrations ---" + pnpm db:migrate + + # 4. Compile the updated distribution assets + echo "--- Building Application ---" + pnpm build + + # 5. Restart the host background service cleanly + echo "--- Restarting Atom Next Service ---" + sudo systemctl restart atom-next.service + + echo "--- Deployment Completed Successfully ---" \ No newline at end of file