Update and move scripts
This commit is contained in:
parent
8b6e65d6fe
commit
7744b2a1ce
4 changed files with 10 additions and 9 deletions
59
install/5.0/setup1.sh
Normal file
59
install/5.0/setup1.sh
Normal file
|
@ -0,0 +1,59 @@
|
|||
VERSION=5.0
|
||||
|
||||
apt update && apt upgrade -y
|
||||
|
||||
apt install -y curl wget gnupg apt-transport-https lsb-release ca-certificates
|
||||
|
||||
# Node.js
|
||||
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
|
||||
sudo apt-get update && sudo apt-get install nodejs -y
|
||||
|
||||
# PostgreSQL
|
||||
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
|
||||
|
||||
# 必要なパッケージをまとめてインストール
|
||||
apt update
|
||||
apt install -y \
|
||||
imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core \
|
||||
g++ libprotobuf-dev protobuf-compiler pkg-config nodejs gcc autoconf \
|
||||
bison build-essential libssl-dev libyaml-dev libreadline6-dev \
|
||||
zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \
|
||||
nginx redis-server redis-tools postgresql postgresql-contrib \
|
||||
certbot python3-certbot-nginx libidn11-dev libicu-dev libjemalloc-dev
|
||||
|
||||
corepack enable
|
||||
yarn set version classic
|
||||
|
||||
# mastodonユーザーを追加
|
||||
adduser --disabled-login mastodon
|
||||
|
||||
# PostgreSQLにmastodonユーザーを追加
|
||||
sudo -u postgres psql << EOF
|
||||
CREATE USER mastodon WITH PASSWORD 'ohagi' CREATEDB;
|
||||
EOF
|
||||
|
||||
# kmyblueソースコードをダウンロード
|
||||
# 続きのシェルスクリプトをgit管理外にコピーし権限を与える
|
||||
su - mastodon <<EOF
|
||||
git clone https://github.com/kmycode/mastodon.git live
|
||||
cp /home/mastodon/live/install/$VERSION/setup2.sh /home/mastodon/setup2.sh
|
||||
cp /home/mastodon/live/install/$VERSION/setup3.sh /home/mastodon/setup3.sh
|
||||
cp /home/mastodon/live/install/$VERSION/setup4.sh /home/mastodon/setup4.sh
|
||||
chmod +x /home/mastodon/setup2.sh
|
||||
chmod +x /home/mastodon/setup3.sh
|
||||
chmod +x /home/mastodon/setup4.sh
|
||||
EOF
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
||||
cat << EOF
|
||||
|
||||
============== [kmyblue setup script 1 completed] ================
|
||||
|
||||
Input this command to continue setup:
|
||||
sudo su - mastodon
|
||||
./setup2.sh
|
||||
|
||||
EOF
|
29
install/5.0/setup2.sh
Normal file
29
install/5.0/setup2.sh
Normal file
|
@ -0,0 +1,29 @@
|
|||
cd ~/live
|
||||
|
||||
# kmyblueの最新タグを取り込む
|
||||
if [ "$1" == "debug" ]; then
|
||||
elif [ "$1" == "newest" ]; then
|
||||
git checkout $(git tag -l | grep -E '^kb[0-9]' | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
|
||||
else
|
||||
# LTS
|
||||
git checkout $(git tag -l | grep -E '^kb[0-9].*lts$' | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
|
||||
fi
|
||||
|
||||
# Rubyバージョン管理用のrbenvをインストール、初期設定
|
||||
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
||||
cd ~/.rbenv && src/configure && make -C src
|
||||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
|
||||
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
||||
cat << EOF
|
||||
|
||||
============== [kmyblue setup script 2 completed] ================
|
||||
|
||||
Input this command to continue setup:
|
||||
exec bash
|
||||
exit
|
||||
sudo /home/mastodon/setup3.sh
|
||||
|
||||
EOF
|
20
install/5.0/setup3.sh
Normal file
20
install/5.0/setup3.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
# これを設定しておかないと、Web表示時にNginxがPermission Errorを起こす
|
||||
chmod o+x /home/mastodon
|
||||
|
||||
# 必要なファイルをコピー
|
||||
cp /home/mastodon/live/dist/nginx.conf /etc/nginx/sites-available/mastodon
|
||||
ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon
|
||||
cp /home/mastodon/live/dist/mastodon-*.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
||||
cat << EOF
|
||||
|
||||
============== [kmyblue setup script 3 completed] ================
|
||||
|
||||
Input this command to continue setup:
|
||||
sudo su - mastodon
|
||||
./setup4.sh
|
||||
|
||||
EOF
|
54
install/5.0/setup4.sh
Normal file
54
install/5.0/setup4.sh
Normal file
|
@ -0,0 +1,54 @@
|
|||
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
||||
|
||||
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.2
|
||||
rbenv global 3.2.2
|
||||
|
||||
gem install bundler --no-document
|
||||
|
||||
cd ~/live
|
||||
|
||||
yarn install --pure-lockfile
|
||||
|
||||
bundle config deployment 'true'
|
||||
bundle config without 'development test'
|
||||
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
rm ~/setup2.sh
|
||||
rm ~/setup3.sh
|
||||
rm ~/setup4.sh
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
||||
cat << EOF
|
||||
|
||||
============== [kmyblue setup script 4 completed] ================
|
||||
|
||||
PostgreSQL and Redis are now available on localhost.
|
||||
|
||||
* PostgreSQL
|
||||
host : /var/run/postgresql
|
||||
user : mastodon
|
||||
database : mastodon_production
|
||||
password : ohagi
|
||||
|
||||
* Redis
|
||||
host : localhost
|
||||
|
||||
[IMPORTANT] Check PostgreSQL password before setup!
|
||||
|
||||
Input this command to finish setup:
|
||||
RAILS_ENV=production bundle exec rake mastodon:setup
|
||||
|
||||
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