How to change application domain name on the same yunohost server

Hello,

Edit #1 Adding the fact that there are three users on my Yunohost instance. Small enough so I do not have to automate everything and doing the migration by hand. This way, it can also be helpful for more people (the less technical ones)

TLDR / Summary

The objective of this post is to share with the community how I did to migrate my yunohost applications to a new domain name with a new admin user. Everything staying on the same Yunohost server.
Maybe, it will give ideas while the official “move option” is being implemented by all applications maintainers.

There are only three users on my Yunohost instance so I prefer doing it by hand than in the normal IT way of doing stuff (sql dump, etc). It would have been different with ten or more users.

The migration is not yet finished so it is “work in progress”

Introduction

When I was young, I installed Yunohost to see what it could do. I used a dummy domain name and took a nohost.me. “It’s just a trial right?” Today, I use many applications to manage my digital life as the agenda, contacts or wiki and most of them are tied to the old domain. Some are now on the new domain with the new admin user; So sometimes, I need to switch users to manage settings ( and it is a pain in the but …)

So I would like to change and move everything to the new domain because:

  1. if the server crash, I will loose control of the nohost domain and I will be screwed :open_mouth:
  2. I have a nice domain so it’s better to use it I guess :grinning:
  3. No more round trip between my two admin users to manager this particular application :tada:

Objective (Domain names and users)

My goal is to migrate everything from current to new

current setup
domain : alice.nohost.me
admin : alice

new setup
domain : myserver.example.org
admin : bob


And as a picture is worth a thousand words :

overview

Requirements

  • Create the new user Bob and set it’s username as bob (in my case) in the administration panel of Yunohost
  • Have your own domain name (See YunoHost • index)
  • Have it configured correctly on the registrar to point to your server (you can use sub domain if you want)
  • Your Yunohost server is configured to use the new DNS
  • Have time and/or knowledge as you could loose information if things are not done correctly

It worked for me but depending on your situation, it should be better to ask before rushing

List of applications that need to be migrated

  • baikal
  • dokuwiki
  • freshrss
  • kanboard
  • jappix
  • transmission

For some application like Ampache, it was easier to remove them and to install them on the new domain.
It should be the same for Transmission and others I guess but I did not check that yet.

Migration

Time for some action !

Dokuwiki

I choosed to begin with Dokuwiki as there is no database but only plain files so it is easier

What I did :

  1. Copy the Dokuwiki data to a safe place
  2. Remove Dokuwiki application from Yunohost
  3. Re-install Dokuwiki on the new domain and set bob as admin
  4. Import data from backup
  5. Apply the new Yunohost configuration to the import data

SSH session

  1. Connect to the server by SSH

  2. Verify that there is enough free space to do the backup beforehand ! (use df or other tool)

  3. Backup the dokuwiki folder

    sudo su -                      # Connect as root
    cd /var/www/                   # Move to the folder containing dokuwiki data
    cp -a dokuwiki/ dokuwiki_bak   # Check that your Dokuwiki installation uses the same folder name !
    

Yunohost admin web interface

  1. From Yunohost admin panel, remove the Dokuwiki application (You have other backups than the one we just made right? So do not be afraid :wink: )
  2. Re-install Dokuwiki on the new domain myserver.example.org and set bob as admin

SSH session

Normally, Dokuwiki has been installed in the folder dokuwiki. And your old wiki is stored in dokuwiki_bak

  1. Let’s compare the differences :

    root@yunohost:/var/www# diff -r dokuwiki/conf/ dokuwiki_bak/conf/
    Seulement dans dokuwiki_bak/conf/: acronyms.local.conf
    diff -r dokuwiki__2/conf/dokuwiki.php dokuwiki_bak/conf/dokuwiki.php
    61,62c61,62
    < $conf['superuser']   = 'bob';    //The admin can be user or @group or comma separated list user1,@group1,user2
    < $conf['manager']     = 'bob';    //The manager can be user or @group or comma separated list user1,@group1,user2
    ---
    > $conf['superuser']   = 'alice';    //The admin can be user or @group or comma separated list user1,@group1,user2
    > $conf['manager']     = 'alice';    //The manager can be user or @group or comma separated list user1,@group1,user2
    Seulement dans dokuwiki_bak/conf/: local.php
    Seulement dans dokuwiki_bak/conf/: local.php.bak
    Seulement dans dokuwiki_bak/conf/: mime.local.conf
    Seulement dans dokuwiki_bak/conf/: plugins.local.php
    Seulement dans dokuwiki_bak/conf/: plugins.local.php.bak
    root@yunohost:/var/www# 
    

Except for the admin user, there is no other relevant differences in the configuration folder.

  1. Import data from backup

    # Merge
    root@yunohost:/var/www# rsync -a dokuwiki_bak/ dokuwiki
    root@yunohost:/var/www# 
    
  2. Edit the configuration to change the admin

    # Use `nano` or your editor of choice
    root@yunohost:/var/www# vim dokuwiki/conf/dokuwiki.php
    
    # Go to lines 61 and 62 and add `,bob`
           
    $conf['superuser']   = 'alice,bob';    //The admin can be user or @group or comma separated list user1,@group1,user2
    $conf['manager']     = 'alice,bob';    //The manager can be user or @group or comma separated list user1,@group1,user2
    

This way, whatever you are connected as Alice or Bob, you will be able to administrate the wiki (add plugins, etc) !

Web browser

  1. Try the new wiki with your browser on the new address

  2. If everything is okay, you can delete the backups on the server

     rm -rf /var/www/dokuwiki_bak
    
  3. If there is a problem :scream: , ask for help here or on the forum :grinning:

To be continued !

5 Likes

Thanks for the high quality post ! :ok_hand:

1 Like

Interesting, thanks for sharing !

On the same topic, have you tried updating your dokuwiki ? I encountered errors (see this issue : https://github.com/YunoHost-Apps/dokuwiki_ynh/issues/32 ) but maybe you looked into it already ?
(maybe I should open a new thread, we’ll see…)

There is no upgrade shown in Yunohost so I did not update Dokuwiki on my system.

I had a quick glance at the issue you created and you should not use the internal update function as “Yunohost update” might overwrite the changes you made. You can tried to work on updating the package if you have time/will/skill/curiosity/whatever :hugs:
I know that Dokuwiki is outdated and I would like to work on it as I use it a lot. Unfornately, I lack time at the moment :disappointed_relieved:

I guess that everybody is busy on working to update the base system use by Yunohost to the new linux version “Debian Stretch” at the moment.

Oh, drats ! /o\
Well, I keep this in mind then. I don’t think I have the skills to upgrade the dokuwiki_ynh package but maybe i’ll take a look at it.
Thanks fot answering, let’s keep this open :wink:

1 Like