Open rupertqin opened 9 years ago
#!/bin/sh
proname="ipinmobile"
echo '删除link'
./bin/linkdev rm
echo '获取本地库'
npm install --loglevel http
echo "开始打包..."
selfpath=$(cd "$(dirname "$0")"; pwd)
cd $selfpath/../
tar -cjf tar/$proname.tar.gz bin/ conf/ node_modules/ src/ package.json server.js app.js > /dev/null
echo "项目打包完成 tar/$proname.tar.gz"
echo "还原开发本地环境"
./bin/linkdev
echo "upload to 192.168.1.30 ~/node/ipinmobile/"
scp tar/ipinmobile.tar.gz ipin@192.168.1.30:~/node/ipinmobile/
echo "login test machine"
ssh ipin@192.168.1.30
echo "go back screen: ipinmobile"
screen -r ipinmobile
echo "unpress file"
tar -xvf ipinmobile.tar.gz
echo "run server"
./bin/node server.js
{"login": "http://192.168.1.12:4041/+login", "resultlog": "http://192.168.1.12:4041/+tests"}
sudo pip install virtualenv==1.11.2
./bin/buildout
在测试机别忘了重启:
./bin/reuwsgi
http://www.worldhello.net/2010/12/08/2178.html
mongo --host 192.168.1.83
#!/bin/sh
# Colors
COLOR_OFF="\033[0m" # unsets color to term fg color
RED="\033[0;31m" # red
GREEN="\033[0;32m" # green
YELLOW="\033[0;33m" # yellow
MAGENTA="\033[0;35m" # magenta
CYAN="\033[0;36m" # cyan
DEPLOY_USER="ipin"
STAGING_SERVER="192.168.1.33"
# This directory should contain:
# - `current` directory: contains your git repository
# - `shared` directory: can contain shared files and folders
STAGING_DIR="~/web/app/ipinweb"
STAGING_SSH_PORT=22
PRODUCTION_SERVER="example.com"
# This directory should contain:
# - `current` directory: contains your git repository
# - `shared` directory: can contain shared files and folders
PRODUCTION_DIR="/apps/production/example.com"
PRODUCTION_SSH_PORT=22
case $1 in
staging)
./bin/tar
echo "\n${GREEN}DEPLOYING APP TO PRODUCTION${COLOR_OFF}\n"
scp tar/ipinweb.tar.gz ipin@$STAGING_SERVER:$STAGING_DIR
echo "\n${GREEN} login remote ${COLOR_OFF}\n"
ssh $DEPLOY_USER@$STAGING_SERVER "cd $STAGING_DIR &&\
echo "\n${GREEN} extrac files ${COLOR_OFF}\n"
tar -xvf ipinweb.tar.gz &&\
./bin/reuwsgi
"
;;
production)
echo "\n${GREEN}DEPLOYING APP TO PRODUCTION${COLOR_OFF}\n"
# Deploys origin/production to production_server
old_revision=`git rev-parse origin/production`
tag_production
new_revision=`git rev-parse origin/production`
deploy_production
echo "\n${CYAN}APP DEPLOYED!${COLOR_OFF}\n"
;;
restart_workers)
echo "\n${GREEN}RESTARTING PRODUCTION WORKERS${COLOR_OFF}\n"
restart_production_workers
echo "\n${CYAN}WORKERS RESTARTED!${COLOR_OFF}\n"
;;
current)
environment=$2
if [ -e $2 ]; then
environment="production"
fi
deployed_commit=`git rev-parse origin/$environment 2>/dev/null`
if [[ "$deployed_commit" == *origin/* ]]; then
echo "$environment: Nothing deployed"
else
echo "$environment: Deployed hash $deployed_commit"
fi
;;
*)
echo "USAGE: $0 {staging|production|current|restart_workers}"
exit
;;
esac
/etc/nginx/sites-available/
ipin-test test@ipin.com
linux screen 命令详解