diff --git a/jekyll_webhook.py b/jekyll_webhook.py index 228ab9b..fb685a9 100755 --- a/jekyll_webhook.py +++ b/jekyll_webhook.py @@ -10,6 +10,10 @@ from flask import Flask, request from pid import PidFile import sarge from systemd.journal import JournalHandler +from twisted.internet import reactor +from twisted.web.server import Site +from twisted.web.wsgi import WSGIResource + DESTINATION = "/var/www/dennogumi-test/" REPO = "dennogumi.org" @@ -33,7 +37,7 @@ def push_hook_to_server(): app.logger.info("Cloning repository...") git.Repo.clone_from(repo_url, temp) - cmd = "/home/einar/bin/jekyll_clone_repo.sh {0} {1}" + cmd = "/usr/bin/jekyll_clone_repo.sh {0} {1}" cmd = sarge.shell_format(cmd, temp, DESTINATION) app.logger.info("Deploying Jekyll...") pid = sarge.run(cmd, async=True) @@ -41,7 +45,9 @@ def push_hook_to_server(): return "OK" if __name__ == "__main__": - with PidFile("/run/webhook/jekyll_webhook.pid", chmod=0o600): - handler = JournalHandler() - app.logger.addHandler(handler) - app.run() + + resource = WSGIResource(reactor, reactor.getThreadPool(), app) + site = Site(resource) + + reactor.listenTCP(5000, site, interface="127.0.0.1") + reactor.run()