infra: test SSH command
Some checks failed
Deploy eolas-api / deploy (push) Failing after 26s

This commit is contained in:
Thomas Bishop 2025-10-16 14:17:27 +01:00
parent cde7d5feb4
commit eea16096c3

View file

@ -65,14 +65,20 @@ jobs:
run: |
echo "⚡ INFO Installing rsync"
apt-get update && apt-get install -y rsync
echo "⚡ INFO Retrieving SSH key for deploy user"
echo "${{ secrets.VPS_DEPLOY_USER_SSH_KEY }}" > /tmp/ssh_key
chmod 600 /tmp/ssh_key
echo "⚡ INFO Stopping server on VPS"
ssh -i /tmp/ssh_key ${{vars.VPS_DEPLOY_USER}} sudo /usr/bin/systemctl stop eolas-api.service
echo "⚡ INFO Copy files (rsync)"
rsync -avz --delete --inplace --exclude='.env' -e "ssh -i /tmp/ssh_key -o StrictHostKeyChecking=no" ./ ${{ vars.VPS_DEPLOY_USER }}:/var/www/eolas-api/
# rsync -avz --delete --inplace --exclude='.env' -e "ssh -i /tmp/ssh_key -o StrictHostKeyChecking=no" ./ ${{ vars.VPS_DEPLOY_USER }}:/var/www/eolas-api/
echo "⚡ INFO Run npm install on VPS"
# npm install --omit=dev
# SSH: npm install --omit=dev
echo "⚡ INFO Restarting systemd service"
# sudo systemctl daemon-reload
# sudo systemctl restart eolas-api
# SSH: sudo /usr/bin/systemctl daemon-reload
# SSH: sudo /usr/bin/systemctl restart eolas-api.service
rm /tmp/ssh_key
NEXT! add required Vars to systemd file