Pull git reposetory on remote server
pip install flask
Create remotepull.py
:
from flask import Flask
import subprocess
app = Flask(__name__)
@app.route('/pullstaging')
def main():
try:
output = subprocess.check_output(["git", "pull"])
return output
except subprocess.CalledProcessError as exc:
return "Status : FAIL errcode: {}, output: {}".format(exc.returncode, exc.output)
app.run(host="0.0.0.0", port=int("8080"))
GO to server with ssh
, change dir to your repo
nohup python remotepull.py &
You can disconnect from ssh. Puller will remain active until OS restart. You can create some init/systemd script for autostart.
In browser go to http://your_server_ip/domain:8080/pullstaging
If you want version with authorization, see this tip