bitbucket.org or internal git server and puppet-sync git hook

105 views
Skip to first unread message

tyon

unread,
Mar 5, 2015, 7:23:58 PM3/5/15
to puppet...@googlegroups.com
Hi everybody.

I recently started using Puppet directory environments. I really like the idea of Dynamic Puppet environments with Git branches and Git hooks to sync Puppet master after any changes were pushed to the Git server.

Can I use external service like Bitbucket as a Git master or do I need to have my own Git server? If I can use Bitbucket how I can add my puppet-sync post receive hook there? Can anybody point me to an article on how to do this?

Thanks!

Jonathan Gazeley

unread,
Mar 6, 2015, 6:20:54 AM3/6/15
to puppet...@googlegroups.com
We started using dynamic environments in November. Some of our manifests are sensitive and my employer's policy forbids us from storing this type of information in any kind of third-party service, so I built my own Gitlab server. I wrote a brief note on how to do this on my employer's blog:

http://unix.bris.ac.uk/2014/11/17/building-a-gitlab-server-with-puppet/

I thought I'd also written a blog post about puppet-sync but apparently I didn't, so I'll say a few words about that here. We are using the pdxcat/puppet-sync which is installed to the gitlab server in /usr/local/bin. Gitlab provides a way of using web hooks through the GUI but not "proper" git hooks, so you have to fiddle in the filesystem. I configured public keys and installed the post-receive hook in:

/var/opt/gitlab/git-data/repositories/<user>/<repo>.git/hooks/post-receive

... which references puppet-sync. Now, every time something is pushed to a branch in Gitlab, the gitlab server ssh's to the puppet master and pulls that branch into /etc/puppet/environments. Now all the developers can make their own branches/environments without affecting production. The solution works well for us.

You would only be able to do this with Bitbucket if they allow you to configure git hooks. We are currently looking at how to switch to web hooks instead of git hooks. This would allow us to use Gitlab more easily, and to use Github or Bitbucket. I think we would need to write a simple web-based API that runs on the puppet master to receive the web hooks and act upon them.

Cheers,
Jonathan
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/2a02f21a-3df4-4d6c-b664-2f6c1b134f2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tyon

unread,
Jun 10, 2015, 1:27:49 PM6/10/15
to puppet...@googlegroups.com
Hi Jonathan,

For some reasons I didn't get your an email with your answer even if the option is chosen. 

It turned that I have to use bitbucket. I'm still planning to use puppet-sync, but I will have to create php post-receive hook on my server.
Thanks for sharing your experience with me.
Reply all
Reply to author
Forward
0 new messages