3.0 KiB
3.0 KiB
mastodon
Introduction
Service de microblogging open-source et décentalisée.
Installation
# Mastodon requires nodejs 16
sudo snap install node --classic
apt install 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
yarn set version stable
# We will be using rbenv to manage Ruby versions, because it’s easier to get the right versions and
# to update once a newer release comes out. rbenv must be installed for a single Linux user,
# therefore, first we must create the user Mastodon will be running as:
adduser --disabled-login mastodon
# The following command shall be run using root priviledges (sudo)
su - mastodon
# Proceed to install rbenv and rbenv-build:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
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 install bundler --no-document
exit
# Creating mastodon user in postgres
sudo -u postgres psql
CREATE USER mastodon CREATEDB;
# The following command shall be run using root priviledges (sudo)
su - mastodon
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash -
nvm install v16.17.1
npx browserslist@latest --update-db
git clone https://github.com/tootsuite/mastodon.git live && cd live
git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
sed -i 's/\([ ]*"emoji-mart": \)"[^"]*",/\1"^3.0.1",/' package.json
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/nginx.conf /etc/nginx/sites-available/mastodon
sed -i 's/example.com/mastodon.adrien.run/' /etc/nginx/sites-available/mastodon
sed -i 's/\([ ]*server 127.0.0.1\):3000/\1:3001/' /etc/nginx/sites-available/mastodon
sed -i 's/\# \(ssl_certificate[ ]*.*\)/\1/' /etc/nginx/sites-available/mastodon
certbot --nginx -d example.com
ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon
cp /home/mastodon/live/dist/mastodon-*.service /etc/systemd/system/
sed -i 's/\(Environment="PORT\)=3000/\1=3001/' /etc/systemd/system/mastodon-web.service
systemctl daemon-reload