39 lines
1,009 B
Bash
Executable file
39 lines
1,009 B
Bash
Executable file
#!/usr/bin/env bash
|
|
function installRuby {
|
|
# update rbenv
|
|
(cd $HOME/.rbenv && git pull && git submodule update --init --recursive)
|
|
|
|
rbMasto=`cat .ruby-version`
|
|
rbVersions=`rbenv versions`
|
|
|
|
# build and install ruby with jemalloc
|
|
if [[ *$rbMasto* == $rbVersions ]]; then
|
|
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install $rbMasto
|
|
fi
|
|
}
|
|
|
|
function installMastoDeps {
|
|
# create database user
|
|
echo "DROP DATABASE IF EXISTS mastodon_development;" | sudo -u postgres psql
|
|
echo "DROP DATABASE IF EXISTS mastodon_test;" | sudo -u postgres psql
|
|
|
|
# update gem
|
|
printf 'y\n' | gem update --system --no-document
|
|
|
|
# install ruby and nodejs deps
|
|
gem install bundler foreman --no-document
|
|
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
|
yarn install --pure-lockfile
|
|
|
|
# setup db
|
|
bundle exec rails db:setup
|
|
}
|
|
|
|
installRuby
|
|
installMastoDeps
|
|
|
|
# Done!
|
|
echo "Setup done! Run 'foreman start' to start sidekiq, streaming, web, and webpack
|
|
Username: admin@localhost:3000
|
|
Password: mastodonadmin"
|