正在显示
5 个修改的文件
包含
62 行增加
和
39 行删除
build.sh
0 → 100755
deploy.sh
0 → 100755
1 | +#!/bin/bash | ||
2 | + | ||
3 | +time=$(date +%Y%m%d_%H%m%s) | ||
4 | +project_name="ability" | ||
5 | +##部署脚本/文件路径 | ||
6 | +deploy_shell_path="/home/tiptok/test" | ||
7 | +##部署路径 | ||
8 | +project_root_path="/home/tiptok/www" | ||
9 | +project_path="${project_root_path}/${project_name}" | ||
10 | +##备份路径 | ||
11 | +project_bak_path="/home/tiptok/www/bin_bak" | ||
12 | + | ||
13 | +projcet_bak_file="${project_bak_path}/${time}_${project_name}.tar" | ||
14 | +project_gzip_file="${deploy_shell_path}/${project_name}.tar" | ||
15 | + | ||
16 | +echo "------begin deploy-------" | ||
17 | +echo "ProjectName: ${project_name}" | ||
18 | +echo "ProjectPath: ${project_path}" | ||
19 | +echo "ProjectBakFile : ${projcet_bak_file}" | ||
20 | +echo "ProjectGzipFile : ${project_gzip_file}" | ||
21 | + | ||
22 | +if [ ! -d ${project_bak_path} ];then | ||
23 | + mkdir -p ${project_bak_path} | ||
24 | + echo "mkdir ${project_bak_path}" | ||
25 | +fi | ||
26 | + | ||
27 | +if [ ! -d ${project_path} ];then | ||
28 | + mkdir -p ${project_path} | ||
29 | + echo "mkdir ${project_path}" | ||
30 | +else | ||
31 | + echo "backup : ${projcet_bak_file}" | ||
32 | + cd $project_path && tar -zcf ${projcet_bak_file} * ||(echo "backup failed"; exit 1) | ||
33 | + rm -fr "${project_path}/" * | ||
34 | +fi | ||
35 | + | ||
36 | +echo "------begin tar-------" | ||
37 | +if [ ! -e ${project_path} ];then | ||
38 | + mkdir -p ${project_path} | ||
39 | + echo "mkdir ${project_path}" | ||
40 | +fi | ||
41 | +if [ -f ${project_gzip_file} ];then | ||
42 | + tar -xzf ${project_gzip_file} -C "${project_root_path}/${project_name}"||(echo "tar -x failed"; exit 1) | ||
43 | + rm -fr ${project_gzip_file} | ||
44 | +else | ||
45 | + echo "project_gzip_file not exists! please upload zip file ..." | ||
46 | + exit 0 | ||
47 | +fi | ||
48 | + | ||
49 | +echo "------begin start-------" | ||
50 | +cd ${project_path} && ./start.sh ${project_name} | ||
51 | + | ||
52 | + |
@@ -34,6 +34,7 @@ func init() { | @@ -34,6 +34,7 @@ func init() { | ||
34 | //panic(err) | 34 | //panic(err) |
35 | } | 35 | } |
36 | orm.NewBeeormEngine(config.Mysql{ | 36 | orm.NewBeeormEngine(config.Mysql{ |
37 | + AliasName:"default", | ||
37 | DataSource: beego.AppConfig.String("data_source"), | 38 | DataSource: beego.AppConfig.String("data_source"), |
38 | MaxIdle: 100, | 39 | MaxIdle: 100, |
39 | MaxOpen: 100, | 40 | MaxOpen: 100, |
rollback.sh
已删除
100755 → 0
1 | -#!/bin/bash | ||
2 | - | ||
3 | -pwd=`pwd` | ||
4 | -target=`basename $pwd` | ||
5 | - | ||
6 | -# Kill running program | ||
7 | -pid=`ps -C ${target} -o pid=` | ||
8 | -if [ -n "$pid" ]; then | ||
9 | - | ||
10 | - echo "Stopping old version, PID: ${pid}" | ||
11 | - if [ "$1" = "-f" ]; then | ||
12 | - # force shutdown | ||
13 | - echo "Force shutdown..." | ||
14 | - kill $(ps -C ${target} -o pid=) | ||
15 | - else | ||
16 | - kill -s 2 $(ps -C ${target} -o pid=) | ||
17 | - fi | ||
18 | - | ||
19 | - # wait for program to stop | ||
20 | - pid=`ps -C ${target} -o pid=` | ||
21 | - while [ -n "$pid" ]; do | ||
22 | - sleep 1 | ||
23 | - done | ||
24 | -fi | ||
25 | - | ||
26 | -# Rollback | ||
27 | -if [ -f "${target}-backup" ]; then | ||
28 | - echo "Rolling back..." | ||
29 | - if [ -f "${target}" ]; then | ||
30 | - rm "${target}" | ||
31 | - fi | ||
32 | - mv ${target}-backup ${target} | ||
33 | - echo "Rollback Complete" | ||
34 | -fi | ||
35 | - | ||
36 | -# run | ||
37 | -echo "Starting..." | ||
38 | -./run.sh ${target} | ||
39 | -echo "Done" |
-
请 注册 或 登录 后发表评论