[MASTODON 4.2.5] How to update Mastodon to a new version

For the old version, click here.

So a new release came out and it is important to get this update as soon as possible! This manual is a transcript of the way that I have updated my Mastodon instance. Please make sure you make proper backups and use your brain while updating things

Linux flavour: Debian
Update from: 4.2.X

  1. Log into your server
  2. su - mastodon
  3. cd /home/mastodon/live
  4. git fetch --tags
  5. git checkout [type the most recent version here, starting with the letter v. For example; v4.2.5
    
    git checkout v4.2.5
  6. If you get a ruby version error, please see bottom of this article for a fix!
    
    bundle install
    
  7. yarn install
  8. RAILS_ENV=production bundle exec rails db:migrate
  9. RAILS_ENV=production bundle exec rails assets:precompile
  10. exit

Okay, you can not choose to either reboot or restart the services.

REBOOT:

  1. This command may vary, depending on your Linux flavour.
    
    systemctl reboot

RESTART:

  1. This command may vary, depending on your Linux flavour.
    
    systemctl restart mastodon-sidekiq
    systemctl reload mastodon-web
    
    Optional:
    
    systemctl restart mastodon-streaming

RUBY VERSION ISSUES

My system was unable to find the required v3.2.3 of Ruby and I have fixed this by doing the following steps:

  1. Please make sure that your path is correct.
    
    git -C ~/.rbenv/plugins/ruby-build pull
  2. rbenv install 3.2.3
    
    *WAIT TILL DONE* (it may take a little while)
  3. To check all the installed versions type:
    
    rbenv versions
  4. To set v3.2.3 as the global version, type:
    
    rbenv global 3.2.3
  5. To double-check the active, installed version, type:
    
    rbenv versions
  6. Done!

This manual is a transcript of the way that I have updated my Mastodon instance. Please make sure you make proper backups and use your brain while updating things.

Sources: https://richstone.io/where-is-ruby-3-0-0-on-rbenv/

Loading

CloudPanel website causing “Too many redirects”

I have installed CloudPanel and the new website caused a “Too many redirects” bug. This is because my SSL certificates are controlled by a proxy and this can cause some confusion between the systems. Also, because CloudPanel installs its own certificates.

This application can also install a Let’s Encrypt certificate, but this works only in more conventional systems. Mine is going through a DNS to a Proxy that listens to a certain IP address and that proxy redirects the request to a Virtual Machine on one of my servers.

So, here is my, probably unconventional method of disabling the SSL certificates on my CloudPanel installation:

  1. Open the CloudPanel controlpanel.
  2. Select the website you want to edit
  3. Choose the Vhost tab
  4. Change the following code into the new code:
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
{{ssl_certificate_key}}
{{ssl_certificate}}
server_name subdomain.3xn.nl;
{{root}}

{{nginx_access_log}}
{{nginx_error_log}}

if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
server {
listen 80;
listen [::]:80;
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
# {{ssl_certificate_key}}
# {{ssl_certificate}}
server_name subdomain.3xn.nl;
{{root}}

{{nginx_access_log}}
{{nginx_error_log}}

# if ($scheme != "https") {
# rewrite ^ https://$host$uri permanent;
# }

Done! Your website should now say “Hello world :-)”

You can see that I have disabled the listen to port 443, the certificate keys, the forced https and the path to the keys. I chose to switch off the forced HTTP, because my proxy is already taking care of that.

This post is subject to change, but this helps you along your way!

Loading

A working Apache2 server with PHP7.4

I was in need of a server solution that could be quickly deployed as a VM.

      1. Install Debian 11 as a VM with web- and SSH server
      2. Create a USER next to your root account during the installation
      3. Find the IP address of the new installation. The easiest is if you have NoVNC running. Log in as USER and type
        ip a
      4. Time to so the sudo thing
        su

        log in as root

        apt-get update && apt-get install -y sudo
        usermod -aG sudo USER
        exit
        exit

        log back in as USER

      5. Okay, let’s install some more stuff but first we do an update
        sudo apt-get update && sudo apt-get upgrade -y

        Now we want some essentials

        sudo apt-get install -y dirmngr gnupg2 nano wget gpg curl fail2ban ufw software-properties-common

        Preparing the PHP install

        wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
        echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
        sudo apt-get update
        sudo apt-get install -y php7.4 libapache2-mod-php7.4 php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-xmlrpc php7.4-zip

        And restart the Apache2 Webserver

        sudo systemctl restart apache2
      6. Alright, that’s done. Next step is to test things.
        sudo nano /var/www/html/test.php

        Enter this into the php file and press Control X and type Y to save and exit.

        <?php
        // Show all PHP information
        phpinfo();
        ?>
      7. Go to the IP address of the server you just created and type
        HTTP://IP ADDRESS/test.php
        

        If you see a PHP page with all sorts of data, you’re good. If not, go fix. Don’t ask me, I’m not there yet!

Loading

Adding and removing a user in PLIK

ADD A USER
Open the UNraid console and enter

./plikd --config ./plikd.cfg user create --login USERNAME --name Admin --admin

The result should be as follows:

Generated password for user controller is yH7ggwod473A3xM5BdI8wEz2FM7bcqF1

REMOVE A USER

Find the user:

./plikd user list

You should see:

local:USERNAME Admin

To remove user, enter:

./plikd --config ./plikd.cfg user delete --login USERNAME Admin

Loading

Keeping your data while restarting Joomla Docker in unRAID

Finally, there is an official Joomla (4.x) Docker made for unRAID. But it is not done well. As in, you will lose all your settings and data when you restart your docker. So you need to copy the data outside the docker into the appdata folder. (Or wherever you want it)

Inside the docker image, the Joomla folder resides here:

/var/www/html/

And this is the folder you need to make “external” by adding a path to the edit/install panel.

  1. Give it a name at “Name:”
  2. Enter the following line to “Container Path:”
    /var/www/html
  3. Enter the following line to “Host Path:”
    /mnt/user/appdata/joomla-data/

Done.

Loading

New FTP user for unRAID

  1. Install ProFTPd by SirG
  2. Create folder where the FTP user should have FULL access to
  3. Go to USERS tab
  4. Click ADD USER
  5. Create username
  6. Create password
  7. In the DESCRIPTION field enterftpuser [PATH WITH LEADING SLASH]
    So for example:
    ftpuser /mnt/usr/myfolder
  8. Click ADD
  9. Go to SETTINGS tab
  10. Click ProFTPd
  11. At “Enable ProFTPd:” select YES (*)
  12. Click APPLY
  13. Service should be running. If not, start service
  14. DONE

(*) In case you already have the service running, click RESTART to activate the new user.

The server can now be accessed by SFTP and port 22.

Loading

IMAPSYNC for Debian 9 installation

  1. apt-get update
  2. apt-get upgrade
  3. apt-get install git libjson-webtoken-perl libauthen-ntlm-perl libcgi-pm-perl libcrypt-openssl-rsa-perl libdata-uniqid-perl libfile-copy-recursive-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libhtml-parser-perl libjson-webtoken-perl libmail-imapclient-perl libparse-recdescent-perl libmodule-scandeps-perl libreadonly-perl libregexp-common-perl libsys-meminfo-perl libterm-readkey-perl libtest-mockobject-perl libtest-pod-perl libunicode-string-perl liburi-perl libwww-perl libtest-nowarnings-perl libtest-deep-perl libtest-warn-perl make cpanminus
  4. cd /home
  5. git clone https://github.com/imapsync/imapsync.git
  6. cd imapsync
  7. chmod +x imapsync
  8. Test it by typing
    ./imapsync
  9. You may need to install some extras by entering
    cpanm File::Tail
  10. cp imapsync /usr/bin/

Done!

Item 10 is to make sure you can use this command anywhere on the server. Have fun!

Loading

Set up Catch-All in Virtualmin

  1. Go to your control panel
  2. Choose your virtual server by selecting the desired domain in the pulldown menu.
  3. Click Edit Mail Aliases
  4. Select All Users
  5. Choose the way you wish to have it delivered

I, for example, want to have it delivered to a gmail box, so i do the following:

  1. Select “Yes, forward to addresses”
  2. Enter off-site email address in the field with the title: “Forward to other address?”

Click Save and you’re set.

Loading