forked from isucon/isucon12-final
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
36 lines (27 loc) · 1 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
set -eu
APP_HOME=/home/isucon/webapp
# log rotation
sudo mv /var/log/nginx/access.log /var/log/nginx/access.log.`date +%Y%m%d%H%M%S`
sudo nginx -s reopen
if [ -e /tmp/mysql-slow.log ]; then
sudo cp /tmp/mysql-slow.log /var/log/mysql/slowquery.log.`date +%Y%m%d%H%M%S`
fi
# NOTE: chown root /tmp/mysql-slow.logしたら動いた
sudo truncate -s 0 /tmp/mysql-slow.log
BRANCH=${1:-main}
git fetch origin $BRANCH
git switch $BRANCH
git pull origin $BRANCH
# app
cd webapp/go
/home/isucon/local/golang/bin/go build -o isuconquest .
mv isuconquest ${APP_HOME}/go/isuconquest
cd -
cp ./webapp/sql/init.sh ${APP_HOME}/sql/init.sh
cp ./webapp/sql/3_schema_exclude_user_presents.sql ${APP_HOME}/sql/3_schema_exclude_user_presents.sql
cp ./webapp/sql/4_alldata_exclude_user_presents* ${APP_HOME}/sql/
cp ./webapp/sql/5_user_presents_not_receive_data* ${APP_HOME}/sql/
cp ./provisioning/packer/ansible/roles/xbuild/files/home/isucon/env /home/isucon/env
sudo systemctl restart isuconquest.go.service
echo "success!"