Installing Mastodon

1. The Docker Scripts

For this installation, we use “docker-scripts”, a project created by Dashamir. This makes it easy for us to set up and configure Mastodon and make further configurations.

We have already installed the “revproxy” container via the docker-scripts. The reverse proxy forwards the various requests to the installed services. You can find more information and the installation here: https://gitlab.com/docker-scripts/revproxy

2. Installation Mastodon

Before we can install and finally use Mastodon, we need to download the image. Thanks to the docker scripts, this can be done very easily with the following command:

ds pull mastodon

After executing the command, Mastodon is automatically downloaded from the official package sources and saved in the /opt/docker-scripts/mastodon folder.

We have now downloaded the image. The next step is to initialize the instance. This is done as follows:

ds init mastodon @toot.lugbz.social

The command is built up as follows:

  • ds init with this we execute the initialization of a container.

  • mastodon as the second step we have to specify the image - in our case Mastodon.

  • @toot.lugbz.social Finally, we only need to specify the domain or directory for the installation. We have chosen toot.lugbz.org for our installation.

A directory of the same name is automatically created in the /var/ds/ folder. In this folder we also find the various configuration settings for our instance. In the settints.sh file we find all the settings for our Mastodon server.

Here is the structure of the settings.sh

APP=mastodon
DOMAIN="toot.lugbz.org"

MASTODON_VERSION='v4.2.5'

### Limit the JVM Heap Size for ElasticSearch.
### It is usually recommended to be no more than half the size of the
### VPS where Mastodon is running.
#JVM_HEAP_SIZE=1g

### PostgreSQL
### Uncomment this setting in order to use an external database.
### Leave it commented for using the internal postgresql+pgbouncer.
#DATABASE_URL=postgresql://dbuser:dbpass@dbhost:5432/dbname

### Redis
### Uncomment this setting in order to use an external redis.
### Leave it commented for using the internal redis.
#REDIS_URL=redis://[user]:password@redis.example.org:6378/toot.example.org

Basically, the setting can be left as it is. The only thing that needs to be adjusted is the domain of the service. Optionally, the version can also be set.

3. Create Container

Once all the settings have been made, we can create the container! This is also very easy thanks to the docker scripts. The following command is used to install Mastodon and configure it based on the settings.

ds make

When you execute the command, make sure you are in the relevant folder, otherwise problems may occur!

We did it! Mastodon is installed and can be accessed via the domain!

4. Mastodon Settings

To make settings on the Mastodon server, you only need to go to the directory of the DS script. In our case:

cd /var/ds/toot.lugbz.social/

Assuming that we open the Mastodon settings file in the installation directory as follows:

nano mastodon/live/.env.production

Here we find all Mastodon-specific settings