Avancement dans les scripts d'installation de Mastodon

This commit is contained in:
2018-05-06 23:32:22 +02:00
parent fef3b00193
commit c1aebe3913
5 changed files with 72 additions and 15 deletions

View File

@@ -1,2 +1,4 @@
# https://anystack.xyz/how-to-install-mastodon-ubuntu/
#psql -c "CREATE USER admin WITH PASSWORD 'test101';" #psql -c "CREATE USER admin WITH PASSWORD 'test101';"
psql -c "CREATE USER mastodon CREATEDB;" psql -c "CREATE USER mastodon CREATEDB;" && exit 0
exit 200

View File

@@ -1,3 +1,4 @@
# https://anystack.xyz/how-to-install-mastodon-ubuntu/
#!/bin/bash #!/bin/bash
#set -x #set -x

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# https://anystack.xyz/how-to-install-mastodon-ubuntu/
set -x set -x
# Check if it is a Ubuntu host # Check if it is a Ubuntu host
@@ -16,26 +17,35 @@ fi
if true; then if true; then
adduser --disabled-password --disabled-login --gecos "" mastodon || exit 3 adduser --disabled-password --disabled-login --gecos "" mastodon || exit 3
chmod +r Install*.sh;chmod +x Install*.sh
cp Install-Mastodon-Phase3.sh Install-Mastodon-Phase4.sh /home/mastodon || exit 4 cp Install-Mastodon-Phase3.sh Install-Mastodon-Phase4.sh /home/mastodon || exit 4
chown -R mastodon /home/mastodon || exit 5 chown -R mastodon /home/mastodon || exit 5
chmod +x /home/mastodon/Install*.sh chmod +x /home/mastodon/Install*.sh
if [ -e ./Install-Mastodon-CreatePSQL-User.sh ] if [ -e ./Install-Mastodon-CreatePSQL-User.sh ]
then then
# Creation de l'utilisateur Postgresql postgres # Creation de l'utilisateur Postgresql postgres
su - postgres -C ./Install-Mastodon-CreatePSQL-User.sh || exit 6 cp -f Install-Mastodon-CreatePSQL-User.sh /tmp || exit 6
chmod 644 /tmp/Install*.sh
chmod +x /tmp/Install*.sh || exit 7
su - postgres -c /tmp/Install-Mastodon-CreatePSQL-User.sh || exit 8
rm -f /tmp/Install*.sh
else else
exit 7 exit 9
fi fi
fi fi
sed -i '/^local.*postgres.*peer$/a host all all 127.0.0.1/32 ident' /etc/postgresql/9.?/main/pg_hba.conf || exit 3 if true; then
apt-get -y install pidentd && sudo systemctl enable pidentd && sudo systemctl start pidentd || exit 4 sed -i '/^local.*postgres.*peer$/a host all all 127.0.0.1/32 ident' /etc/postgresql/9.?/main/pg_hba.conf || exit 10
systemctl restart postgresql || exit 5 apt-get -y install pidentd || exit 11
apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev || exit 6 systemctl enable pidentd || exit 12
apt-get install -y libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev || exit 7 systemctl start pidentd || exit 13
apt-get install -y libgdbm3 libgdbm-dev || exit 8 systemctl restart postgresql || exit 14
apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev || exit 15
apt-get install -y libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev || exit 16
apt-get install -y libgdbm3 libgdbm-dev || exit 17
fi
cp Install-Mastodon-Phase3.sh Install-Mastodon-Phase4.sh /home/mastodon || exit 10 if true; then
chown -R mastodon:mastodon /home/mastodon || exit 11 su - mastodon -c ./Install-Mastodon-Phase3.sh || exit 18
su - mastodon -C Install-Mastodon-Phase3.sh || exit 12 su - mastodon -c ./Install-Mastodon-Phase4.sh || exit 19
su - mastodon -C Install-Mastodon-Phase4.sh || exit 13 fi

View File

@@ -1,5 +1,9 @@
git clone https://github.com/rbenv/rbenv.git ~/.rbenv #!/bin/bash
# https://anystack.xyz/how-to-install-mastodon-ubuntu/
echo Phase 3: Preparation de l'environnement
git clone https://github.com/rbenv/rbenv.git ~/.rbenv || exit 101
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc source ~/.bashrc
exit exit 0

View File

@@ -0,0 +1,40 @@
#!/bin/bash
# Let's install ruby 2.5.0
echo Phase 4: Installation de Ruby
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build || exit 301
rbenv install 2.5.0 || exit 302
rbenv global 2.5.0 || exit 303
ruby -v
cd ~
git clone https://github.com/tootsuite/mastodon.git live || exit 304
cd live || exit 305
git checkout $(git tag | tail -n 1) || exit 306
echo "gem: --no-document" > ~/.gemrc || exit 307
gem install bundler --no-ri || exit 308
echo Launch the installation
bundle install --deployment --without development test || exit 309
yarn install || exit 310
cp .env.production.sample .env.production || exit 311
echo "# Service dependencies" >>.env.production
echo REDIS_HOST=localhost >>.env.production
echo REDIS_PORT=6379 >>.env.production
echo DB_HOST=/var/run/postgresql >>.env.production
echo DB_USER=mastodon >>.env.production
echo DB_NAME=mastodon_production >>.env.production
echo DB_PASS= >>.env.production
echo DB_PORT=5432 >>.env.production
echo "# E-mail configuration" >>.env.production
echo SMTP_SERVER=mail.yourdomain.com >>.env.production
echo SMTP_PORT=587 >>.env.production
echo SMTP_LOGIN=noreply@yourdomain.com >>.env.production
echo SMTP_PASSWORD=YourPassword >>.env.production
echo SMTP_FROM_ADDRESS=noreply@yourdomain.com >>.env.production
exit 0