Add setup logs
This commit is contained in:
parent
37664ef3eb
commit
60e3611c73
4 changed files with 128 additions and 12 deletions
|
@ -1,18 +1,53 @@
|
||||||
VERSION=5.0
|
VERSION=5.0
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
apt updates and upgrades
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
apt update && apt upgrade -y
|
apt update && apt upgrade -y
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install basis softwares
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
apt install -y curl wget gnupg apt-transport-https lsb-release ca-certificates
|
apt install -y curl wget gnupg apt-transport-https lsb-release ca-certificates
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install Node.js
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# Node.js
|
# Node.js
|
||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||||
sudo apt-get update && sudo apt-get install nodejs -y
|
sudo apt-get update && sudo apt-get install nodejs -y
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install PostgreSQL
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# PostgreSQL
|
# PostgreSQL
|
||||||
wget -O /usr/share/keyrings/postgresql.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
wget -O /usr/share/keyrings/postgresql.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||||
echo "deb [signed-by=/usr/share/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgresql.list
|
echo "deb [signed-by=/usr/share/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgresql.list
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# 必要なパッケージをまとめてインストール
|
# 必要なパッケージをまとめてインストール
|
||||||
apt update
|
apt update
|
||||||
apt install -y \
|
apt install -y \
|
||||||
|
@ -23,21 +58,58 @@ apt install -y \
|
||||||
nginx redis-server redis-tools postgresql postgresql-contrib \
|
nginx redis-server redis-tools postgresql postgresql-contrib \
|
||||||
certbot python3-certbot-nginx libidn11-dev libicu-dev libjemalloc-dev
|
certbot python3-certbot-nginx libidn11-dev libicu-dev libjemalloc-dev
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Initialize yarn
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
corepack enable
|
corepack enable
|
||||||
yarn set version classic
|
yarn set version classic
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install requested package
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# Mastodonパッケージにもnode-gypは入ってるけど、npmのほうからグローバルにインストールしないと
|
# Mastodonパッケージにもnode-gypは入ってるけど、npmのほうからグローバルにインストールしないと
|
||||||
# yarn installで一部のOptionalパッケージインストール時にエラーが出てしまう様子
|
# yarn installで一部のOptionalパッケージインストール時にエラーが出てしまう様子
|
||||||
npm i -g node-gyp
|
npm i -g node-gyp
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Add mastodon user
|
||||||
|
|
||||||
|
Input user information (No need to type)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# mastodonユーザーを追加
|
# mastodonユーザーを追加
|
||||||
adduser --disabled-login mastodon
|
adduser --disabled-login mastodon
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Create PostgreSQL mastodon user
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# PostgreSQLにmastodonユーザーを追加
|
# PostgreSQLにmastodonユーザーを追加
|
||||||
sudo -u postgres psql << EOF
|
sudo -u postgres psql << EOF
|
||||||
CREATE USER mastodon WITH PASSWORD 'ohagi' CREATEDB;
|
CREATE USER mastodon WITH PASSWORD 'ohagi' CREATEDB;
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Download kmyblue
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# kmyblueソースコードをダウンロード
|
# kmyblueソースコードをダウンロード
|
||||||
# 続きのシェルスクリプトをgit管理外にコピーし権限を与える
|
# 続きのシェルスクリプトをgit管理外にコピーし権限を与える
|
||||||
su - mastodon <<EOF
|
su - mastodon <<EOF
|
||||||
|
@ -60,4 +132,9 @@ Input this command to continue setup:
|
||||||
sudo su - mastodon
|
sudo su - mastodon
|
||||||
./setup2.sh
|
./setup2.sh
|
||||||
|
|
||||||
|
./setup2.sh parameters (kmyblue version selection):
|
||||||
|
./setup2.sh -- LTS
|
||||||
|
./setup2.sh newest -- Newest version
|
||||||
|
./setup2.sh debug -- [Deprecated] Newest commit
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
cd ~/live
|
cd ~/live
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 2] ======================
|
||||||
|
Checkout tag on kmyblue repository
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# kmyblueの最新タグを取り込む
|
# kmyblueの最新タグを取り込む
|
||||||
if [ "$1" == "debug" ]; then
|
if [ "$1" == "debug" ]; then
|
||||||
echo 'DEBUG'
|
echo 'DEBUG'
|
||||||
|
@ -10,6 +17,13 @@ else
|
||||||
git checkout $(git tag -l | grep -E '^kb[0-9].*lts$' | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
|
git checkout $(git tag -l | grep -E '^kb[0-9].*lts$' | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 2] ======================
|
||||||
|
Install rbenv to control Ruby versions
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# Rubyバージョン管理用のrbenvをインストール、初期設定
|
# Rubyバージョン管理用のrbenvをインストール、初期設定
|
||||||
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
||||||
cd ~/.rbenv && src/configure && make -C src
|
cd ~/.rbenv && src/configure && make -C src
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 3] ======================
|
||||||
|
Copy setting files and services
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
# これを設定しておかないと、Web表示時にNginxがPermission Errorを起こす
|
# これを設定しておかないと、Web表示時にNginxがPermission Errorを起こす
|
||||||
chmod o+x /home/mastodon
|
chmod o+x /home/mastodon
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,41 @@
|
||||||
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install Ruby
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
||||||
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.2
|
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.2
|
||||||
rbenv global 3.2.2
|
rbenv global 3.2.2
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install Ruby bundler
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
gem install bundler --no-document
|
gem install bundler --no-document
|
||||||
|
|
||||||
cd ~/live
|
cd ~/live
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install yarn packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
yarn install --pure-lockfile
|
yarn install --pure-lockfile
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install bundle packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
bundle config deployment 'true'
|
bundle config deployment 'true'
|
||||||
bundle config without 'development test'
|
bundle config without 'development test'
|
||||||
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||||
|
@ -33,22 +60,13 @@ PostgreSQL and Redis are now available on localhost.
|
||||||
|
|
||||||
* Redis
|
* Redis
|
||||||
host : localhost
|
host : localhost
|
||||||
|
password is empty
|
||||||
|
|
||||||
[IMPORTANT] Check PostgreSQL password before setup!
|
[IMPORTANT] Check PostgreSQL password before setup!
|
||||||
|
|
||||||
Input this command to finish setup:
|
Input this command to finish setup:
|
||||||
|
cd live
|
||||||
RAILS_ENV=production bundle exec rake mastodon:setup
|
RAILS_ENV=production bundle exec rake mastodon:setup
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# パスワード変更
|
|
||||||
# sudo -u postgres psql << EOF
|
|
||||||
# ALTER USER mastodon WITH PASSWORD 'ohagi';
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
# サーバー設定変更
|
|
||||||
# sudo vi /etc/nginx/sites-available/mastodon
|
|
||||||
|
|
||||||
# サーバー起動・OS起動時自動起動設定
|
|
||||||
# systemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue