Created
June 25, 2024 12:57
-
-
Save hargup/5260ce8744d9c528f057ec12b4320379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configuration | |
SERVER_USER="devops" | |
SERVER_IP="servicename.felvin.com" | |
SERVER_PATH="/home/devops/code/servvice-name" | |
# Deploy | |
echo "Deploying to $SERVER_USER@$SERVER_IP:$SERVER_PATH" | |
# Push latest changes to origin | |
git push origin main | |
# Push latest changes to the server | |
ssh $SERVER_USER@$SERVER_IP << EOF | |
cd $SERVER_PATH | |
git pull origin main | |
npm install | |
pm2 restart service-name | |
EOF | |
echo "Deployment complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment