This commit is contained in:
Zoey Mae 2019-02-01 12:18:24 -05:00
parent fc594e3469
commit 0d4562d6b8

View file

@ -4,17 +4,32 @@
# setupmasto.sh v0.1
#
# This script will do everything necessary to download and install a dev Mastodon instance.
# No user interaction required :3
# No user interaction required except when updating gem
#
# Currently only tested on a fresh Debian Stretch install
# Currently only tested on Debian Stretch and Ubuntu Cosmic
###
function installDeps {
# install curl
sudo apt install curl --no-install-recommends -y
#MASTO_REPO=https://github.com/tootsuite/mastodon
MASTO_REPO=https://github.com/glitch-soc/mastodon
MASTO_PATH=$HOME/mastodon-dev
# setup node and yarn repos
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
# get os info for proper dep installation
. /etc/os-release
function installDebDeps {
# install curl
sudo apt install curl gnupg --no-install-recommends -y
# setup node repo if not running ubuntu
if [ $NAME == "Ubuntu" ]
then
echo "Skipping node repos since it's uneccessary on this OS"
else
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
fi
# setup yarn repo
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
@ -32,15 +47,16 @@ function installDeps {
function installRuby {
# setup rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv
cd $HOME/.rbenv && src/configure && make -C src
# add rubyenv to bashrc
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bashrc
echo 'eval "$(rbenv init -)"' >> /.bashrc
# refresh env
source ~/.bashrc
# apply env
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# install ruby-build
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
@ -50,16 +66,16 @@ function installRuby {
rbenv global 2.6.0
}
function installMastodon{
function installMastodon {
# create database user
echo "CREATE USER $(whoami) CREATEDB;" | sudo -u postgres psql
# clone glitch-soc
git clone https://github.com/glitch-soc/mastodon.git ~/mastodon-dev
cd ~/mastodon-dev
git clone $MASTO_REPO $MASTO_PATH
cd $MASTO_PATH
# cpdate gem
gem update --system
# update gem
printf 'y\n' | gem update --system
# install ruby and nodejs deps
gem install bundler
@ -71,9 +87,9 @@ function installMastodon{
bundle exec rails db:setup
}
installDeps()
installRuby()
installMastodon()
installDebDeps
installRuby
installMastodon
# Done!
echo "Setup done! Run 'foreman start' to start sidekiq, streaming, web, and webpack