Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move migrating repository from frontend to backend #6200

Merged
merged 42 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b8d2762
move migrating to backend
lunny Feb 27, 2019
b8d9e8c
add loading image when migrating and fix tests
lunny Feb 28, 2019
258afa4
fix format
lunny Feb 28, 2019
58d35b0
fix lint
lunny Feb 28, 2019
7771acb
add redis task queue support and improve docs
lunny Mar 1, 2019
ac357dc
add redis vendor
lunny Mar 1, 2019
dff614f
fix vet
lunny Mar 1, 2019
75f2aa3
add database migrations and fix app.ini sample
lunny Apr 3, 2019
585fa50
add comments for task section on app.ini.sample
lunny Apr 3, 2019
fffcc0e
Update models/migrations/v84.go
lafriks Apr 4, 2019
8a29d8a
Update models/repo.go
lafriks Apr 4, 2019
40a6d64
move migrating to backend
lunny Feb 27, 2019
2bba6a9
add loading image when migrating and fix tests
lunny Feb 28, 2019
2b1626d
fix fmt
lunny Feb 28, 2019
6b6ece7
add redis task queue support and improve docs
lunny Mar 1, 2019
cf24a79
fix fixtures
lunny Apr 7, 2019
2643529
fix fixtures
lunny Apr 12, 2019
e018d40
fix duplicate function on index.js
lunny May 26, 2019
fe4557b
fix tests
lunny May 26, 2019
8187434
rename repository statuses
lunny May 31, 2019
10caeeb
check if repository is being create when SSH request
lunny Jun 1, 2019
8abee04
fix lint
lunny Jun 18, 2019
a1b539c
fix template
lunny Jun 18, 2019
dd0550e
some improvements
lunny Jul 10, 2019
65c3582
fix template
lunny Jul 10, 2019
26d82d3
unified migrate options
lunny Jul 10, 2019
a1b1744
fix lint
lunny Jul 11, 2019
5384a12
fix loading page
lunny Jul 11, 2019
19d10ee
refactor
lunny Jul 11, 2019
38b6726
When gitea restart, don't restart the running tasks because we may ha…
lunny Jul 11, 2019
237c73a
fix js
lunny Jul 28, 2019
4ef33d6
fix tests
lunny Sep 17, 2019
e4adc77
Update models/repo.go
lunny Sep 17, 2019
6c6bde7
Update docs/content/doc/advanced/config-cheat-sheet.en-us.md
lunny Sep 17, 2019
220de6f
rename ErrTaskIsNotExist to ErrTaskDoesNotExist
lunny Sep 21, 2019
a1a1358
delete release after add one on tests to make it run happy
lunny Sep 25, 2019
45ab0cd
fix tests
lunny Oct 4, 2019
5e1888f
fix tests
lunny Oct 5, 2019
fb4e7f3
improve codes
lunny Oct 12, 2019
80c9e8d
fix lint
lunny Oct 12, 2019
8edb889
fix lint
lunny Oct 12, 2019
badbf9e
fix migrations
lunny Oct 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ prime/
*.snap
*.snap-build
*_source.tar.bz2
.DS_Store
9 changes: 9 additions & 0 deletions custom/conf/app.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -808,3 +808,12 @@ IS_INPUT_FILE = false
ENABLED = false
; If you want to add authorization, specify a token here
TOKEN =

[task]
; Task queue type, could be `channel` or `redis`.
QUEUE_TYPE = channel
; Task queue length, available only when `QUEUE_TYPE` is `channel`.
QUEUE_LENGTH = 1000
; Task queue connction string, available only when `QUEUE_TYPE` is `redis`.
; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`.
QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"
7 changes: 7 additions & 0 deletions docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,16 @@ Two special environment variables are passed to the render command:
- `GITEA_PREFIX_RAW`, which contains the current URL prefix in the `raw` path tree. To be used as prefix for image paths.

## Time (`time`)

- `FORMAT`: Time format to diplay on UI. i.e. RFC1123 or 2006-01-02 15:04:05
- `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Shanghai/Asia

## Task (`task`)

- `QUEUE_TYPE`: **channel**: Task queue type, could be `channel` or `redis`.
- `QUEUE_LENGTH`: **1000**: Task queue length, available only when `QUEUE_TYPE` is `channel`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a queue that long as default I'd say we'll need a queue management page. That would be overkill for this PR, so I'd reduce this QUEUE_LENGTH to a much lower value (20?).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guillep2k all other queue_length is also default 1000 . i.e. webhook's . A task/queue management will be next PRs.

- `QUEUE_CONN_STR`: **addrs=127.0.0.1:6379 db=0**: Task queue connection string, available only when `QUEUE_TYPE` is `redis`. If there redis needs a password, use `addrs=127.0.0.1:6379 password=123 db=0`.

## Other (`other`)

- `SHOW_FOOTER_BRANDING`: **false**: Show Gitea branding in the footer.
Expand Down
7 changes: 7 additions & 0 deletions docs/content/doc/advanced/config-cheat-sheet.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,16 @@ IS_INPUT_FILE = false
- IS_INPUT_FILE: 输入方式是最后一个参数为文件路径还是从标准输入读取。

## Time (`time`)

