User Tools

Site Tools


en:mastodon

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:mastodon [2024/02/10 11:05] domeleen:mastodon [2024/02/10 16:26] (current) domele
Line 15: Line 15:
  
 ===== Debian: ===== ===== Debian: =====
- 
- 
  
   * This will be a rapid and dirty Tutorial to gain the maximum afford.   * This will be a rapid and dirty Tutorial to gain the maximum afford.
 +  * Moreover i would suggest to install on the host apt-cacher-ng and add the the VM:
 +    * <code>  
   * I assume you use a fresh, not used System.   * I assume you use a fresh, not used System.
   * If we need to compile, we use ccache here to speed up due it might a 50/50 chance of a failure ;-)   * If we need to compile, we use ccache here to speed up due it might a 50/50 chance of a failure ;-)
 +  * I also assume that this is a VM/Container that is exclusivly used for this. So that in case of a Totale failure, you can restore from a Snapshot or Backup you have to be done, before you started
 +  * We Assume, you use Debian 12 - if you use i.e. debian 11 use this before:
 +    * <code>
 +      OLDDISTRI=bullseye
 +      sed -i 's/\$OLDDISTRI/bookworm/gi' /etc/apt/sources.list.d/*
 +      sed -i 's/\%OLDDISTRI/bookworm/gi' /etc/apt/*.list
 +
  
  
-====== Installing Pre-Requirements ======+===== Installing Pre-Requirements ======
  
   * <code>   * <code>
-apt -qy update +INSTALLPATH=/opt/mastodon 
-apt install -qy curl gnupg2 ca-certificates lsb-release debian-archive-keyring sudo \  +apt install -qy curl gnupg2 ca-certificates lsb-release debian-archive-keyring sudo git build-essential etckeeper  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 libgdbm3 libgdbm-dev nginx libidn11-dev libicu-dev ccache libgdm1 libgdm-dev patch rustc libgmp-dev libgdbm6 libdb-dev uuid-dev git nano iptables-persistent bison libncurses5-dev  
-git build-essential etckeeper  imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev \  + 
-file git-core g++ libprotobuf-dev protobuf-compiler pkg-config nodejs gcc autoconf \  +sudo curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null 
-bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev \  +sudo curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - 
-libncurses5-dev libffi-dev libgdbm3 libgdbm-dev nginx libidn11-dev \  +echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list 
-libicu-dev ccache libgdm1 libgdm-dev patch rustc libgmp-dev +curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg 
-libgdbm6 libdb-dev uuid-dev git nano+echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware" >/etc/apt/sources.list.d/backports.list 
 +echo "deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware" >>/etc/apt/sources.list.d/backports.list 
 +sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc 
 +sudo chmod a+r /etc/apt/keyrings/docker.asc 
 +sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' 
 +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - 
 +sudo echo \ 
 +  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ 
 +  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ 
 +  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 
 +for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done  
 +sudo apt -qy update && sudo apt -qy dist-upgrade  && sudo apt -qy install redis-server redis-tools postgresql postgresql-contrib nginx yarn letsencrypt 
 +sudo update-ccache-symlinks 
 +echo PATH="/usr/lib/ccache:$PATH" >> ~/.bashrc && source ~/.bashrc 
 +PATH="/usr/lib/ccache:$PATH" 
 +sudo install -m 0755 -d /etc/apt/keyrings
 </code> </code>
  
  
-===== Setup Mastodon: User and Repository Cloning ===== 
-FIXME 
-  * <code> sudo adduser mastodon </code> 
-  * <code> sudo adduser mastodon docker </code> 
-  * <code> sudo usermod -g mastodon www-data </code> 
-  * <code> sudo usermod -g www-data mastodon </code> 
-  * <code> sudo chmod 755 /home/mastodon </code> 
-  * <code> su - mastodon </code> 
-  * <code> git clone https://github.com/tootsuite/mastodon.git /home/mastodon/live </code> 
-  * <code> cp .env.production.sample .env.production </code> 
-  * <code> sed -i 's/\bBuild: \./#Build: ./gi' /home/mastodon/live/docker-compose.yml </code> 
  
-===== Adding Sources ===== 
  
- +===== Downloading Sources ===== 
-  * <code> +INSTALLPATH=/opt/mastodon/mastodon 
-sudo update-ccache-symlinks +git clone https://github.com/tootsuite/mastodon.git $INSTALLPATH
-cp /usr/bin/ccache /usr/local/bin+
-echo PATH="/usr/lib/ccache:$PATH" >> ~/.bashrc+
 git clone https://github.com/rbenv/rbenv.git ~/.rbenv git clone https://github.com/rbenv/rbenv.git ~/.rbenv
 cd ~/.rbenv && src/configure && make -C src cd ~/.rbenv && src/configure && make -C src
Line 61: Line 69:
 echo 'eval "$(rbenv init -)"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc
 source ~/.bashrc source ~/.bashrc
-cd ~/live+cd $INSTALLPATH
 gem install bundler gem install bundler
 git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
 git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
-rbenv install 3.2.3 +cd $INSTALLPATH && rbenv install 3.2.3 
-rbenv global 3.2.3 +cd $INSTALLPATH && rbenv global 3.2.3
-ln -s ccache /usr/local/bin/gcc +
-ln -s ccache /usr/local/bin/g++ +
-sudo curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null +
-curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg +
-echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list +
-sudo curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - +
-sudo install -m 0755 -d /etc/apt/keyrings +
-sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc +
-sudo chmod a+r /etc/apt/keyrings/docker.asc +
-sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +
-wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +
-sudo echo \ +
-  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ +
-  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ +
-  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null </code> +
-   * <code> +
-for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done  +
-sudo apt -qy update && sudo apt -qy dist-upgrade  && sudo apt install redis-server redis-tools postgresql postgresql-contrib nginx yarn letsencrypt +
-</code>+
  
-===== Adding Debian Backports (optional) ===== 
- 
-  * <code>sudo nano /etc/apt/source.list.d/backports</code> 
-  * <code> 
-deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware 
-deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware 
-</code> 
  
 +===== Setup Mastodon: User and Repository Cloning =====
 +FIXME
 +  * <code> 
 +  INSTALLPATH=/opt/mastodon
 +  INSTALLUSER=mastodon
 +  sudo adduser $INSTALLUSER 
 +  sudo adduser $INSTALLUSER docker
 +  sudo usermod --home=$INSTALLPATH $INSTALLUSER
 +  sudo usermod -g $INSTALLUSER www-data
 +  sudo usermod -g www-data $INSTALLUSER
 +  sudo chown -R $INSTALLUSER:www-data $INSTALLPATH
 +  sudo chmod 755 $INSTALLPATH
 +  su - $INSTALLUSER -c "cp $INSTALLPATH/.env.production.sample $INSTALLPATH/.env.production"
 +  su - $INSTALLUSER -c "sed -i 's/\bBuild: \./#Build: ./gi' $INSTALLPATH/docker-compose.yml"
 +  </code>
  
  
 ===== Setup Mastodon: .env.production ===== ===== Setup Mastodon: .env.production =====
  
-  * Short Info: don't edit the file, it will be overwritten by the next command.+  * Short Info: You don'need edit the file, it will be overwritten by the next command.
   * Follow up the configuration Guide. You don't need to compile your own Stuff. REALLY NOT. Save the Time :-)   * Follow up the configuration Guide. You don't need to compile your own Stuff. REALLY NOT. Save the Time :-)
 +  * Thats why we removed the build lines above.
   * Trust me its a pain in the Backside and waste your time... ;-D   * Trust me its a pain in the Backside and waste your time... ;-D
     * <code> docker-compose run --rm web bundle exec rake mastodon:setup </code>     * <code> docker-compose run --rm web bundle exec rake mastodon:setup </code>
Line 110: Line 108:
 ===== Setup Mastodon: NGINX ===== ===== Setup Mastodon: NGINX =====
  
-  * We need to create and add some informations for NGINX to use it+  * We need to create and add some information for NGINX to use it
   * Hint: If you need to use a other Reverse-Proxy in front of it, its untested and my not work   * Hint: If you need to use a other Reverse-Proxy in front of it, its untested and my not work
-    * <code> sudo mkdir /var/www/letsencrypt </code> +    * <code> 
-    * <code> sudo cp /home/mastodon/live/dist/nginx.conf /etc/nginx/sites-available/mastodon </code> +INSTALLPATH=/opt/mastodon 
-    * <code> sudo ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon </code> +sudo mkdir /var/www/letsencrypt 
 +sudo cp $INSTALLPATH/dist/nginx.conf /etc/nginx/sites-available/mastodon 
 +sudo ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon  
 +</code> 
  
  
Line 120: Line 121:
  
   * We Link the service-files to auto-update them   * We Link the service-files to auto-update them
-    * <code> sudo ln -s /home/mastodon/live/dist/mastodon-sidekiq.service /etc/systemd/system/mastodon-sidekiq.service </code> +    * <code>  
-    * <code> sudo ln -s /home/mastodon/live/dist/mastodon-streaming.service /etc/systemd/system/mastodon-streaming.service </code> +INSTALLPATH=/opt/mastodon 
-    * <code> sudo ln -s /home/mastodon/live/dist/mastodon-web.service /etc/systemd/system/mastodon-web.service </code> +INSTALLUSER=mastodon 
-  * We reload the systemd daemon +sudo ln -s $INSTALLPATH/dist/mastodon-sidekiq.service /etc/systemd/system/mastodon-sidekiq.service  
-    * <code> sudo systemctl daemon-reload </code> +sudo ln -s $INSTALLPATH/dist/mastodon-streaming.service /etc/systemd/system/mastodon-streaming.service  
-    * <code> sudo systemctl enable --now mastodon.service </code>+sudo ln -s $INSTALLPATH/dist/mastodon-web.service /etc/systemd/system/mastodon-web.service 
 +sudo systemctl daemon-reload && sudo systemctl enable --now mastodon.service </code> 
   * We Check if it was successfull:   * We Check if it was successfull:
-    * <code> watch docker compose -f /opt/mastodon/docker-compose.yml ps</code>+    * <code>  
 +INSTALLPATH=/opt/mastodon 
 +watch docker compose -f $INSTALLPATH/docker-compose.yml ps 
 +</code>
  
  
en/mastodon.1707563148.txt.gz · Last modified: by domele