cleanup prod scripts

pull/83/head
Thibault Duplessis 2012-12-20 16:16:42 +01:00
parent b760f736af
commit bf5cbd7ea8
17 changed files with 40 additions and 141 deletions

View File

@ -1,3 +0,0 @@
#!/bin/sh
bin/play -Dcore.cron.enabled=false "compile"

View File

@ -1,20 +1,12 @@
#!/bin/sh
HTTP_PORT=9000
HTTP_ADDRESS="127.0.0.1"
JVM_OPTIONS="-Dconfig.file=conf/local.conf -Dhttp.port=$HTTP_PORT -Dhttp.address=$HTTP_ADDRESS"
LOG_FILE="logs/play.log"
PROD_URL="http://en.lichess.org"
JVM_OPTIONS="-Dconfig.file=conf/local.conf -Dhttp.port=9000"
lilalog () {
echo -e "\x1b[7m[lila]\x1b[0m $1"
}
wait_warmup () {
lilalog "Wait warmup"
sleep 3
}
curl_prod () {
lilalog "Test $PROD_URL"
curl -sL -w "%{http_code}" -o /dev/null "$PROD_URL"

View File

@ -1,4 +0,0 @@
#!/bin/sh
HTTP_PORT=9000
JVM_OPTIONS="-Dconfig.file=conf/local.conf -Dhttp.port=$HTTP_PORT"

View File

@ -9,18 +9,35 @@ fail () {
if [ -z $1 ]; then
fail
elif [ $1 = "main" ]; then
REMOTE="balrog"
REMOTE="hollie"
REMOTE_DIR="/home/lila"
bin/closure
elif [ $1 = "ai" ]; then
REMOTE="marty"
REMOTE_DIR="/home/lila3"
# elif [ $1 = "ai" ]; then
# REMOTE="marty"
# REMOTE_DIR="/home/lila3"
elif [ $1 = "local" ]; then
REMOTE="localhost"
REMOTE_DIR="/tmp/"
else
fail
fi
lilalog "Deploy to $1 server $REMOTE:$REMOTE_DIR"
APP_NAME=lila-1.0
bin/closure
bin/play dist
if [ $? != 0 ]; then
lilalog "Deploy canceled"
exit 1
fi
cd dist
rm -rf $APP_NAME
unzip $APP_NAME.zip
chmod +x $APP_NAME/start
cd ..
RSYNC_OPTIONS=" \
--archive \
--force \
@ -28,6 +45,18 @@ RSYNC_OPTIONS=" \
--progress \
--compress \
--checksum \
--exclude-from=bin/prod/rsync_exclude";
--exclude local.conf \
--exclude logs \
--exclude RUNNING_PID";
rsync $RSYNC_OPTIONS ./ $REMOTE:$REMOTE_DIR
lilalog "Rsync binaries, scripts and assets"
rsync $RSYNC_OPTIONS dist/$APP_NAME/* bin public $REMOTE:$REMOTE_DIR
lilalog "Restart lila"
ssh $REMOTE "service lila restart"
lilalog "Deploy complete"
sleep 2
curl_prod

View File

@ -1,58 +0,0 @@
#!/bin/sh
. bin/lilarc
fail () {
echo "Deploy main or ai"
exit 1
}
if [ -z $1 ]; then
fail
elif [ $1 = "main" ]; then
REMOTE="hollie"
REMOTE_DIR="/home/lila"
# elif [ $1 = "ai" ]; then
# REMOTE="marty"
# REMOTE_DIR="/home/lila3"
elif [ $1 = "local" ]; then
REMOTE="localhost"
REMOTE_DIR="/tmp/"
else
fail
fi
lilalog "Deploy to $1 server $REMOTE:$REMOTE_DIR"
APP_NAME=lila-1.0
bin/closure
bin/play dist
if [ $? != 0 ]; then
lilalog "Deploy canceled"
exit 1
fi
cd dist
rm -rf $APP_NAME
unzip $APP_NAME.zip
chmod +x $APP_NAME/start
cd ..
RSYNC_OPTIONS=" \
--archive \
--force \
--delete \
--progress \
--compress \
--checksum \
--exclude local.conf \
--exclude logs \
--exclude RUNNING_PID";
lilalog "Rsync binaries, scripts and assets"
rsync $RSYNC_OPTIONS dist/$APP_NAME/* bin public $REMOTE:$REMOTE_DIR
lilalog "Restart lila"
ssh $REMOTE "service lila restart"
lilalog "Deploy complete"

View File

@ -1,9 +0,0 @@
#!/bin/sh
. bin/lilarc
lilalog "Compile stage"
bin/play compile stage
bin/prod/stop
bin/prod/start
wait_warmup
curl_prod

View File

@ -1,7 +0,0 @@
#!/bin/sh
. bin/lilarc
bin/prod/stop
bin/prod/start
wait_warmup
curl_prod

View File

@ -1,14 +0,0 @@
conf/local.conf
bin/lilarc.local
logs
tags
project/project
project/target
target
serve/
data/
play/repository/
RUNNING_PID
data
.git*
.ctags

View File

@ -1,6 +0,0 @@
#!/bin/sh
. bin/lilarc
lilalog "Start application with $JVM_OPTIONS"
echo "" > $LOG_FILE
target/start $JVM_OPTIONS "$@" > $LOG_FILE &

View File

@ -1,6 +0,0 @@
#!/bin/sh
. bin/lilarc
bin/prod/start
wait_warmup
curl_prod

View File

@ -1,15 +0,0 @@
#!/bin/sh
. bin/lilarc
lilapid=$(cat RUNNING_PID)
lilalog "Running with pid $lilapid"
lilalog "Stop application"
kill $lilapid
rm RUNNING_PID
sleep 2
lilalog "Force kill in case port 9000 is still bound"
pkill -9 --echo --full "java -Dconfig.file=conf/local.conf -Dhttp.port=9000"

View File

@ -2,7 +2,7 @@
. bin/lilarc
URL=$PROD_URL
TIMEOUT=8 # Restart if it takes longer than that
TIMEOUT=10 # Restart if it takes longer than that
DELAY=20 # Check every delay
MSG="Connect to $URL in less than $TIMEOUT seconds"
@ -16,10 +16,10 @@ while true; do
if [[ $? != 0 ]]; then
lilalog "FAIL $MSG"
bin/prod/restart
service lila restart
elif [[ $code != 200 ]]; then
lilalog "CODE $code"
bin/prod/restart
service lila restart
else
echo -n "."
fi