Fix: セットアップスクリプトのyarn install
でエラーが出る (#292)
This commit is contained in:
parent
eda8dae5a7
commit
927e02e051
5 changed files with 365 additions and 0 deletions
82
install/9.0/setup-imagemagick-7.sh
Normal file
82
install/9.0/setup-imagemagick-7.sh
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================ [imagemagick 7 setup script] ====================
|
||||||
|
Remove old ImageMagick
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
apt remove -y imagemagick
|
||||||
|
apt autoremove -y
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================ [imagemagick 7 setup script] ====================
|
||||||
|
Download source
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick
|
||||||
|
cd ImageMagick
|
||||||
|
git checkout $(git tag -l | grep -E '^7' | sort -V | tail -n 1)
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================ [imagemagick 7 setup script] ====================
|
||||||
|
Install dependent packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
apt update
|
||||||
|
apt install -y \
|
||||||
|
libjpeg-dev libpng-dev libpng16-16 libltdl-dev libheif-dev libraw-dev libtiff-dev libopenjp2-tools \
|
||||||
|
libopenjp2-7-dev libjpeg-turbo-progs libfreetype6-dev libheif-dev libfreetype6-dev libopenexr-dev \
|
||||||
|
libwebp-dev libgif-dev
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================ [imagemagick 7 setup script] ====================
|
||||||
|
Configure
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
./configure --with-modules --enable-file-type --with-quantum-depth=32 --with-jpeg=yes --with-png=yes \
|
||||||
|
--with-gif=yes --with-webp=yes --with-heic=yes --with-raw=yes --with-tiff=yes --with-openjp2 \
|
||||||
|
--with-freetype=yes --with-webp=yes --with-openexr=yes --with-gslib=yes --with-gif=yes --with-perl=yes \
|
||||||
|
--with-jxl=yes
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================ [imagemagick 7 setup script] ====================
|
||||||
|
Make
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================ [imagemagick 7 setup script] ====================
|
||||||
|
Make install
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
make install
|
||||||
|
ldconfig /usr/local/lib
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
=========== [imagemagick 7 setup script completed] ===============
|
||||||
|
ImageMagick 7 setup is completed!
|
||||||
|
Please check AVIF format on your Mastodon.
|
||||||
|
|
||||||
|
To check ImageMagick version:
|
||||||
|
exec bash
|
||||||
|
convert -version
|
||||||
|
|
||||||
|
Or
|
||||||
|
sudo su - mastodon
|
||||||
|
convert -version
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
140
install/9.0/setup1.sh
Normal file
140
install/9.0/setup1.sh
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
VERSION=9.0
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
apt updates and upgrades
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install Node.js
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install PostgreSQL
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 必要なパッケージをまとめてインストール
|
||||||
|
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
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Initialize yarn
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
corepack enable
|
||||||
|
yarn set version classic
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Install requested package
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Mastodonパッケージにもnode-gypは入ってるけど、npmのほうからグローバルにインストールしないと
|
||||||
|
# yarn installで一部のOptionalパッケージインストール時にエラーが出てしまう様子
|
||||||
|
npm i -g node-gyp
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Add mastodon user
|
||||||
|
|
||||||
|
Input user information (No need to type)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# mastodonユーザーを追加
|
||||||
|
adduser --disabled-login mastodon
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Create PostgreSQL mastodon user
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# PostgreSQLにmastodonユーザーを追加
|
||||||
|
sudo -u postgres psql << EOF
|
||||||
|
CREATE USER mastodon WITH PASSWORD 'ohagi' CREATEDB;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 1] ======================
|
||||||
|
Download kmyblue
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
./setup2.sh parameters (kmyblue version selection):
|
||||||
|
./setup2.sh -- LTS
|
||||||
|
./setup2.sh latest -- Latest version
|
||||||
|
./setup2.sh debug -- [Deprecated] Newest commit
|
||||||
|
|
||||||
|
EOF
|
44
install/9.0/setup2.sh
Normal file
44
install/9.0/setup2.sh
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
cd ~/live
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 2] ======================
|
||||||
|
Checkout tag on kmyblue repository
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# kmyblueの最新タグを取り込む
|
||||||
|
if [ "$1" == "debug" ]; then
|
||||||
|
echo 'DEBUG'
|
||||||
|
elif [ "$1" == "newest" ] || [ "$1" == "latest" ]; 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
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 2] ======================
|
||||||
|
Install rbenv to control Ruby versions
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 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
|
27
install/9.0/setup3.sh
Normal file
27
install/9.0/setup3.sh
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 3] ======================
|
||||||
|
Copy setting files and services
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# これを設定しておかないと、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
|
72
install/9.0/setup4.sh
Normal file
72
install/9.0/setup4.sh
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
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
|
||||||
|
rbenv global 3.2.2
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install Ruby bundler
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
gem install bundler --no-document
|
||||||
|
|
||||||
|
cd ~/live
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install yarn packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
================== [kmyblue setup script 4] ======================
|
||||||
|
Install bundle packages
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
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
|
||||||
|
password is empty
|
||||||
|
|
||||||
|
[IMPORTANT] Check PostgreSQL password before setup!
|
||||||
|
|
||||||
|
Input this command to finish setup:
|
||||||
|
cd live
|
||||||
|
RAILS_ENV=production bundle exec rake mastodon:setup
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue