Files
org-roamings/20220927123818-mastodon.org

87 lines
3.0 KiB
Org Mode
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:PROPERTIES:
:ID: 056e86ae-99ad-45c6-be11-fe6582028870
:mtime: 20221229104009
:ctime: 20220927123818
:END:
#+title: mastodon
* Introduction
Service de microblogging open-source et décentalisée.
* Installation
#+BEGIN_SRC shell
# 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 its 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
#+END_SRC
#+BEGIN_SRC sql
CREATE USER mastodon CREATEDB;
#+END_SRC
#+BEGIN_SRC shell
# 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
#+END_SRC
#+BEGIN_SRC shell
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
#+END_SRC
* Références
* [[https://docs.joinmastodon.org/admin/install/][Installing from source - Mastodon documentation]]