47 lines
1.3 KiB
Makefile
47 lines
1.3 KiB
Makefile
export HOST=ai
|
|
|
|
# 运行本地开发环境(使用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 ${HOST} -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 ai -L 3306:localhost:3306 -L 19530:localhost:19530 -L 4080:localhost:4080 -L 5002:localhost:5002 -L 4306:localhost:4306
|
|
|
|
# 编译项目
|
|
build:
|
|
go mod tidy
|
|
go build -o dist/main bin/main.go
|
|
|
|
# 更新部署到服务器(生产和测试)
|
|
update: build
|
|
scp dist/main $(HOST):~/webp/main_new
|
|
ssh ${HOST} "mv ~/webp/main ~/webp/main_old"
|
|
ssh ${HOST} "mv ~/webp/main_new ~/webp/main"
|
|
ssh ${HOST} "rm ~/webp/main_old"
|
|
rm -rf dist
|
|
|
|
# 设为系统服务和设置日志轮转
|
|
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
|