Skip to content

Commit 1fe7fa7

Browse files
committed
doc: update docs
1 parent 9b45e7f commit 1fe7fa7

17 files changed

Lines changed: 101 additions & 100 deletions

CHANGELOGS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
### Added
2222

23-
- [CLI] 新增独立命令 `hpr-migration` 迁移命令 (目前为止仅支持 gitlab-mirror`)
23+
- [CLI] 新增独立命令 `hpr-migration` 迁移命令 (目前为止仅支持 gitlab-mirrors`)
2424
- [CLI] 新增全局参数 `--file` 可以指定自定义的 hpr.json 配置文件.
2525

2626
### Fixed
@@ -34,7 +34,7 @@
3434

3535
- [API] `/repositories/search` 搜索仓库 API 参数从 query 改为 uri path 方式,名称从 `q` 改为 `keyword`
3636

37-
## [0.6.2] (2018-06-20)
37+
## [0.7.0] (2018-06-20)
3838

3939
### Fixed
4040

@@ -96,8 +96,8 @@
9696

9797
- 第一个测试版本
9898

99-
[Unreleased]: https://github.com/icyleaf/hpr/compare/v0.6.2...HEAD
100-
[0.6.2]: https://github.com/icyleaf/hpr/compare/v0.6.0...v0.6.2
99+
[Unreleased]: https://github.com/icyleaf/hpr/compare/v0.7.0...HEAD
100+
[0.7.0]: https://github.com/icyleaf/hpr/compare/v0.6.0...v0.7.0
101101
[0.6.0]: https://github.com/icyleaf/hpr/compare/v0.5.0...v0.6.0
102102
[0.5.0]: https://github.com/icyleaf/hpr/compare/v0.3.0...v0.5.0
103103
[0.3.0]: https://github.com/icyleaf/hpr/compare/v0.2.0...v0.3.0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
hpr_image_name ?= icyleafcn/hpr
2-
hpr_version ?= 0.6.2
2+
hpr_version ?= 0.7.0
33

44
all: build
55

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ services:
66
ports:
77
- 8848:8848
88
volumes:
9-
- ./config:/app/config
10-
- ./repositories:/app/repositories
9+
- /my/own/hprdir:/app
1110
environment:
1211
REDIS_URL: tcp://redis:6379
1312
REDIS_PROVIDER: REDIS_URL

docs/_coverpage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![logo](_media/icon.png)
22

3-
# ḫpr <small>0.6.2</small>
3+
# ḫpr <small>0.7.0</small>
44

55
> 镜像任意 git 仓库到 gitlab 的同步工具,具有定时更新的功能。
66

docs/api.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ POST /repositores
154154
|---|---|---|---|
155155
| url | String | true | 仓库地址 |
156156
| name | String | false | 镜像名字,不填写默认从 url 自动获取 |
157+
| create | String | false | 是否创建 gitlab 项目,默认是 "true" |
158+
| clone | String | false | 是否克隆原仓库并推送到 gitlab,默认是 "true" |
157159

158160
#### 返回样例
159161

@@ -224,7 +226,7 @@ GET /info
224226
```json
225227
{
226228
"hpr": {
227-
"version": "0.6.2",
229+
"version": "0.7.0",
228230
"repositroies": {
229231
"total": 2,
230232
"entry": [

docs/en/_coverpage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![logo](../_media/icon.png)
22

3-
# ḫpr <small>0.6.2</small>
3+
# ḫpr <small>0.7.0</small>
44

55
> Mirror git repositories to self-host gitlab services.
66

docs/en/api.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ GET /repositores
2222

2323
| Name | Type | Required | Description |
2424
|---|---|---|---|
25-
| page | Integer | false | |
26-
| per_page | Integer | false | |
25+
| page | Integer | false | The number of current page |
26+
| per_page | Integer | false | The number of per page |
2727

2828
#### Example Response
2929

@@ -67,7 +67,7 @@ GET /repositores/search/:name
6767

6868
| Name | Type | Required | Description |
6969
|---|---|---|---|
70-
| name | String | true | the name of repository |
70+
| name | String | true | The name of mirrored repository |
7171

7272
#### Example Response
7373

@@ -109,7 +109,7 @@ GET /repositores/:name
109109

110110
| Name | Type | Required | Description |
111111
|---|---|---|---|
112-
| name | String | false | Name of mirrored repository |
112+
| name | String | false | The name of mirrored repository |
113113

114114
#### Example Response
115115

@@ -149,8 +149,10 @@ POST /repositores
149149

150150
| Name | Type | Required | Description |
151151
|---|---|---|---|
152-
| url | String | true | |
153-
| name | String | false | |
152+
| url | String | true | The clone url of origin |
153+
| name | String | false | The name of mirrored repository |
154+
| create | String | false | Should to create gitlab project, by default is "true" |
155+
| clone | String | false | Should to clone origin repository, by default is "true" |
154156

155157
#### Example Response
156158

docs/en/install.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Check [Quick start](/en/quickstart.md)。
1515
Pull specified version of hpr:
1616

1717
```bash
18-
$ docker pull icyleafcn/hpr:0.6.2
18+
$ docker pull icyleafcn/hpr:0.7.0
1919
```
2020

2121
Or pull the latest version:
@@ -99,6 +99,8 @@ Actions:
9999
-c, --create Create a mirror repository
100100
-u, --update Updated a mirrored repository
101101
-d, --delete Delete a mirrored repository
102+
-v, --version Show version
103+
-h, --help Show this help
102104

103105
Option in server action:
104106

@@ -107,26 +109,26 @@ Option in server action:
107109
Option in create action:
108110

109111
-U URL, --url URL The url of mirror repository
110-
-M, --mirror-only Only mirror the repository without clone in create action
112+
--no-create Do not create project in gitlab
113+
--no-clone Do not clone mirror of git repository from url
111114

112115
Global options:
113116

114-
-v, --version Show version
115-
-h, --help Show this help
117+
-f FILE, --file FILE the path of hpr.json config file
116118

117119
Examples:
118120

119121
o Start a API server:
120122

121123
$ hpr -s
122124

123-
o List all mirrored repositories:
125+
o Start a API server with custom port and different config path:
124126

125-
$ hpr -l
127+
$ hpr -s --port 3001 --file ~/.config/hpr/hpr.json
126128

127-
o Start a API server with custom port:
129+
o List all mirrored repositories:
128130

129-
$ hpr -s --port 3001
131+
$ hpr -l
130132

131133
o Search all repositories include icyleaf keywords:
132134

@@ -138,7 +140,7 @@ Examples:
138140

139141
o Clone and push a new repository without create gitlab project:
140142

141-
$ hpr -c --mirror-only --url https://github.com/icyleaf/hpr.git icyleaf-hpr
143+
$ hpr -c --no-create --url https://github.com/icyleaf/hpr.git icyleaf-hpr
142144

143145
o Update a repository:
144146

@@ -150,5 +152,5 @@ Examples:
150152

151153
More detail to check: https://icyleaf.github.io/hpr/
152154

153-
hpr v0.6.2 in Crystal v0.24.2
155+
hpr v0.7.0 in Crystal v0.26.1
154156
```

