47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
export host=main
 | 
						|
 | 
						|
# 运行本地开发环境(使用SSH隧道代理端口)
 | 
						|
dev:
 | 
						|
	@if ! go list -m github.com/air-verse/air@latest >/dev/null 2>&1; then \
 | 
						|
		echo "github.com/air-verse/air@latest is not installed. Installing..."; \
 | 
						|
		go get github.com/air-verse/air@latest; \
 | 
						|
	fi;
 | 
						|
	@ssh -NCPf main -L 3306:localhost:3306 -L 19530:localhost:19530 & \
 | 
						|
		sleep 1; \
 | 
						|
		go run github.com/air-verse/air@latest --build.cmd "go build -o ./data/ bin/main.go" --build.bin "./data/main"; \
 | 
						|
		wait
 | 
						|
 | 
						|
link:
 | 
						|
	ssh -NCPf main -L 3306:localhost:3306 -L 19530:localhost:19530
 | 
						|
 | 
						|
# 编译项目
 | 
						|
build:
 | 
						|
	go mod tidy
 | 
						|
	go build -o dist/main bin/main.go
 | 
						|
 | 
						|
# 更新部署到服务器
 | 
						|
update: build
 | 
						|
	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"
 | 
						|
 | 
						|
# 设为系统服务和设置日志轮转
 | 
						|
service:
 | 
						|
	sudo cp webp.service /etc/systemd/system/webp.service
 | 
						|
	sudo systemctl enable webp
 | 
						|
	sudo cp webp.logrotate /etc/logrotate.d/webp
 | 
						|
 | 
						|
# 安装 zinc
 | 
						|
 | 
						|
 | 
						|
# 安装 gorse
 | 
						|
gorse:
 | 
						|
	export GORSE_DASHBOARD_USER="gorse"
 | 
						|
	export GORSE_DASHBOARD_PASS="gorse"
 | 
						|
	curl -fsSL https://gorse.io/playground | bash
 | 
						|
 | 
						|
# 安装搜图服务 python embedding
 | 
						|
reverse:
 | 
						|
	git clone 
 |