移除 tmp
This commit is contained in:
		
							
								
								
									
										14
									
								
								bin/main.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								bin/main.go
									
									
									
									
									
								
							@@ -237,20 +237,6 @@ func main() {
 | 
				
			|||||||
		Pretty:     false,
 | 
							Pretty:     false,
 | 
				
			||||||
	})))
 | 
						})))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//http.HandleFunc("/api", func(w http.ResponseWriter, r *http.Request) {
 | 
					 | 
				
			||||||
	//	defer LogComponent(time.Now().UnixNano(), r) // 最后打印日志
 | 
					 | 
				
			||||||
	//	query := r.URL.Query().Get("query")
 | 
					 | 
				
			||||||
	//	params := graphql.Params{Schema: schema, RequestString: query}
 | 
					 | 
				
			||||||
	//	result := graphql.Do(params)
 | 
					 | 
				
			||||||
	//	if len(result.Errors) > 0 {
 | 
					 | 
				
			||||||
	//		fmt.Printf("failed to execute graphql operation, errors: %+v", result.Errors)
 | 
					 | 
				
			||||||
	//		http.Error(w, result.Errors[0].Error(), 500)
 | 
					 | 
				
			||||||
	//		return
 | 
					 | 
				
			||||||
	//	}
 | 
					 | 
				
			||||||
	//	rJSON, _ := json.MarshalIndent(result.Data, "", "  ")
 | 
					 | 
				
			||||||
	//	w.Write(rJSON)
 | 
					 | 
				
			||||||
	//})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
 | 
						http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
		defer LogComponent(time.Now().UnixNano(), r) // 最后打印日志
 | 
							defer LogComponent(time.Now().UnixNano(), r) // 最后打印日志
 | 
				
			||||||
		http.Error(w, "Not Found", http.StatusNotFound)
 | 
							http.Error(w, "Not Found", http.StatusNotFound)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
root:              ./bin
 | 
					root:              ./bin
 | 
				
			||||||
tmp_path:          ./tmp
 | 
					tmp_path:          ./data
 | 
				
			||||||
build_name:        bin/main
 | 
					build_name:        bin/main
 | 
				
			||||||
build_log:         runner-build-errors.log
 | 
					build_log:         runner-build-errors.log
 | 
				
			||||||
valid_ext:         .go, .tpl, .tmpl, .html
 | 
					valid_ext:         .go, .tpl, .tmpl, .html
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								update.sh
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								update.sh
									
									
									
									
									
								
							@@ -1,26 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
host="root@main"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 更新 go mod, 然後靜態編譯
 | 
					 | 
				
			||||||
go mod tidy
 | 
					 | 
				
			||||||
go build -o dist/main bin/main.go
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 重命名旧文件
 | 
					 | 
				
			||||||
ssh $host "mv ~/webp/main ~/webp/main_old"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 上传到服务器, 然後刪除本地文件
 | 
					 | 
				
			||||||
scp dist/main $host:~/webp/main
 | 
					 | 
				
			||||||
rm -rf dist
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 重载服务
 | 
					 | 
				
			||||||
ssh $host "systemctl restart webp"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 删除旧文件
 | 
					 | 
				
			||||||
ssh $host "rm ~/webp/main_old"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 设为系统服务
 | 
					 | 
				
			||||||
# sudo cp webp.service /etc/systemd/system/webp.service
 | 
					 | 
				
			||||||
# sudo systemctl enable webp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 设置日志轮转
 | 
					 | 
				
			||||||
# sudo cp webp.logrotate /etc/logrotate.d/webp
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user