80 lines
1.4 KiB
Bash
Executable file
80 lines
1.4 KiB
Bash
Executable file
#!/bin/sh
|
|
. bin/lilarc
|
|
|
|
fail () {
|
|
echo "Deploy main or ai"
|
|
exit 1
|
|
}
|
|
|
|
mode=$1
|
|
if [ -z $mode ]; then
|
|
fail
|
|
elif [ $mode = "main" ]; then
|
|
REMOTE="hollie"
|
|
REMOTE_DIR="/home/lila5"
|
|
elif [ $mode = "paul" ]; then
|
|
REMOTE="paul"
|
|
REMOTE_DIR="/home/lila5"
|
|
elif [ $mode = "salim" ]; then
|
|
REMOTE="salim"
|
|
REMOTE_DIR="/home/lila5"
|
|
elif [ $mode = "local" ]; then
|
|
REMOTE="localhost"
|
|
REMOTE_DIR="/tmp/lila5"
|
|
else
|
|
fail
|
|
fi
|
|
|
|
lilalog "Deploy to $mode server $REMOTE:$REMOTE_DIR"
|
|
|
|
if [ $mode == "main" ]; then
|
|
lilalog "Notify users of pre deploy"
|
|
bin/cli-prod deploy pre
|
|
fi
|
|
|
|
if [ $mode == "main" ]; then
|
|
bin/closure
|
|
fi
|
|
|
|
sbt ";play;stage"
|
|
if [ $? != 0 ]; then
|
|
lilalog "Deploy canceled"
|
|
exit 1
|
|
fi
|
|
|
|
RSYNC_OPTIONS=" \
|
|
--archive \
|
|
--force \
|
|
--delete \
|
|
--progress \
|
|
--compress \
|
|
--checksum \
|
|
--verbose \
|
|
--exclude conf/application.conf \
|
|
--exclude logs \
|
|
--exclude RUNNING_PID \
|
|
--exclude bin/.translate_version";
|
|
|
|
lilalog "Rsync scripts, binaries and assets"
|
|
stage="target/universal/stage"
|
|
rsync_command="rsync $RSYNC_OPTIONS bin $stage/bin $stage/lib public $REMOTE:$REMOTE_DIR"
|
|
echo "$rsync_command"
|
|
$rsync_command
|
|
|
|
if [ $mode == "main" ]; then
|
|
lilalog "Notify users of post deploy"
|
|
bin/cli-prod deploy post
|
|
fi
|
|
|
|
if [ $mode != "local" ]; then
|
|
lilalog "Restart lila5"
|
|
ssh $REMOTE "service lila5 restart"
|
|
fi
|
|
|
|
lilalog "Deploy complete"
|
|
|
|
if [ $mode != "local" ]; then
|
|
sleep 2
|
|
curl_prod
|
|
fi
|