|
@@ -1,4 +1,9 @@
|
|
|
-BINARY="build/iot_service"
|
|
|
+
|
|
|
+APP_NAME="iot_service"
|
|
|
+
|
|
|
+SERVER_PATH="/opt/lc/iot_svr/"
|
|
|
+
|
|
|
+BINARY="build/${APP_NAME}"
|
|
|
VERSION=1.0.0
|
|
|
export GOARCH=amd64
|
|
|
export GOOS=linux
|
|
@@ -10,12 +15,18 @@ clear:
|
|
|
build:
|
|
|
@go build -o ${BINARY} ./
|
|
|
|
|
|
+
|
|
|
push-test:clear build
|
|
|
- @$(push_test)
|
|
|
-.PHONY: build push-test
|
|
|
+ @$(call pushServer,"110.40.223.170")
|
|
|
+
|
|
|
+
|
|
|
+push-pro:clear build
|
|
|
+
|
|
|
+
|
|
|
+.PHONY: build push-test push-pro
|
|
|
|
|
|
-define push_test
|
|
|
- ssh root@110.40.223.170 "service go-iot_service stop;/usr/bin/rm -rf /opt/lc/iot_svr/iot_service"
|
|
|
- scp -r build/* root@110.40.223.170:/opt/lc/iot_svr/
|
|
|
- ssh root@110.40.223.170 "chmod +x /opt/lc/iot_svr/iot_service;service go-iot_service start;sleep 3;service go-iot_service status"
|
|
|
+define pushServer
|
|
|
+ ssh root@$(1) "service go-${APP_NAME} stop;"
|
|
|
+ scp -r build/* root@$(1):${SERVER_PATH}
|
|
|
+ ssh root@$(1) "chmod +x ${SERVER_PATH}${APP_NAME};service go-${APP_NAME} start;sleep 3;service go-${APP_NAME} status"
|
|
|
endef
|