Automatically pull from git and restart the pserve production.ini

45 views
Skip to first unread message

Behrouz Kashani

unread,
Jun 18, 2016, 2:53:20 PM6/18/16
to pylons-discuss
Hi, 
I have an app created by Pyramid and I use Github to share with my team and work on. I have a branch call "deploy" and I'm looking for a way to check this repo and whenever it gets pushed, automatically update and re-run the server.

I found github hook and things like this the only question is how I can use the production.ini in them or I'm wondering Pyramid has something itself.

Thanks in advance.

Vincent Catalano

unread,
Jun 18, 2016, 3:12:40 PM6/18/16
to pylons-...@googlegroups.com
I would recommend a simple shell script for something like this. If you Google around for configuring git post-receive hook scripts, you can find some basic examples for how to configure a script to run when you push to a given branch. The shell would then simply pull the latest changes from git and restart your Pyramid app. Here is an example script:

#!/bin/sh
GIT_WORK_TREE=$HOME/webapps/pyramid_app/myapp git checkout -f
cd $HOME/webapps/myapp && kill $(cat pyramid.pid)
sleep 3
cd $HOME/webapps/myapp && ./bin/pserve --daemon production.ini


--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/cab24fc6-75cb-41d5-869e-2a0d1bc6b602%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Vincent Catalano
Software Engineer and Web Developer,
(520).603.8944

Jonathan Vanasco

unread,
Jun 19, 2016, 3:42:55 PM6/19/16
to pylons-discuss
You can also do this with supervisord

basically you configure supervisord to manage the pyramid process however you see fit (uwsgi, pserve, etc)
then you write another script that listens for webhooks or polls for changes, and signals a restart fo supervisord to restart the pyramid process

there are a lot of howtos for this online.
Reply all
Reply to author
Forward
0 new messages