Setting up Friendica on Unraid

Social media can be overwhelming with how the larger companies push content, you are being told what to watch and consume. A better social network exists and offers you the choice of what to see and it only shows you what you asked to be in your feeds. Most importantly you can still talk to other accounts on other social media platforms. This is the goal of the Fediverse (https://fediverse.party) to take back control of your social accounts for the giants that keep a closed walled garden. Here we will look at installing Friendica (https://friendi.ca/) on Unraid.

For this setup we will be using Unraid as the server using Docker to get a Friendica instance and a worker instance running. We will also need a reverse proxy and a database. I suggest using Nginx Proxy Manager for the reverse proxy for simplicity. As for the database I use Mariadb. We will not be covering setup or configuration of the database or reverse proxy here.

The first thing we will want to do is select what domain name we will be using. I suggest something like friendica.domain.dom and not domain.dom/friendica. Setup your reverse proxy for SSL and redirect traffic to port 8191 on your unraid server. (this is the port I am going to use in this guide)

Next setup a database called friendica with a database user account, make note of the password as it will be needed at a later step.

Docker Templates

We will be setting up two Docker containers in Unraid, One will the worker process and the other the frontend process. We will be setting up the frontend first as it manages the site. I have attached 2 Unraid docker template XML files that can be added to your Unraid server at /boot/config/plugins/dockerMan/templates-user/ I will be walking through the variables needed so you do not need to use the templates.

In Unraid go to the Docker tab and select Add Container at the bottom of the page. If are using the templates select the friendica from the dropdown and you can only need to fill in the fields offered.

To manually build the Docker Container toggle the Basic View in the top right hand corner to access the extra fields and set the following fields.

Name (The name that will be shown in Unraid): friendica
Repository: friendica:latest
Docker Hub URL: https://hub.docker.com/_/friendica
Icon URL: https://wiki.friendi.ca/_media/wiki/logo.png

Docker Config

Next we need to deal with the port redirects and the folder redirects for basic operation. If you used the templates you do not need to add these items but make sure they are filled out properly.

Port Redirects:
 Name: HTTP
  Container: 80 
  Host: 8191
  Type: TCP
Folder Redirects:
 Name: Data Storage (This is the code location):
  Container: /var/www/html
  Host: /mnt/user/appdata/friendica
 Name: Folder Data (This is the upload and attachment location):
  Container: /var/www/data
  Host: /mnt/user/friendica-data

The host locations here are suggestions, I like to keep the Application files in appdata, and the uploads in a separate share in Unraid, this lets me manage backups data separately. Note by default Friendica stores attachments in the database, this is not my preference as I feel it will bloat the database. To make this change we will add a variable.

Key/Name: FRIENDICA_DATA
 Value: Filesystem
 Notes: This separates uploaded content to the file system, do not include it if you want uploads in your database.

Next we will add some variables that deal with the database.

Key/Name: FRIENDICA_DATA
 Value: Filesystem
 Notes: This separates uploaded content to the file system, do not include it if you want uploads in your database.
Key/Name: MYSQL_HOST
 Value: 192.168.0.20
 Notes: The IP of your database, I am using my Unraid servers local IP
Key/Name: MYSQL_DATABASE
 Value: friendica
Key/Name: MYSQL_USER
 Value: friendica
Key/Name: MYSQL_PASSWORD
 Value: long-complicated-password-with-extra-glyphs
Key/Name: MYSQL_PORT
 Value: 3306
 Notes: This is only needed if you use a none standard MySQL port

We need to set an admin email address, this address needs to match the initial accounts email address on setup to get admin access. I do not recommend using your actual account here, make a proper admin account and email address and use that.

Key/Name: FRIENDICA_ADMIN_MAIL
 Value: myemail@domain.dom
 Note: Set this to your email

Next the sites URL needs to be set.

Key/Name: FRIENDICA_URL
 Value: https://friendica.domain.dom/
 Notes: This is the full URL with protocol, domain, and path

With this we could launch the site but first we should setup email or you will miss some important emails.

Email Setup

You can use any mail server that you have access to for this part, I use Sendgrid (https://sendgrid.com/) and will use them for this example, you can get a free account that will work with light email usage. (Caps at 100 messages a day).

Key/Name: SMTP
 Value: smtp.sendgrid.net
 Notes: This is the SMTP server
Key/Name: SMTP_PORT
 Value: 587
 Notes: Port 25 for basic, 587 for TLS, SSL is an option but not shown here
Key/Name: SMTP_TLS
 Value: true
 Notes: If you use TLS set this to true, this example uses TLS
Key/Name: SMTP_DOMAIN
 Value: domain.dom
 Notes: use the domain associated to your email account
Key/Name: SMTP_FROM
 Value: no-reply
 Notes: This is the sending user that will prepend your @domain.dom
Key/Name: SMTP_AUTH_USER
 Value: apikey
 Notes: For sendgrid this is the username used
Key/Name: SMTP_AUTH_PASS
 Value: your-really-long-api-key-provided-by-sendgrid

Initial Access

We are now ready to start the initial access process. Access the URL that you setup in your reverse proxy. This is important because we will not be adding a certificate directly to Friendica we are using the reverse proxy to manage this. Do not access the install using localhost to go through the setup as it will cause issues.

Post Setup Configuration

We now need a worker container for proper operation of the site. This will manage aspects like sending emails and dealing with all the back end parts of a federated network.

Add a new Docker container, if you are using the templates select the template friendicaworker from the dropdown and you only need to fill in the fields offered.

To manually build the Docker Container toggle the Basic View in the top right hand corner to access the extra fields. We will be changing the entry point here so that cron tasks run properly.

Name (The name that will be shown in Unraid): friendicaworker
Repository: friendica:latest
Docker Hub URL: https://hub.docker.com/_/friendica
Icon URL: https://wiki.friendi.ca/_media/wiki/logo.png
Extra Parameters: --entrypoint /cron.sh

From this point we need to fill in almost the exact same details, they need to match the first container. Some fields are not needed, the fields shown are the minimum needed in this setup.

Folder Redirects:
 Name: Data Storage (This is the code location):
  Container: /var/www/html
  Host: /mnt/user/appdata/friendica
 Name: Folder Data (This is the upload and attachment location):
  Container: /var/www/data
  Host: /mnt/user/friendica-data
Key/Name: MYSQL_HOST
 Value: 192.168.0.20
 Notes: The IP of your database, I am using my Unraid servers local IP
Key/Name: MYSQL_DATABASE
 Value: friendica
Key/Name: MYSQL_USER
 Value: friendica
Key/Name: MYSQL_PASSWORD
 Value: long-complicated-password-with-extra-glyphs
Key/Name: MYSQL_PORT
 Value: 3306
 Notes: This is only needed if you use a none standard MySQL port
Key/Name: SMTP
 Value: smtp.sendgrid.net
 Notes: This is the SMTP server
Key/Name: SMTP_PORT
 Value: 587
 Notes: Port 25 for basic, 587 for TLS, SSL is an option but not shown here
Key/Name: SMTP_TLS
 Value: true
 Notes: If you use TLS set this to true, this example uses TLS
Key/Name: SMTP_DOMAIN
 Value: domain.dom
 Notes: use the domain associated to your email account
Key/Name: SMTP_FROM
 Value: no-reply
 Notes: This is the sending user that will prepend your @domain.dom
Key/Name: SMTP_AUTH_USER
 Value: apikey
 Notes: For sendgrid this is the username used
Key/Name: SMTP_AUTH_PASS
 Value: your-really-long-api-key-provided-by-sendgrid

You should now be able to setup an account and start posting.

CC BY 4.0 Free to use and copy

One thought on “Setting up Friendica on Unraid

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.