Getting build server to use `git pull' instead of `git-recieve-pack'

42 views
Skip to first unread message

Tom Buckley-Houston

unread,
Jan 4, 2013, 7:45:41 PM1/4/13
to open...@googlegroups.com
Hi everyone,

Would someone be able to give me a pointer. Part of the concept of Slotbox (the crowded funded PaaS thing I'm prototyping) is that you won't be able to push your repo to it, you will *only* be able to specify a public Github URL. This is to ensure that people that fund a particular app can scrutinise the code that they are giving money to. So basically I'm stripping out gitmouth from Openruko and instead planning to try and get the build dyno to `git pull' the repo rather than `git-recieve-pack' over SSH.


I've created a new API method that successfully receives the app name and the github repo URL. It then executes handleGitCommand, but it's taking over a minute to get a jobID back, so the call to getJob can't find anything. Besides that, I'm really in the dark as to what I do with;

result = {
  host: job.distributed_to,
  dyno_id: job.dyno_id,
  rez_id: job.rez_id
};

How do I then use those details to build the slug?

Any advice would be greatly appreciated.

Thanks,
tom :)

Romain

unread,
Jan 5, 2013, 3:53:19 AM1/5/13
to Tom Buckley-Houston, openruko
Hi Tom, 

When you push to OpenRuko the folowing steps are involved: 
  * gitmouth is the ssh server that receive the git push, it will add a provision job in postgresql 
  * dynohosts poll the provision job table.
  * when a new provision job is ready, the dynohost launch an lxc container via scripts/build-provision
  * at the end of build-provision, rukorun is launched to become a non root user in the lxc container
  * the git-receive-pack command is executed in the container
  * git hooks (pre-receive and post-receive) are triggered to compile the project (pre) and to send to s3 the compressed repo (post)

What you need to change is to remove gitmouth.
Add a provision job, but the command/command_args should become "git" "pull http://toto.com"  instead of "git-receive-pack" "/app".

The actuals hooks are only triggered on git push. You will have to change them.

To see the interactions between gitmouth and apiserver, you can look at this mock in the test: https://github.com/openruko/apiserver/blob/master/test/mock/gitmouth.js

Good luck

Romain

2013/1/5 Tom Buckley-Houston <t...@tombh.co.uk>

--
 
 

Tom Buckley-Houston

unread,
Jan 5, 2013, 3:18:21 PM1/5/13
to open...@googlegroups.com
Thanks so much Romain :)

I did it! The key thing I was missing was what Rendevous actually was - it provides sockets for communicating with dynos. The insight came from looking at how the 'ps' methods work on the API and how the Heroku client interacts with that API request. The response that is actually received from the API is a set of Rendevous credentials for opening a socket to the dyno.

Regarding the post-receive hook, I couldn't actually find any suitable hook, so what I've done is just created a 'fetch-repo' script instead and have the build dyno execute that, which then in turn does the 'git pull' (well it's actually a 'git fetch' followed by a 'git merge'). My amended codonhook script is here if anyone is interested https://github.com/slotbox/codonhooks/blob/master/fetch-repo

So the only thing left for me to do is to somehow measure and record the accumulated uptime of all the dynos for a given app. Could the 'distributed_at' field on the 'provision_job' table be used for this do you think?

tom :)
Reply all
Reply to author
Forward
0 new messages