In my searches on some of the potential services I want to run in my personal cloud, I found out about YunoHost; an open source solution to make self-hosting accessible. The project provides some base services such as LDAP, SSO, email, and XMPP chat; but it also allows you to install applications easily with minimal configuration. In their list of officially supported applicatione are Matrix Synapse and NextCloud, which I use both so it looked like a potential candidate to migrate to.

The project has pretty decent documentation and I was able to install it to a VPS server fairly easily. One thing to note is that you need to start with Debian 8 (Jessie) as a base if you’re installing the stable release of YunoHost (2.7.12 at the time of writing this). The instructions will tell you how to install YunoHost interactively with sudo ./install_yunohost, but I found running the install in automated mode by running sudo ./install_yunohost -a instead allowed me to automate this part of the install as a part of provisioning my server. After provisioning, I logged in and ran sudo yunohost tools postinstall and entered the required settings interactively from there.

Once installation is complete, it’s easy to either use the WebUI or the command line to create the first user. I noticed that the first user is assumed to be the administrator, since it automatically gets some email aliases that suggest this in the profile.

When installing NextCloud I ran into an issue where the application would install, but you would get an internal server error when trying to access it. I reported details on issue #110, and it’s related to a permission issue. but the workaround is to simply uninstall the application and then reinstall it.

When installing Matrix Synapse I ran into an issue where the application wouldn’t install. I didn’t see any open issues reported for this, so I reported a new issue #9. I got a fairly quick response and the problem is that the official applications list published in official.json had not been updated with a fix that already solved this issue. The workaround is to install from the master branch of the project (this is considered stable for official apps). I was successful installing Synapse with the following from the command line:

1
sudo yunohost app install 'https://github.com/YunoHost-Apps/synapse_ynh'

Once I got both Matrix and NextCloud running, I tested them a little bit before migrating my own data. Everything seemed to work. I found that I would have to probably make some adjustments due to both applications authenticate with SSO backed by LDAP, so usernames are the same across applications. Currently, we have separate accounts and passwords for each application we host ourselves and we use KeePassXC synced with our NextCloud, to manage our separate logins and passwords.

YunoHost tends to favor running on one large host. I would have to also adjust how I host since I currently run multiple servers for applications running in different contexts. One server is for serving our public and professional facing applications, like this blog. Another server is for serving public services, but in a private context, like our current Matrix Synapse server that we use to stay in touch with friends. The final server is for serving private services that only we should ever connect to, like NextCloud.

Unfortunately, migrating my existing data over to YunoHost is where things started to falter. I tried dumping the existing database in a few different ways, but I ended up going the furthest by running the following on my NixOS server:

1
sudo -u matrix-synapse pg_dump --data-only --no-owner matrix-synapse | gzip > matrix-synapse.sql.gz

I used the --data-only and the --no-owner flags since I’m going to be restoring an existing database and I don’t want to create the tables since they’ll already exist after installing the Matrix Synapse application via YunoHost.

Then, after transferring the dump securely over to my test YunoHost server, I ran the following to try and load the data:

1
2
gunzip matrix-synapse.sql.gz
sudo -u postgres psql matrix_synapse --set ON_ERROR_STOP=on < matrix-synapse.sql

However, Debian 8 (Jessie) uses PostgreSQL 9.4 while NixOS is on PostgreSQL 9.6 and the output of pg_dump from 9.6 includes the following lines of SQL that 9.4 does not understand:

1
2
SET idle_in_transaction_session_timeout = 0;
SET row_security = off;

I’m not sure if these are important, but I tried removing them and running the command to load the data again, but ran into this error:

1
ERROR:  duplicate key value violates unique constraint "access_tokens_pkey"

I tried installing YunoHost 3.0.0 beta on Debian 9 (Stretch) which uses PostgreSQL 9.6. This made it so I didn’t have to delete the lines of SQL, but I got the same error.

This would be easier if I deleted the database and restored it completely. However, I don’t know if that would break how the Synapse YunoHost application needs the database setup. There might also be something I’m doing to try and restore my data on an existing database, but I’m also not as familiar at using PostgreSQL currently as I am MySQL and MS SQL.

This has led me to conclude that it’s too much effort for me to migrate to YunoHost. However, if you don’t currently have data that you are self-hosting, I recommend giving YunoHost a try. I like the interface and I think it will suit most people’s needs. I’m curious how easy it is to maintain and upgrade from version to version.