From e442d2ae8f8fac1483e2e85de75f47e9f4e08104 Mon Sep 17 00:00:00 2001 From: "suguo.yao" Date: Tue, 18 Oct 2022 11:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Makefile | 22 ++++++++++++++++++++++ main.go | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index c8202e9..da4d850 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ # vendor/ .vscode/ data/ +search \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab6bd40 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +appname = search +serverip = 192.168.0.254 +serverport = 22 + +.PHONY : linux +linux: + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(appname) . + +.PHONY : dev +dev: + export mysql_dsn="root:SG1231@tcp(192.168.0.254:13306)/site?charset=utf8mb4&parseTime=True&loc=Local" + export exceptionless_apikey=FT7zsVcX9wTHZgTSECjbeqDFJFddMybETQhhFM0s + export exceptionless_url=http://exceptionless.devops.easyj.top:60011/api/v2/ + go run . + +.PHONY : release +release: linux + ssh -p $(serverport) suguo@$(serverip) "sudo supervisorctl stop $(appname)" + ssh -p $(serverport) suguo@$(serverip) "if [ ! -d /usr/local/search/bak ]; then mkdir -p /usr/local/search/bak; fi" + ssh -p $(serverport) suguo@$(serverip) "if [ -f /usr/local/search/$(appname) ]; then cp /usr/local/search/$(appname) /usr/local/search/bak; fi" + scp -P $(serverport) ./$(appname) suguo@$(serverip):/usr/local/search/ + ssh -p $(serverport) suguo@$(serverip) "sudo supervisorctl start $(appname)" \ No newline at end of file diff --git a/main.go b/main.go index 7580884..b2a14ca 100644 --- a/main.go +++ b/main.go @@ -39,7 +39,7 @@ func main() { //搜索初始化 service.GoFoundInit(&global.Config{ Addr: "192.168.0.254:5678", - Data: os.Getenv("gofound_dictionary"), + Data: os.Getenv("gofound_data"), Debug: false, Dictionary: os.Getenv("gofound_dictionary"), EnableAdmin: true,