Skip to content

Commit e698779

Browse files
committed
增加 发行描述
1 parent d8426a3 commit e698779

24 files changed

+1350
-155
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.tar.gz
2+
*.tgz

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# reactgo
1+
# ReactGo
2+
3+
React + Go quick startup framework.

migrate/001_v0.down.sql

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ drop table if exists acl_allows;
88
drop table if exists sms_settings;
99
drop table if exists mtas;
1010
drop table if exists notifications;
11+
drop table if exists tasks;
1112

1213
commit;

migrate/001_v0.up.sql

+13
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,17 @@ create table if not exists notifications (
115115
fresh boolean not null default true
116116
);
117117

118+
create table if not exists tasks (
119+
uuid varchar(36) primary key not null,
120+
create_at timestamp not null default current_timestamp,
121+
update_at timestamp not null default current_timestamp,
122+
name varchar(64) not null,
123+
cron varchar(64) not null,
124+
engine int not null,
125+
path varchar(256) not null,
126+
nfire int not null default 0,
127+
fire_at timestamp not null default current_timestamp,
128+
note text
129+
);
130+
118131
commit;

release.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# ReactGo 使用指南
2+
3+
1. 创建操作系统用户 `reactgo`,命令如下:
4+
5+
```
6+
sudo useradd reactgo
7+
```
8+
9+
将来所有的操作使用此用户,某些操作需要特权,请将 `reactgo` 用户添加到 sudo 列表中,
10+
不要使用 `root` 用户。
11+
12+
1.`reactgo.tar.gz` 上传到 `reactgo` 用户的 HOME 目录中,然后解压:
13+
14+
```bash
15+
# 上传文件,本地执行 scp,或者使用其它工具上传都可以
16+
scp reactgo.tar.gz reactgo@host:
17+
18+
# 登录服务器
19+
ssh host
20+
...login...
21+
22+
# 解压
23+
tar xf reactgo.tar.gz
24+
```
25+
26+
1.`reactgo/bin` 目录添加到 `PATH` 环境变量中,例如在 `.bash_profile` 文件中,添加:
27+
28+
```bash
29+
export PATH=$HOME/reactgo/bin:$PATH
30+
```
31+
32+
上面 `$HOME/reactgo/bin` 是一个假设,请根据实际路径进行调整。
33+
34+
1. `reactgo/bin` 目录中 `migrate` 可能还未解压,使用下面的命令解压:
35+
36+
```bash
37+
cd reactgo/bin
38+
tar xf migrate.tar.gz
39+
```
40+
41+
## 安装数据库服务器
42+
43+
当前支持 PostgreSQL v13 数据库服务器,请安装官方文档进行安装。
44+
45+
## 初始化数据库
46+
47+
1. 创建数据库,注意不使用 reactgo 作为数据库名是可以的,但是在其它地方(例如配置文件)
48+
也要对应进行修改。
49+
50+
```bash
51+
createdb reactgo
52+
```
53+
54+
1. 初始化数据表,进入 `reactgo/migrate` 目录,检查一下 `migrate.sh` 文件的配置是否正确,
55+
然后执行:
56+
57+
```bash
58+
sh migrate.sh up
59+
```
60+
61+
## 配置文件
62+
63+
配置文件内容请参考文档说明。
64+
65+
## 启动 ReactGo
66+
67+
`bin` 目录中有 2 个 reactgo 执行文件,其中一个带有 `dev` 后缀(表示开发版,
68+
有更详细的日志),建议先使用这个验证一下是否都准备就绪。如果 `dev` 版可以正常运行,
69+
再使用不带 `dev` 的版本运行。
70+
71+
启动命令:
72+
73+
```bash
74+
migrate-linux-amd64 -config ~/reactgo/conf/config.yaml
75+
```

release.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
# make a 'release' tarball to deploy on linux platform.
4+
5+
rm -fr reactgo
6+
mkdir reactgo
7+
8+
pwd=$PWD
9+
10+
# 编译最新的执行文件 for Linux
11+
mkdir -p reactgo/bin
12+
cd serve && make linux && cd $pwd
13+
mv serve/reactgo-linux-amd64 reactgo/bin/
14+
mv serve/reactgo-linux-amd64-dev reactgo/bin/
15+
16+
# 复制一份配置文件
17+
mkdir -p reactgo/conf
18+
cp serve/config.yaml reactgo/conf/
19+
20+
# 下载 migrate 二进制 for Linux
21+
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.15.1/migrate.linux-amd64.tar.gz > reactgo/bin/migrate.tar.gz
22+
23+
# 数据库脚本
24+
cp -r migrate reactgo/
25+
26+
# 附带使用说明和授权协议
27+
cp release.md reactgo/README.md
28+
cp LICENSE reactgo/
29+
30+
# 准备就绪,打包
31+
rm -fr reactgo.tar.gz
32+
tar zcf reactgo.tar.gz reactgo
33+
rm -fr reactgo