docs/en/migrate.md

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,9 @@ Enable MR | merge_requests_enabled | gitlab.project_merge_request | Yes
2323

2424
More about hpr's config to check [Configurateion](/en/configuration.md) page.
2525

26-
Then, migrate old repositories directory to hpr:
26+
Next step, you need get the path of gitlab-mirrors's repositories directory: get $repo_dir value from config.sh,default is /home/gitmirror/repositories
2727

28-
```bash
29-
# get $repo_dir value from config.sh,default is /home/gitmirror/repositories
30-
$ cd /home/gitmirror/repositories
31-
32-
# Copy the whole directory to hpr's directory
33-
$ cp -r mirrors /path/to/hpr/repositories
34-
```
35-
36-
Finally, edit docker-compose.yml file:
28+
Then edit docker-compose.yml file, next move is run `docker-compose up -d`
3729

3830
```yaml
3931
version: '2'
@@ -44,8 +36,8 @@ services:
4436
ports:
4537
- 8848:8848
4638
volumes:
47-
- ./config:/app/config
48-
- /path/to/hpr/repositories:/app/repositories
39+
- /my/own/hprdir:/app
40+
- /home/gitmirror/repositories:/tmp/old-repositories
4941
environment:
5042
REDIS_URL: tcp://redis:6379
5143
REDIS_PROVIDER: REDIS_URL
@@ -58,22 +50,20 @@ services:
5850
image: redis:alpine
5951
```
6052
61-
Run `docker-compose up -d`
53+
Hpr is running now, but the data is not migrate, hpr provides a migration command tool named "hpr-migration" to make this move easily:
6254
63-
Apply the update by schedule, you need do this:
64-
65-
```ruby
66-
# gem install http
67-
require 'http'
68-
69-
# Change to ip or address which hpr is
70-
hpr_url = 'http://localhost:8848/repositories'
71-
72-
repositories = HTTP.get(hpr_url).parse
73-
repositories.each do |repo|
74-
url = File.join(hpr_url, repo["name"])
75-
HTTP.put url
76-
end
55+
```bash
56+
$ docker-compose exec hpr hpr-migration --endpoint "http://localhost:8848" /tmp/old-repositories
57+
* project1
58+
- Configuring git remote ...
59+
- Updating and pushing mirror
60+
* project2
61+
- Create gitlab repository
62+
- Configuring git remote ...
63+
- Updating and pushing mirror
64+
* project3
65+
- Existed, Skip
7766
```
7867
68+
You can get migrated data via [stats](/en/api.md#id=stats) api.
7969
By default, Update cycle is every hour in `schedule` (`config/hpr.json`).

docs/en/quickstart.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Here has 4 places to change your own.
4949

5050
> About more params check [Configuration](configuration?id=basic_auth-接口认证) page.
5151
52-
Then set some optional `ENV` variables if you need in `docker-compose.yml`:
52+
1. Create a data directory on a suitable volume on your host system. e.g. **/my/own/hprdir**.
53+
2. Set some optional `ENV` variables if you need in `docker-compose.yml`:
5354

5455
```yaml
5556
version: '2'
@@ -74,7 +75,7 @@ services:
7475
image: redis:alpine
7576
```
7677
77-
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.
78+
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.
7879

7980
Then run it:
8081

@@ -97,6 +98,11 @@ hpr_1 | | '_ \| '_ \| '__|
9798
hpr_1 | | | | | |_) | |
9899
hpr_1 | |_| |_| .__/|_|
99100
hpr_1 | |_|
101+
hpr_1 | [12] Salt server starting ...
102+
hpr_1 | [12] * Version 0.4.2 (Crystal 0.26.1)
103+
hpr_1 | [12] * Environment: production
104+
hpr_1 | [12] * Listening on http://0.0.0.0:8848/
105+
hpr_1 | [12] Use Ctrl-C to stop
100106
```
101107

102108
Be attention to copy generated ssh public key in terminal output.

0 commit comments

Comments
 (0)