Josh Wilson
Josh Wilson

Reputation: 3745

Auto deploy rails Gitlab projects to subdomains with Nginx and Phusion Passenger

I've just installed Nginx, Phusion Passenger, and and Gitlab on a virtual machine. Almost all my projects will be rails applications. Instead of having to configure them individually, it would be great if I could automatically host them on a subdomain when a new project is created.

So when a user creates a project a nginx config file gets generated to respond to [repo].[user].[mydomain].com

My current plan is to have a script that somehow creates a copy of the master branch in a new location (say /var/www/) and then generate a matching nginx script.

How do I create a hook that can accomplish this? and how do I only create the repo once and just do a pull if it already exits?

Thanks for the help.

Upvotes: 3

Views: 488

Answers (1)

VonC
VonC

Reputation: 1324188

GitLab uses on Gitolite.
And Gitolite allows for update hook as VREF: you can declare one applied for all repos which would generate the file you want and make the appropriate actions, only if said repo is empty (just been created).

Upvotes: 1

Related Questions