-
-
Save totetotetotem/0b9685f72f4cd8cd11d824a898b24a9a to your computer and use it in GitHub Desktop.
isucon7 init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app_path=/home/isucon/webapp/go | |
app_name=isu- | |
#!/bin/bash | |
yes | sudo apt-get upgrade | |
yes | sudo apt-get install vim | |
yes | sudo apt-get install git | |
yes | sudo apt-get install redis-server | |
yes | sudo apt-get install unzip | |
#鍵の書き込み | |
mv isucon_git_key ~/.ssh/ | |
chmod 600 ~/.ssh/isucon_git_key | |
cat << EOF >> ~/.ssh/config | |
Host github github.com | |
HostName github.com | |
IdentityFile ~/.ssh/isucon_git_key | |
User git | |
EOF | |
#gitの設定 | |
git config --global core.editor 'vim' | |
git config --global color.diff auto | |
git config --global color.status auto | |
git config --global color.branch auto | |
git config --global alias.st status | |
git config --global alias.br branch | |
git config --global alias.co checkout | |
git config --global alias.sm 'submodule update --init --recursive' | |
git config --global alias.graph 'log --graph --date=short --decorate=short --pretty=format' | |
git config --global user.email "kyarioka7945@gmail.com" | |
git config --global user.name "totetotetotem" | |
# alp install | |
curl -L -O https://github.com/tkuchiki/alp/releases/download/v0.3.1/alp_linux_amd64.zip | |
unzip alp_linux_amd64.zip | |
sudo mv alp /usr/local/bin/alp | |
# tmpdir create | |
echo "d /var/run/webapp 0777 isucon isucon -" |sudo tee /etc/tmpfiles.d/webapp.conf | |
sudo systemd-tmpfiles --create /etc/tmpfiles.d/webapp.conf | |
sudo systemctl daemon-reload | |
#configフォルダの生成 | |
mkdir ${app_path}/config | |
sudo mv /etc/nginx/nginx.conf ${app_path}/config/nginx.conf | |
sudo ln -s ${app_path}/config/nginx.conf /etc/nginx/ | |
sudo mv /etc/nginx/sites-enabled ${app_path}/config/ | |
sudo ln -s ${app_path}/config/sites-enabled /etc/nginx/sites-enabled | |
sudo mv /etc/nginx/sites-available ${app_path}/config/ | |
sudo ln -s ${app_path}/config/sites-available /etc/nginx/sites-available | |
# sudo mv /etc/mysql/my.cnf ${app_path}/config/my.cnf | |
# sudo ln -s ${app_path}/config/my.cnf /etc/mysql/my.cnf | |
sudo mv /etc/mysql/mysql.conf.d/mysqld.cnf ${app_path}/config/mysqld.cnf | |
sudo ln -s ${app_path}/config/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf | |
sudo mv /etc/security/limits.conf ${app_path}/config/limits.conf | |
sudo ln -s ${app_path}/config/limits.conf /etc/security/limits.conf | |
sudo mv /etc/sysctl.conf ${app_path}/config/sysctl.conf | |
sudo ln -s ${app_path}/config/sysctl.conf /etc/sysctl.conf | |
sudo mv /etc/redis/redis.conf ${app_path}/config/redis.conf | |
sudo ln -s ${app_path}/config/redis.conf /etc/redis/redis.conf | |
sudo chmod 644 ${app_path}/config/redis.conf | |
sudo mv /etc/system.d/system/${app_name}go.service ${app_oath}/config/${app_name}go.service | |
sudo ln -s ${app_oath}/config/${app_name}go.service /etc/system.d/system/${app_name}go.service | |
# initialize to git | |
cd ${app_path} | |
git init | |
yes | git remote add origin git@github.com:siquare/sign-of-horns.git | |
yes | git pull origin master | |
git add . | |
git commit -m "initial commit" | |
yes | git push origin master | |
# redigo | |
go get github.com/garyburd/redigo/redis | |
# 自動起動設定 | |
sudo systemctl disable ${app_name}ruby | |
sudo systemctl stop ${app_name}ruby | |
sudo systemctl enable ${app_name}go | |
sudo systemctl restart ${app_name}go | |
yes | sudo apt install emacs & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my.cnf は元からリンクだったためgitで管理できなかった