I'm creating a setup where a push to my central git repo, located on my server, automatically pushes the changes to my site folder, which is running through IIS 8 on Windows Server 2012.
This is easy enough. The following is working: I have Bonobo Git Server, a site running on IIS onto its own. I have a post-receive hook on the central repo that is managed by Bonobo. This hook then runs a batch file which pulls the changes into the repo of the site's folder. This is made possible because, naturally, the post-receive hook runs as the identity assigned to Bonobo's App Pool, namely "IIS AppPool\GitServerAppPool" and I gave that identity modify permissions on the site's folder.
So the code gets pushed and pulled fine. The problem is that the project is coded in Python and integrated into IIS using ISAPI_WSGI, and therefore there aren't any mechanisms, that I'm aware of, to reload the code without recycling the App Pool.
Giving the post-receive script permission to recycle the App Pool is proving difficult.
So, the problem is this. -The post-receive script is running as "IIS AppPool\GitServerAppPool", so it cannot restart the other app pools as doing so requires an Admin account. -Any use of RunAs, for either running appcmd or a scheduled task, doesn't work because it would require entering a password to pass UAC. -Using /savecreds on runas doesn't work because I cannot log in as an AppPoolIdentity in order to enter the password in the first place.
And so I am stuck. If any of the following are possible in any way shape or form, they should work, but I can't find a way to do them.
- some way of lowering the required permissions to recycle app pools.
- some way of including the password in the runas command (the script won't be accessible to the outside world so I can live with this)
- some way of manually running a command as GitServerAppPool so that I can run the batch file with /savecreds once, and not have to enter the password again
Anybody know how to do a, b or c, or have another solution?
One solution that does work is to run the git server on an app pool running as an admin account. It seems counter to the point of UAC to start giving things full Admin access rights to get around one rule on IIS security though. Of course, if I must, I will.
Thank you very much for any help or suggestions.
BTW, the reason for doing this is to give my other devs, scattered around the globe, the ability to push their changes direct to their staging servers without my interference and without actual access to the server. So manually restarting the app pool defeats the purpose.