Skip to content

Commit

Permalink
apply iptables drop command during deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Feb 8, 2018
1 parent d219ee8 commit 00ef3b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/prod/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,20 @@ fi
# ensure FS cache is ready before booting (slow hard drives)
FS_WARMUP="cat $REMOTE_DIR/lib/* > /dev/null && cat $REMOTE_DIR/bin/lila > /dev/null"

# start dropping packets. Run `bin/prod/iptables-drop 0` on the server to resume normal traffic.
START_DROPPING="$REMOTE_DIR/bin/prod/iptables-drop 0.999"

if [ $mode = "main" ]; then
lilalog "Restart lichess"
RUN_DIR="/home/lichess"
SSH_COMMAND="chown -R lichess:lichess $REMOTE_DIR && $FS_WARMUP && rm $RUN_DIR && ln -s $REMOTE_DIR $RUN_DIR && systemctl restart lichess"
SSH_COMMAND="$START_DROPPING && chown -R lichess:lichess $REMOTE_DIR && $FS_WARMUP && rm $RUN_DIR && ln -s $REMOTE_DIR $RUN_DIR && systemctl restart lichess"
echo $SSH_COMMAND
ssh $REMOTE $SSH_COMMAND
fi
if [ $mode = "stage" ]; then
lilalog "Restart lichess-stage"
SSH_COMMAND="chown -R lichess:lichess $REMOTE_DIR && $FS_WARMUP && systemctl restart lichess-stage"
STOP_DROPPING="$REMOTE_DIR/bin/prod/iptables-drop 0"
SSH_COMMAND="$START_DROPPING && chown -R lichess:lichess $REMOTE_DIR && $FS_WARMUP && systemctl restart lichess-stage && $STOP_DROPPING"
echo $SSH_COMMAND
ssh $REMOTE $SSH_COMMAND
fi
Expand Down

0 comments on commit 00ef3b2

Please sign in to comment.