serve/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Generated binary executable
1515
reactgo
16-
reactgo-dev
16+
reactgo-*
1717

1818
# Web front end generated files
1919
web

serve/Makefile

+9-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ run:
4242
go run -ldflags='$(LDFLAGS)' -tags '${TAGS} dev' . \
4343
-config .config/config.yaml -webfs osdir -mailfs osdir
4444

45+
# build a linux amd64 executable
46+
linux: web
47+
GOOS=linux GOARCH=amd64 \
48+
go build -ldflags='$(LDFLAGS)' -tags '${TAGS}' -o ${APPNAME}-linux-amd64
49+
50+
GOOS=linux GOARCH=amd64 \
51+
go build -ldflags='$(LDFLAGS)' -tags '${TAGS} dev' -o ${APPNAME}-linux-amd64-dev
52+
4553
# run test
4654
test:
4755
go test $(arg) ./test/...
@@ -50,4 +58,4 @@ test:
5058
clean:
5159
go clean
5260

53-
.PHONY: web build build-dev dev test all clean
61+
.PHONY: web build build-dev dev test all clean linux

serve/config/load.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ func Load(filepath string) (*ViperConfig, error) {
2323
if len(filepath) > 0 {
2424
vp.SetConfigFile(filepath)
2525
} else {
26-
vp.SetConfigName("rgo")
26+
vp.SetConfigName("reactgo")
2727
vp.AddConfigPath(".")
2828
}
29-
vp.SetEnvPrefix("rgo")
29+
vp.SetEnvPrefix("reactgo")
3030

3131
replacer := strings.NewReplacer(".", "_", "-", "_")
3232
vp.SetEnvKeyReplacer(replacer)

serve/db/connect.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import (
1111
)
1212

1313
const (
14-
DriverSqlite = "sqlite"
15-
DriverPgx = "pgx"
16-
DriverMySQL = "mysql"
14+
DriverPgx = "pgx"
15+
DriverMySQL = "mysql"
1716
)
1817

1918
// mainDB is global database connection pool
@@ -25,12 +24,6 @@ func Connect(driver string, dsn string) {
2524
xlog.X.Debug("Repeat connection to the database")
2625
return
2726
}
28-
// Rename sqlite3 to sqlite to prevent using the original sqlite driver
29-
if driver == "sqlite3" {
30-
driver = DriverSqlite
31-
}
32-
sqliteRegister(dsn)
33-
3427
mainDB = sqlx.MustConnect(driver, dsn)
3528

3629
mainDB.SetMaxOpenConns(100)

serve/db/sqlite.go

-130
This file was deleted.

serve/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require (
1111
github.com/jmoiron/sqlx v1.3.4
1212
github.com/labstack/echo/v4 v4.6.3
1313
github.com/labstack/gommon v0.3.1
14-
github.com/mattn/go-sqlite3 v2.0.3+incompatible
1514
github.com/mssola/user_agent v0.5.3
1615
github.com/pkg/errors v0.9.1
1716
github.com/sirupsen/logrus v1.8.1
@@ -25,6 +24,7 @@ require (
2524
github.com/fsnotify/fsnotify v1.5.1 // indirect
2625
github.com/hashicorp/hcl v1.0.0 // indirect
2726
github.com/magiconair/properties v1.8.5 // indirect
27+
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
2828
github.com/mitchellh/mapstructure v1.4.3 // indirect
2929
github.com/pelletier/go-toml v1.9.4 // indirect
3030
github.com/spf13/afero v1.8.0 // indirect

web/src/route/system/index.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import User from "./user";
44
import Acl from "./acl";
55
import History from "./history";
66
import Settings from "./settings";
7+
import Task from "./task";
78

89
export default function System() {
910
return (
@@ -12,6 +13,7 @@ export default function System() {
1213
<Route path='acl/*' element={<Acl />} />
1314
<Route path='history/*' element={<History />} />
1415
<Route path='settings/*' element={<Settings />} />
16+
<Route path='task/*' element={<Task />} />
1517
<Route path='*' element={<NotFound />} />
1618
</Routes>
1719
)

web/src/route/system/settings/mail/info.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function BaseInfoTable(props) {
121121
{mta.bcc}
122122
</TableCell>
123123
</TableRow>
124-
<TableRow sx={{ borderBottom: 0 }}>
124+
<TableRow sx={{ td: { borderBottom: 0 } }}>
125125
<TableCell>序号</TableCell>
126126
<TableCell sx={{ borderLeft: '1px solid', borderRight: '1px solid' }}>
127127
{mta.sortno}

0 commit comments

Comments
 (0)