- `FORMAT`: 显示在界面上的时间格式。比如: RFC1123 或者 2006-01-02 15:04:05
- `DEFAULT_UI_LOCATION`: 默认显示在界面上的时区,默认为本地时区。比如: Asia/Shanghai

## Task (`task`)

- `QUEUE_TYPE`: **channel**: 任务队列类型,可以为 `channel` 或 `redis`。
- `QUEUE_LENGTH`: **1000**: 任务队列长度,当 `QUEUE_TYPE` 为 `channel` 时有效。
- `QUEUE_CONN_STR`: **addrs=127.0.0.1:6379 db=0**: 任务队列连接字符串,当 `QUEUE_TYPE` 为 `redis` 时有效。如果redis有密码,则可以 `addrs=127.0.0.1:6379 password=123 db=0`。

## Other (`other`)

- `SHOW_FOOTER_BRANDING`: 为真则在页面底部显示Gitea的字样。
Expand Down
43 changes: 42 additions & 1 deletion models/fixtures/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
num_milestones: 3
num_closed_milestones: 1
num_watches: 3
status: 0

-
id: 2
Expand All @@ -24,6 +25,7 @@
num_closed_pulls: 0
num_stars: 1
close_issues_via_commit_in_any_branch: true
status: 0

-
id: 3
Expand All @@ -36,6 +38,7 @@
num_pulls: 0
num_closed_pulls: 0
num_watches: 0
status: 0

-
id: 4
Expand All @@ -48,6 +51,7 @@
num_pulls: 0
num_closed_pulls: 0
num_stars: 1
status: 0

-
id: 5
Expand All @@ -61,6 +65,7 @@
num_closed_pulls: 0
num_watches: 0
is_mirror: true
status: 0

-
id: 6
Expand All @@ -73,6 +78,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 7
Expand All @@ -85,6 +91,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 8
Expand All @@ -97,6 +104,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 9
Expand All @@ -109,6 +117,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 10
Expand All @@ -122,6 +131,7 @@
num_closed_pulls: 0
is_mirror: false
num_forks: 1
status: 0

-
id: 11
Expand All @@ -135,6 +145,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 12
Expand All @@ -147,6 +158,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 13
Expand All @@ -159,6 +171,7 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 14
Expand All @@ -172,13 +185,15 @@
num_pulls: 0
num_closed_pulls: 0
is_mirror: false
status: 0

-
id: 15
owner_id: 2
lower_name: repo15
name: repo15
is_empty: true
status: 0

-
id: 16
Expand All @@ -191,6 +206,7 @@
num_pulls: 0
num_closed_pulls: 0
num_watches: 0
status: 0

-
id: 17
Expand All @@ -205,6 +221,7 @@
num_watches: 0
is_mirror: false
is_fork: false
status: 0

-
id: 18
Expand All @@ -218,6 +235,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 19
Expand All @@ -231,6 +249,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 20
Expand All @@ -244,6 +263,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 21
Expand All @@ -257,6 +277,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 22
Expand All @@ -270,6 +291,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 23
Expand All @@ -283,6 +305,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 24
Expand All @@ -296,6 +319,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: false
status: 0

-
id: 25
Expand All @@ -310,6 +334,7 @@
num_watches: 0
is_mirror: true
is_fork: false
status: 0

-
id: 26
Expand All @@ -324,6 +349,7 @@
num_watches: 0
is_mirror: true
is_fork: false
status: 0

-
id: 27
Expand All @@ -339,6 +365,7 @@
is_mirror: true
num_forks: 1
is_fork: false
status: 0

-
id: 28
Expand All @@ -354,6 +381,7 @@
is_mirror: true
num_forks: 1
is_fork: false
status: 0

-
id: 29
Expand All @@ -368,6 +396,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: true
status: 0

-
id: 30
Expand All @@ -382,6 +411,7 @@
num_closed_pulls: 0
is_mirror: false
is_fork: true
status: 0

-
id: 31
Expand All @@ -392,6 +422,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 32 # org public repo
Expand All @@ -403,13 +434,15 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 33
owner_id: 2
lower_name: utf8
name: utf8
is_private: false
status: 0

-
id: 34
Expand All @@ -421,6 +454,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 35
Expand All @@ -432,6 +466,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 36
Expand All @@ -443,6 +478,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 37
Expand All @@ -454,6 +490,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 38
Expand All @@ -465,6 +502,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 39
Expand All @@ -476,6 +514,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 40
Expand All @@ -487,6 +526,7 @@
num_forks: 0
num_issues: 0
is_mirror: false
status: 0

-
id: 41
Expand Down Expand Up @@ -519,4 +559,5 @@
num_stars: 0
num_forks: 0
num_issues: 0
is_mirror: false
is_mirror: false
status: 0
2 changes: 2 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ var migrations = []Migration{
NewMigration("add repo_admin_change_team_access to user", addRepoAdminChangeTeamAccessColumnForUser),
// v98 -> v99
NewMigration("add original author name and id on migrated release", addOriginalAuthorOnMigratedReleases),
// v99 -> v100
NewMigration("add task table and status column for repository table", addTaskTable),
}

// Migrate database to current version
Expand Down
Loading