[Solved] MySQL docker on Unraid does an unwanted upgrade

the logo of mysql, showing the name and the outline of a dolphin.

I usually do not fear updates, but when it comes to databases, I am getting really careful with updating them. It wouldn’t be the first time when a database goes plonk after this.

So what happened? My MySQL docker got updated becuase I simply misclicked and of course, the thing broke. The update script, which was set to “latest”, performed an upgrade to 9.x instead of sticking to the latest 8.x version.

After some research, I read that one can enter “mysql:8.2.0” in the repository field. After entering this and starting the docker, the software got reinstalled with the proper version and everything worked again. I must’ve been lucky that the database itself was not migrated to v9 already, I guess.

Loading

How to update Mastodon to a new version

EXPIRED: NEW GUIDE AVAILABLE HERE

Updating Mastodon and creating backups are important steps to ensure the security and stability of your instance. Here’s a comprehensive tutorial on how to update Mastodon, including making backups of the database and assets:


Note 1: Always perform updates on a test/staging instance before applying them to your live instance. This tutorial assumes you have some basic command line and server administration knowledge.

Note 2: If you made alterations to your files and want to update to a new branch, like v4.2.0, don’t forget to stash your files first. DO THIS AT YOUR OWN RISK.

cd /home/mastodon/live
git stash

You will not have an error message any more when entering:
I currently do not know how to put the stashed files back, this will be found out later.

git checkout v4.2.0

Note 3: If you switch to a new branch and version, like 4.2.0, you might run into an error stating the following:

rbenv: version '3.2.2' is not installed (set by /home/mastodon/live/.ruby-version)

Take the following steps to solve this problem:
(Type the version you need where it says x.x.x)

rbenv install x.x.x

If that fails, try the following command:

brew update && brew upgrade ruby-build

Followed by:
(Type the version you need where it says x.x.x)

rbenv install x.x.x

OPTIONAL: If bundler or rails fails to work, try the following commands:

gem install bundler

gem install rails

Click here for the backup steps. It basically comes down to a Database dump, a settings file backup and a Redis dump. If you wish to backup your assets like images and stuff (User-uploaded files), backup the folder named “public/system”. Keep in mind that this folder can be rather large. Actually, it can become rather massive.

After a good 90 minutes, I gave up on trying to show you how large the asset folder is. So beware if you are going to make a backup of it. Perhaps you can just skip the cache folder?

You can always check the folder size by using NCDU, for which you can find the manual here. Also, installations may vary, but this is an example of my instance.


