2

I work in a small team doing web sites as well as web apps. We have a development server locally that is set up identically to our standard production servers, and I'd like to integrate Git into our workflow. I'm currently using Gitlab to host and access the repositories.

How I envision it is:

  • pull from central repositories
  • develop locally
  • push to dev server
  • test
  • merge
  • qc
  • package and ship to production server

My question involves the pushing to dev server stage. I'd like to be able to push a branch to dev server, then immediately browse view that branch in a browser — not the source code, but the site itself.

Is there self-hosted software that could be used to accomplish this?

Like I say, I'm currently using Gitlab. I've tried Gitorious (too much to set up), Girocco, git-php and could not get them working on our development server, at least not without changing them, which defeats the point of having identical dev and production servers.

This question is predicated on my workflow being sound. If my question is rendered moot by poor workflow, I'd be be happy to have the mistakes in my workflow pointed out.

Update: We mostly develop in PHP (various frameworks and CMSes) and our servers run Apache behind Nginx on Ubuntu 10.04. The different developers are in separate offices in the same building, but on different networks. While we cannot reach each other's machines directly, we can all access the dev server on any port.

Update X2: VonC's answer cleaned up most of the question I have but understanding this a bit better, I'd like to ask a bit more specific question:

As I'm running gitolite (Gitlab is built on this), and as gitolite stores bare repositories, when pushing a branch to the development server, I can't browse the site on the dev server the way I could if there were a working folder. While I could SSH into the dev server's /var/www, git init and git clone git@127.0.0.1... from the gitolite bare repository, I would prefer that this get done automatically.

Would the most direct way of accomplishing this be a post-update hook with the above commands? It seems a bit more complex than I like, but I imagine this a fairly common use case so perhaps I'm just missing something.

  • Need more details on your implementation. IIS? Apache? Are you using any web frameworks? Rails? Django? Are all of your servers local, no firewalls to contend with? – Andy Mar 31 '12 at 18:22
  • I'm in a similar boat; I'm interested to see if there's a solution that can manage a couple of "variables" during deployment, as well. For instance, on our Dev server, we'll use one database connection string (for our Dev database server), and for production, we'll use the production DB server. I'm looking for a solution which will do what you propose, and additionally automatically switch a couple of strings out based on the deployment context. – Jeff Allen Mar 31 '12 at 21:14
  • @JeffAllen - use made-for-this-job **any Deploy Tool**? – Lazy Badger Apr 01 '12 at 06:29
  • I believe the `post-receive` hook I mention in my answer (and detail in http://stackoverflow.com/questions/9448682/git-submodule-on-remote-bare/9448794#9448794) covers the `post-update` need you mention (and is easier to setup with gitolite, since gitolite already uses the `post-update` hook, which means yours would have to be chained: http://sitaramc.github.com/gitolite/hooks.html) – VonC Apr 02 '12 at 05:40

1 Answers1

0

You could combine:

  • a post-receive hook to go to your live site (non-bare repo) and update the content with the latest commits pushed to your bare repo.
    See "Git submodule on remote bare" (note: submodules aren't necessary in your case, but the pulling mechanism described in this answer still applies)

  • an authorization layer like gitolite, if you want to manage who can push to dev server. And also control the chmod on the checked out repo.
    See "ee"

  • a filter driver in order to manage certain file content depending on the deployment environment:

filter driver

A 'smudge' script can generate the right content during the git checkout.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250