-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation to invoke commands correctly, and use nukagit-cli
- Loading branch information
Showing
4 changed files
with
44 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,61 @@ | ||
# Nukagit - making git distributed | ||
|
||
## What is this? | ||
|
||
Nukagit is my attempt at making a JGIT DFS based git server backed by a combination | ||
of minio and mysql. It is a work in progress and is not ready for production use. | ||
|
||
The idea is to run a cross-regional minio cluster and a group replicated instance | ||
of mysql. This should result in very high availability and durability. And should also | ||
provide good read performance in remote regions (group replication means latest data is | ||
provide good read performance in remote regions (group replication means latest data is | ||
always available for reading). The write overhead of having to write to multiple | ||
remote regions is not such a huge problem, as most people can survive an extra second | ||
of latency when pushing to a remote git repository. | ||
|
||
## Building | ||
|
||
```shell | ||
./gradlew build | ||
``` | ||
|
||
## Running | ||
|
||
```shell | ||
docker-compose up | ||
# you will have to run it a couple times because mysql fails to chown | ||
# it's directory on a Mac | ||
# you might have to run it a couple times because mysql fails to chown | ||
# it's directory on a Mac with colima | ||
|
||
./gradlew run --args="migrate" | ||
./gradlew serve --args="serve" | ||
./gradlew :run --args="migrate" | ||
./gradlew :serve --args="serve" | ||
``` | ||
|
||
## Testing | ||
|
||
There are two kinds of repositories supported at the moment: | ||
|
||
- In-memory ones that are created on clone | ||
- Minio/Mysql backed ones that you have top use grpc to create before cloning | ||
|
||
There is no authorization yet, so we accept any username/ssh key | ||
whatsoever, but it might be that at least some ssh public key has to be | ||
present in the keychain. | ||
First you will have to make a user: | ||
|
||
```shell | ||
./gradlew :cli:run --args="add_user username -F ../src/test/resources/fixtures/id_ecdsa.pub" | ||
``` | ||
|
||
Feel free to use your own public key instead of the one in the fixtures directory. | ||
|
||
To test an in-memory repository: | ||
|
||
```shell | ||
git clone "ssh://git@localhost:2222/memory/test-repository" | ||
# Repository will be created automatically | ||
# You will get a warning about connecting to a new ssh host, this is expected | ||
# a new ssh host key will be generated in keys/ssh_host_key.pem | ||
``` | ||
|
||
For a minio one run the request in `test-requests.http` to get the repository | ||
created and then run: | ||
For a minio one create the repository using the cli and then clone it: | ||
|
||
```shell | ||
./gradlew :cli:run --args="create_repository testing" | ||
git clone "ssh://git@localhost:2222/testing" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
cli/src/main/java/lt/pow/nukagit/cli/CreateRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package lt.pow.nukagit.cli; | ||
|
||
import lt.pow.nukagit.proto.Repositories; | ||
import picocli.CommandLine; | ||
|
||
@CommandLine.Command(name = "create_repository", description = "Create repository") | ||
public class CreateRepository implements Runnable { | ||
@CommandLine.ParentCommand | ||
private Main parent; | ||
|
||
@CommandLine.Parameters(index = "0", description = "Repository name.") | ||
private String repositoryName; | ||
|
||
@Override | ||
public void run() { | ||
System.out.println("Creating repository " + repositoryName); | ||
parent.repositoriesGrpcClient().createRepository(Repositories.CreateRepositoryRequest.newBuilder() | ||
.setRepositoryName(repositoryName) | ||
.build()); | ||
System.out.println("Repository created"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters