Skip to content

Commit

Permalink
doc: translate 100% en docs
Browse files Browse the repository at this point in the history
  • Loading branch information
icyleaf committed Apr 26, 2018
1 parent 0112737 commit b3ac190
Show file tree
Hide file tree
Showing 10 changed files with 413 additions and 213 deletions.
203 changes: 11 additions & 192 deletions docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,207 +10,26 @@ Mirror git repositories to self-host gitlab services. It's best choice for any r

> The project name and logo is source from [Scarab in ancient Egypt](https://en.wikipedia.org/wiki/Dung_beetle#Scarab_in_ancient_Egypt)
## Quick Start

Packed all dependenices into Docker, first, clone this repository:

```
$ git clone https://github.com/icyleaf/hpr.git
$ cd hpr
```

Copy [config/hpr.json.example](config/hpr.json.example) to `config/config.json` and edit it.

```json
{
"schedule_in": "1.day",
"basic_auth": {
"enable": false,
"user": "hpr",
"password": "p@ssw0rd"
},
"gitlab": {
"ssh_port": 22,
"endpoint": "http://gitlab.example.com/api/v3",
"private_token": "abc",

"group_name": "mirrors",

"project_public": false,
"project_issue": false,
"project_wiki": false,
"project_merge_request": false,
"project_snippet": false
}
}
```

Here has 4 places to change your own.

- `endpoint`: you only change the scheme and host, **DOT NOT** edit tail part.
- `private_token`: visit your account page in account setting
- `group_name`: all mirrored project will be in this group, **MAKE SUER YOU ACCOUNT HAS CREATE GROUP ROLE** (ignore if has admin role)
- `ssh_port`: change it if you use custom ssh port

Then set some optional `ENV` variables if you need in `docker-compose.yml`:

```yaml
version: '2'

services:
hpr:
image: icyleafcn/hpr
ports:
- 8848:8848
volumes:
- ./config:/app/config
- ./repositories:/app/repositories
environment:
REDIS_URL: tcp://redis:6379
REDIS_PROVIDER: REDIS_URL

HPR_SSH_HOST: git.example.com
HPR_SSH_PORT: 22
depends_on:
- redis
redis:
image: redis:alpine
```
the `HPR_SSH_HOST` and `HPR_SSH_PORT` variables will update your gitlab ssh config, ignore if your gitlab server use 22 port in ssh protocol.

Then run it:

```bash
$ docker-compose up
...
hpr_1 | Generating public/private rsa key pair ...
hpr_1 |
hpr_1 | GENERATED SSH PUBLIC KEY:
hpr_1 | ##################################################################
hpr_1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDq8O3HbLn9x8Uy8RUotlpOnxdakrmCyDpZrGBeLARmEbd6BOIBQ+UWm8NUKthQ7UOavmlsq4j8lY4kyFW2eFX2qWcbvI+s2gI+05MXax+mAukSszaNSnpAoTyJCRipilSkqiOV99V8JIJhrHPtTO0o/Ui
9WiyyWsUM4M9lEKHpZ486lDGk3IM2XQW+pxAoMKb0TYzqCsrduHUtjzy0M0BqgMPe9EtVQqCbnTMzDLXmRONoTYyTV51NQ12mMwEQcDaLQ28e5gqouQJKS81JaoRpQWa7pHsOCki6Fk9TB+EQFrGz5nOrmYYM+O1MKnFkzmVHv7Fh50Sz7d2nYzzOKAkR hpr@docker
hpr_1 | ##################################################################
hpr_1 |
hpr_1 | Configuring ssh config ...
hpr_1 | Starting hpr server ...
hpr_1 | _
hpr_1 | | |__ _ __ _ __
hpr_1 | | '_ \| '_ \| '__|
hpr_1 | | | | | |_) | |
hpr_1 | |_| |_| .__/|_|
hpr_1 | |_|
```

Be attention to copy generated ssh public key in terminal output.
Add ssh public key to your gitlab.

That's all! Check usage part please.

## Usage

hpr will serve two ways to manage mirror git repositories:

- [Web API](#web-api) (recommand)
- [Cli tool](#cli-tool)

### Web API

hpr support a web api service (port `8848`) by default, run it:

```bash
$ hpr --server
_
| |__ _ __ _ __
| '_ \| '_ \| '__|
| | | | |_) | |
|_| |_| .__/|_|
|_|
I, [2018-03-21 16:44:50 +08:00 #55483] INFO -- hpr: API Server now listening at localhost:8848, press Ctrl-C to stop
```

#### List repositories

```
GET /repositores
```
##### Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| page | Integer | false | |
| per_page | Integer | false | |
#### Create a new repository
```
POST /repositores
```
##### Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| url | String | true | |
| name | String | false | |
## Features

- Support API layer
- Support Cli tools
- Schedule update to date all repositores
- Mirror any git repository
- Support any version of gitlab

#### Update a repository
```
PUT /repositores/:name
```
##### Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | false | |
#### Delete a repository
```
DELETE /repositores/:name
```
##### Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | false | |
### Cli tool
#### List repositories
```bash
$ hpr -l
```

#### Create a new repository

```bash
$ hpr -c --name hpr-mirror https://github.com/icyleaf/hpr.git
```
## Quick Start

#### Update a repository
Check [Quick Start](quickstart.md).

```bash
$ hpr -u --name hpr-mirror
```
# Development

#### Delete a repository
Install [Crystal](https://crystal-lang.org/docs/installation/index.html) and redis first and run:

```bash
$ hpr -d --name hpr-mirror
$ shards install
```

## Development

Install [Crystal](https://crystal-lang.org/docs/installation/index.html) then run `shards install`.

## Contributing

1. Fork it ( https://github.com/icyleaf/hpr/fork )
Expand Down
14 changes: 7 additions & 7 deletions docs/en/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- Getting started
- [Quick start](quickstart.md)
- [Install](install.md)
- [Quick start](/en/quickstart.md)
- [Install](/en/install.md)
- Guide
- [Configuration](configuration.md)
- [API](api.md)
- [Cli Tool](cli.md)
- [Examples](examples.md)
- [Migrate](migrate.md)
- [Configuration](/en/configuration.md)
- [API](/en/api.md)
- [CLI](/en/cli.md)
- [Examples](/en/examples.md)
- [Migrations](/en/migrate.md)
6 changes: 3 additions & 3 deletions docs/en/api.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# API 接口
# Web API

hpr support a web api service (port `8848`) by default.

## Authentication

Only support Basic Auth for now. Configure from `config/hpr.json` file,View detail in [Configuration](configuration?id=basic_auth-接口认证).
Only support Basic Auth for now. Configure from `config/hpr.json` file,View detail in [Configuration](/en/configuration?id=basic_auth-接口认证).

```bash
$ curl -u user@password http://hpr-ip:8848/info
Expand Down Expand Up @@ -83,7 +83,7 @@ GET /repositores/:name
}
```

### 创建镜像仓库
### Create repository

Create a git repository, it is recommand to use HTTP protocol. The name got from url by default if left it empty but only avaiables with

Expand Down
2 changes: 1 addition & 1 deletion docs/en/cli.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cli
# CLI

hpr is a command line tool, it also support some commands to manage mirror repositories temporary.

Expand Down
48 changes: 48 additions & 0 deletions docs/en/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Configuration

You can create a new hpr config file by copying the template that we have included for you:

```
$ cp config/hpr.json.example.json config/hpr.json.json
```

For now, hpr only read config from `config/hpr.json` file.

## schedule_in

Update cycle for each repository, the min unit is miniute.

Unit | Type | Values | Samples
---|---|---|---
Minute | String/Int32/Int64 | `interge value`/`minute`/`minutes` | 60<br />"1.minute"<br />"30.minutes"
Houe | String | `hour`/`hours` | "1.hour"<br />"5.hours"
Day | String | `day`/`days` | "1.day"<br />"10.days"
Week | String | `week`/`weeks` | "1.week"<br />"2.weeks"
Month | String | `month`/`months` | "1.month"<br />"6.months"
Year | String | `year`/`years` | "1.year"<br />"2.years"

## basic_auth

You can enable basic auth for security.

| Key | Type | Description | Note |
|---|---|---|---|
| enable | boolean | Enable Basic auth | `true`/`false` |
| user | string | User | |
| password | string | Password | Be complex |

## gitlab

Config of gitlab, main key were `endpoint`, `prite_token` and `group_name`

| Key | Type | Description | Note |
|---|---|---|---|
| endpoint | boolean | Endpoint of gitlab | Support non-GraphQL API |
| private_token | string | private token of gitlab | New version gitlab rename to Access Token |
| ssh_port | integer | ssh port of gitlab | default is 22 |
| group_name | string | name of group | Ask Admin to create group if you have not create group role<br />No support for personal namespace |
| project_public | boolean | Is public | |
| project_issue | boolean | Enable Issue | `true`/`false` |
| project_wiki | boolean | Enable Wiki | `true`/`false` |
| project_merge_request | boolean | Enable MR | `true`/`false` |
| project_snippet | boolean | Enable Snippet | `true`/`false` |
5 changes: 5 additions & 0 deletions docs/en/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Examples

- [Self-host Gitlab](https://github.com/icyleaf/hpr/tree/master/examples/selfhost)

- [Use Gitlab.com](https://github.com/icyleaf/hpr/tree/master/examples/saas)
Loading

0 comments on commit b3ac190

Please sign in to comment.