Upgrade procedure.

  1. su - mastodon
  2. cd /home/mastodon/live
  3. git fetch --tags
  4. git checkout [type the most recent version here, starting with the letter v. For example; v4.0.1
    
    Command example: git checkout v4.0.1
  5. bundle install
  6. yarn install
  7. RAILS_ENV=production bundle exec rails db:migrate
  8. RAILS_ENV=production bundle exec rails assets:precompile
  9. exit
  10. reboot now

And that should be it!

If you don’t want to restart your server, use the following commands instead of “reboot now”:

  1. exit
  2. systemctl restart mastodon-sidekiq
  3. systemctl reload mastodon-web

    The reload operation is a zero-downtime restart, also called a “phased restart”. As such, Mastodon upgrades usually do not require any advance notice to users about planned downtime. In rare cases, you can use the restart operation instead, but there will be a (short) felt interruption of service for your users.

  4. The streaming API server is also updated and requires a restart; doing so will result in all connected clients being disconnected, which can increase the load on your server:
systemctl restart mastodon-streaming

Done!

PS: When I updated my instance from 4.1.9 to 4.2.0, a lot of warnings flew by, and this is, in my experience, not a problem as the instance is working perfectly.

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

ArchiveBox root issue in UNraid [FIXED]

Short version of:

Archivebox Docker superuser root issues

[!] ArchiveBox should never be run as root!

The INIT line is in case you set up this docker for the first time. If you already have entered the INIT command, I don;t think you have to do it again.

  1. Open the UNraid Terminal
  2. Enter
    cd /data
  3. Enter (Optional, see previous note)
    archivebox init
  4. Enter
    docker exec -it --user archivebox archivebox bash
  5. Enter
    archivebox manage createsuperuser

Done!

Credits to “emiliobool” for their comment on April 25, 2021 @ https://github.com/ArchiveBox/ArchiveBox/issues/395

 

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

How to fix “Maintenance Mode” in NextCloud

Super annoying when you get locked out, innit?

It depends a bit how you have installed NextCloud but here are two possible locations for your config file:

/var/www/htdocs/nextcloud/config/config.php 
("regular" apache install)
/config/www/nextcloud/config/config.php
(when using a Docker install)

Open the config.php file and look for

 'maintenance' => true,

And change this to

 'maintenance' => false,

Done.

Loading

Archivebox Docker superuser root issues

Since unraid forum is throwing a hissyfit with its captcha thing, I’ll just post it on my own website.

Issue:

root@<containername>:/data# archivebox manage createsuperuser
[i] [2021-11-11 14:29:07] ArchiveBox v0.6.2: archivebox manage createsuperuser
> /data

[i] ArchiveBox should never be run as root!
For more information, see the security overview documentation:
https://github.com/ArchiveBox/ArchiveBox/wiki/Security-Overview#do-not-run-as-root

Oh noes. Open the unraid console and type:

$ sudo docker exec -it --user archivebox <containername> /bin/bash

If you do not know the name of your docker, open the console panel of the archivebox docker and search in the url for “container=”. The number behind that is the name of your docker.

So your prompt looks like this:

archivebox@<containerid>:/data$

Then run:

archivebox manage createsuperuser

Sauce: https://forums.unraid.net/topic/95296-run-docker-as-another-user/?do=findComment&comment=993988

Loading

unRAID Docker image corrupted solution

Warning: This method worked for me and I used this source for it. Proceed at your own risk. Also I need to note that I do not use Cache in any form.

The problem:
You have rebooted your unRAID server and your docker service is refusing to start. What you may see is the following:

and

Apr 2 02:25:30 Tower emhttpd: shcmd (264): /etc/rc.d/rc.docker start
Apr 2 02:25:30 Tower root: starting dockerd ...
Apr 2 02:25:36 Tower kernel: BTRFS error (device loop2): parent transid verify failed on 23757324288 wanted 2572174 found 2572201
Apr 2 02:25:36 Tower kernel: BTRFS error (device loop2): parent transid verify failed on 23757324288 wanted 2572174 found 2572201
Apr 2 02:25:46 Tower kernel: BTRFS error (device loop2): parent transid verify failed on 23729225728 wanted 2572162 found 2572190
Apr 2 02:25:46 Tower kernel: BTRFS error (device loop2): parent transid verify failed on 23729225728 wanted 2572162 found 2572190
Apr 2 02:25:46 Tower kernel: BTRFS: error (device loop2) in __btrfs_free_extent:6805: errno=-5 IO failure
Apr 2 02:25:46 Tower kernel: BTRFS info (device loop2): forced readonly
Apr 2 02:25:46 Tower kernel: BTRFS: error (device loop2) in btrfs_run_delayed_refs:2935: errno=-5 IO failure
Apr 2 02:25:46 Tower kernel: BTRFS warning (device loop2): btrfs_uuid_scan_kthread failed -30
Apr 2 02:25:51 Tower emhttpd: shcmd (266): umount /var/lib/docker
Apr 2 02:25:51 Tower root: umount: /var/lib/docker: target is busy.

This of course, made me extremely nervous. Luckily this only meant that my docker file got corrupted. It happened most likely while I was moving it while the docker service was still active. Yeah, it happens.

Solution:
It’s fairly simple, but it takes a little bit of time.

  1. Go to Settings -> Docker -> Enable Docker, and set to No, then click the Apply button (this disables Docker support)
  2. Go to the location of your docker image and rename the file to docker.img.bak – The file may be in
    /mnt/user/system/docker

    I’m asking you to make a backup, because in all cases, safety first. “Why didn’t you have a backup in the first place?”, I hear you say. Yeah yeah, we all make mistakes every so often! D:

  3. Go to Settings -> Docker -> Enable Docker, and set to Yes and this creates a fresh and empty Docker image. The docker service should now be started. You can see this as this on the docker settings page:

    and on the dashboard you should now see an empty docker field.

  4. Now go to the Apps Tab, Previous Apps Section. Then check off all of your previous applications and hit “Install”

I recommend to do it one by one so you can double-check the settings and clean up the unused templates after you’re done. If you want to make a copy of the templates, FTP into your server and go to

/boot/config/plugins/dockerMan

After you have restored your docker apps, you’re done. Check all the things and make a backup 😉

 

 

Loading