I have used redhat's open shift few years ago. The way you update the server is by pushing to the git repo. Once you pushed your changes, you can test your app in the browser.
I want to implement that in one of my VM for testing. So that whenever I pushed to the repo, the testers can see my changes right away. I'm doing it in a cloud VM because the person who will test it is in another country. I'm using nginx, pm2, nodejs and express.
I understand that I can just ssh to the server, pull the changes, restart pm2. But if there's a more automated way, that will be better.
You probably want to look into the server side git hooks. You can execute a bash script on the server when a git push is received, and execute whatever needs to happen to update the server.
To give a quick rundown:
Hooks can be found under .git/hooks
. Here you will find the following files:
To give an example, on your server if you add the following to your post-update hook, the server will send you an email whenever a commit is received:
#!/bin/bash
git show --name-status | mail -s "Received Push" youremail@email.com
In this file, is where you will likely want to write your script to rebuild the website with the newly received data!