Thursday, 14 March 2013

Setting up a apache (httpd) based git server (using an O2 Platform script)

Following from the instructions on this blog post Hosting a Git server under Apache on Windows and after installing git and apache locally

I wrote this O2 script:

oundation\Apache2.2\bin\httpd.exe");
var configFile = @"E:\_Code_Tests\test_Local_GitHosting\httpd.conf";
codeEditor.open(configFile);
codeEditor.insert_Below().add_Script()
          .add_InvocationParameter("httpd",httpd)
          .add_InvocationParameter("configFile",configFile)
          .add_InvocationParameter("browser",browser)
          .add_InvocationParameter("cmdOutput",cmdOutput)
          .set_Code(
@"// ** variables passed as parameters to this script:
//httpd - path to httpd file
//configFile - path to config file (opened above)
//browser - web browser windom (bottom right)
//cmdOutput - panel to put the command execution result
return ""{0} : {1}"".format(httpd, configFile);");


return httpd.fileExists();


which created this ‘dev’ gui:

image

where I made  the required changes (see article) to a local http.conf file (the one opened in the top left window):

… local port:

image

… allow anonymous access:

image

…git config

image

On the bottom-left script editor, I wrote

"httpd".process_WithName().stop().WaitForExit();
// ** variables passed as parameters to this script:
//httpd - path to httpd file

//configFile - path to config file (opened above)
//browser - web browser windom (bottom right)
//cmdOutput - panel to put the command execution result 
//cmdOutput.add_ConsoleOut();
///httpd.startProcess("-?",Console.WriteLine);

var parameters = "-f \"{0}\"".format(configFile);

var process = httpd.startProcess(parameters, (log)=>log.info());
cmdOutput.clear().add_Script_Me(process);
browser.open("http://localhost:8083");//.add_NavigationBar();

//O2File:API_ConsoleOut.cs


which started the httpd process (and gave me a reference to the process on the top right and a web browser view on the bottom right)

image

With this set-up, I created two git repositories (one bare and one normal)

image

which can now be cloned using:

image

and

image
Post a Comment