Skip to content

Commit afe0902

Browse files
committed
Add task to update Gogs.
1 parent d94f539 commit afe0902

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
用 Go 语言编写的 Git 服务,特点是功能精简和速度快,树莓派也能流畅运行。
2222
我自己就在用,用的人比较少的话内存占用稳定在 100M 左右。
2323
`rake gogs` 安装后默认开了注册功能,如果要禁用,运行 `rake gogsdr` 即可。
24+
新版本升级后,再运行 `rake gogs``rake gogsdr` 可以自动完成升级。
2425

2526
#### [GitLab](https://github.com/gitlabhq/gitlabhq) :80 `rake gitlab`
2627
知名的开源 Git 服务,特点是功能全面。

roles/gogs/tasks/main.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,32 @@
1515

1616
- name: Download Gogs binary
1717
get_url: >
18-
url=https://github.com/gogits/gogs/releases/download/v0.7.6/linux_amd64.zip
18+
url=https://github.com/gogits/gogs/releases/download/v0.8.10/linux_amd64.zip
1919
dest=/tmp/gogs.zip
2020
mode=0660
2121
tags:
2222
- gogs
2323
- download
2424

25+
- name: Remove existing gogs.zip
26+
raw: rm -rf /tmp/gogs
27+
tags:
28+
- gogs
29+
- remove
30+
2531
- name: Unarchive Gogs
26-
unarchive: src=/tmp/gogs.zip dest=/home/git/ copy=no
32+
unarchive: src=/tmp/gogs.zip dest=/tmp/ copy=no owner=git
2733
tags:
2834
- gogs
2935
- unarchive
3036

37+
- name: Stop existing Gogos
38+
supervisorctl: name=gogs state=stopped
39+
ignore_errors: yes
40+
tags:
41+
- gogs
42+
- stop
43+
3144
- name: Create directories
3245
file: path={{ item }} owner=git state=directory
3346
with_items:
@@ -39,6 +52,21 @@
3952
- gogs
4053
- dir
4154

55+
- name: Backup existing Gogs
56+
raw: cp -R /home/git/gogs /home/git/gogs-backup
57+
tags:
58+
- gogs
59+
- backup
60+
61+
- name: Remove old templates
62+
raw: rm -rf /home/git/gogs/templates
63+
tags:
64+
- gogs
65+
- remove
66+
67+
- name: Upgrade to new Gogs
68+
raw: cp -a /tmp/gogs/. /home/git/gogs
69+
4270
- name: Touch authorized_keys
4371
file: path=/home/git/.ssh/authorized_keys owner=git state=touch mode=0600
4472
tags:

0 commit comments

Comments
 (0)