forked from 54sword/admin.xiaoduyu.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,5 @@ dist | |
package-lock.json | ||
config/index.js | ||
config/index_*.js | ||
/install-and-startup.sh | ||
/update.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
echo "开始执行安装脚本..." | ||
|
||
# 登陆的服务器 | ||
SERVER='root@你的服务器ip地址' | ||
|
||
# 本地项目需要上传的文件 | ||
LOCAL_DIR=` | ||
find $(pwd)/* \( -path $(pwd)/node_modules -prune \) -o \( -path $(pwd)/.git -prune \) -o \( -type d -maxdepth 0 -print \); | ||
find $(pwd)/* -type f -maxdepth 0 -print; | ||
find $(pwd)/.babelrc; | ||
` | ||
# 项目端口号 | ||
PM2_NAME="admin.xiaoduyu.com" | ||
|
||
# 上传到服务器的目录地址 | ||
UPLOAD_TO_SERVER_DIR="/home/app/$PM2_NAME" | ||
|
||
# 服务器运行命令 | ||
COMMAND=" | ||
cd $UPLOAD_TO_SERVER_DIR && npm install && NODE_ENV=production __NODE__=true BABEL_ENV=server pm2 start src/server --name '$PM2_NAME' --max-memory-restart 400M; | ||
" | ||
|
||
#################### | ||
|
||
echo "创建项目文件夹" | ||
ssh ${SERVER} "mkdir $UPLOAD_TO_SERVER_DIR" | ||
|
||
echo "脚本开始执行,上传项目文件中..." | ||
scp -r ${LOCAL_DIR} ${SERVER}:${UPLOAD_TO_SERVER_DIR} | ||
|
||
echo "安装依赖,并启动项目中..." | ||
ssh ${SERVER} ${COMMAND} | ||
|
||
echo "完成" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
echo "开始执行更新脚本..." | ||
|
||
# 登陆的服务器 | ||
SERVER='root@你的服务器ip地址' | ||
|
||
# 本地项目需要上传的文件 | ||
LOCAL_DIR=` | ||
find $(pwd)/* \( -path $(pwd)/node_modules -prune \) -o \( -path $(pwd)/.git -prune \) -o \( -type d -maxdepth 0 -print \); | ||
find $(pwd)/* -type f -maxdepth 0 -print; | ||
find $(pwd)/.babelrc; | ||
` | ||
|
||
PM2_NAME="admin.xiaoduyu.com" | ||
|
||
# 上传到服务器的目录地址 | ||
UPLOAD_TO_SERVER_DIR="/home/app/$PM2_NAME" | ||
|
||
# 服务器运行命令 | ||
COMMAND="pm2 restart $PM2_NAME" | ||
|
||
echo "上传项目文件中..." | ||
scp -r ${LOCAL_DIR} ${SERVER}:${UPLOAD_TO_SERVER_DIR} | ||
|
||
echo "重启项目中..." | ||
ssh ${SERVER} ${COMMAND} | ||
|
||
echo "完成" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters