Skip to content

Commit 433d4c7

Browse files
committed
fab auto deploy
1 parent 11d065f commit 433d4c7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

fabfile.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- coding: utf-8 -*-
2+
from fabric.api import *
3+
from datetime import datetime
4+
5+
env.user = 'root'
6+
env.hosts = ['spring-abc.xyz:29244']
7+
shutdown = '../../bin/shutdown.sh'
8+
startup = '../../bin/startup.sh'
9+
target_classes_dir = './target/springabc'
10+
web_root_dir = '../../webapps/ROOT/'
11+
12+
def update():
13+
# 使用 ./ 表示当前目录
14+
local('git pull')
15+
16+
def install():
17+
local('mvn install -DskipTests')
18+
19+
def reboot():
20+
local(shutdown)
21+
local(startup)
22+
23+
def startup():
24+
local(startup)
25+
26+
def shutdown():
27+
local(shutdown)
28+
29+
def deploy():
30+
'''
31+
部署文件
32+
'''
33+
local(shutdown)
34+
install()
35+
36+
local('rm -rf %s* ' % web_root_dir)
37+
local('mv %s/* %s' % (target_classes_dir, web_root_dir))

0 commit comments

Comments
 (0)