All Projects → takezoe → gitmesh

takezoe / gitmesh

Licence: other
An experimental project to make a distributed git server cluster

Programming Languages

scala
5932 projects
javascript
184084 projects - #8 most used programming language
Vue
7211 projects
Dockerfile
14818 projects
shell
77523 projects
HTML
75241 projects
java
68154 projects - #9 most used programming language

Labels

gitmesh

What's this?

This is an experimental project to make a distributed git server cluster. The main goal of this project is to find a reasonable way to add scalability and redundancy to git repositories. Basic idea is locating git repositories on multiple nodes, and proxy requests from git clients to appropriate nodes. This approach is similar to GitHub's DGit (it has been renamed to Spokes).

The distributed gitserver cluster consists of following two kinds of servers:

  • Controller server

    This is a front server of the cluster. It manages repository servers and proxy requests from git clients to appropriate repository servers. We can make redundant it by setup multiple instances with a load balancer.

  • Repository server

    This is a storage server of the cluster. Git repositories are located on this kind of servers actually. We can add any number of repository server instances to the cluster.

Architecture

This project is still under development phase, but if you are interested, please try it. Any feedback is welcome!

Setup

You can run a minimal gitmesh cluster on docker and docker-compose.

Prerequisites

  • Java 8
  • sbt
  • Docker

Build docker images

First, run the following command at the root of this repository to build docker images.

$ ./build-docker.sh

This script builds following docker images:

  • gitmesh-console
  • gitmesh-controller-server
  • gitmesh-repository-server

Run a cluster using docker-compose

Next, run the following command to start a minimal gitmesh cluster (console x 1, controller x 1, mysql x 1, repository x 2).

$ ./run-docker-compose.sh

This command executes docker-compose internally. So you can run a cluster with another structure by modifying docker-compose.yml.

Web console is available at http://localhost:8080, and endpoints are available at http://localhost:8081. See this section to know how you can use a gitmesh cluster as a Git server.

Build and run from source code

You can also build and run gitmesh from source code for now. This guide shows how to run the cluster with minimum configuration (one controller server and one repository server on a single machine).

Prerequisites

  • Java 8
  • sbt
  • MySQL

You have to create an empty database before run the controller server. If you use docker, run a MySQL container as follows:

$ docker pull mysql
$ docker run --name mysql -e MYSQL_ROOT_PASSWORD=mysql MYSQL_DATABASE=gitmesh -d -p 3306:3306 mysql

Start the controller server

Modify gitmesh-controller-server/src/main/resources/application.conf for your environment, and run the controller server as follows:

$ cd gitmesh-controller-server
$ sbt ~jetty:start

The controller server is started on port 8081 in default. Tables are created automatically in the database configured in application.conf.

Start the repository server

Modify gitmesh-repository-server/src/main/resources/application.conf for your environment, and run the repository server as follows:

$ cd gitmesh-repository-server
$ sbt ~jetty:start

The repository server is started on port 8082 in default.

Check the cluster operation

Let's create a new repository and push a commit using git command to check the cluster operation.

You can create a new repository via Web API. In this case, a repository url is http://localhost:8081/git/test.git.

$ curl -XPOST http://localhost:8081/api/repos/test

Create a local repository and push a first commit to the remote repository on the cluster:

$ mkdir test
$ cd test
$ git init
$ touch README.md
$ git add .
$ git commit -m 'first commit'
$ git remote add origin http://localhost:8081/git/test.git
$ git push origin master

The remote repository is created under the directory configured in the repository server's application.conf.

Web console

gitmesh also offers a web console for administrators.

Web console

Run followng commands to start the web console.

$ cd gitmesh-console
$ npm install
$ npm run dev

The web console is available at http://localhost:8080/. You can check repositories and nodes status, and create or delete repositories on this console.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].