#!/bin/bash while true do read -r -p "Would you like to install Mastodon? [Y/n] " input case $input in [yY][eE][sS]|[yY]) break ;; [nN][oO]|[nN]) break ;; *) echo "That wasn't an option..." ;; esac done curl -sL https://deb.nodesource.com/setup_16.x | bash - apt-get install nodejs -y curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list apt-get update -y apt-get install yarn -y apt-get install postgresql postgresql-contrib -y su - postgres psql CREATE USER mastodon CREATEDB; exit adduser --disabled-login --gecos 'Mastodon Server' mastodon su - mastodon 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 exec bash git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build\ RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.0.3 rbenv global 3.0.3 gem update --system gem install bundler --no-document su - mastodon git clone https://github.com/tootsuite/mastodon.git ~/live cd ~/live bundle config deployment 'true' bundle config without 'development test' bundle install -j$(getconf _NPROCESSORS_ONLN) yarn install --pure-lockfile RAILS_ENV=production bundle exec rake mastodon:setup exit cp /home/mastodon/live/dist/mastodon-web.service /etc/systemd/system/ cp /home/mastodon/live/dist/mastodon-sidekiq.service /etc/systemd/system/ cp /home/mastodon/live/dist/mastodon-streaming.service /etc/systemd/system/ systemctl start mastodon-web systemctl start mastodon-sidekiq systemctl start mastodon-streaming systemctl enable mastodon-web systemctl enable mastodon-sidekiq systemctl enable mastodon-streaming systemctl status mastodon-web mastodon-sidekiq mastodon-streaming