How do I merge servers with the same app?

I’m currently merging servers and in the instructions it says:

There is a limitation concerning apps that have the same ID. It will not be possible to restore them easily. Also be careful not to delete the eponymous app from the destination server.

So not easily to me means that it is possible, so I’m asking how?

You need big YunoHost skills to achieve this.

For example for nextcloud, if you have already a nextcloud APP and want to restore an other nextcloud app (withy nextcloud as app_id), you have to:

  • Change several paths:
    • /etc/yunohost/apps/nextcloud → /etc/yunohost/apps/nextcloud__2
    • /var/www/nextcloud → /var/www/nextcloud__2
    • /etc/nginx/conf.d/$domain.d/nextcloud.conf /etc/nginx/conf.d/$domain.d/nextcloud__2.conf
    • /etc/php/$phpversion/fpm/pool.d/nextcloud.conf → /etc/php/$phpversion/fpm/pool.d/nextcloud__2.conf
    • /etc/logrotate.d/nextcloud → /etc/logrotate.d/nextcloud__2
    • /etc/cron.d/nextcloud → /etc/cron.d/nextcloud__2
    • /etc/fail2ban/jail.d/nextcloud.conf → /etc/fail2ban/jail.d/nextcloud__2.conf
    • /etc/fail2ban/filter.d/nextcloud.conf → /etc/fail2ban/filter.d/nextcloud__2.conf
    • /home/ → /home/
    • May be some hooks inside /etc/yunohost/hooks.d
  • Change those paths inside several configuration file (config.php of nextcloud, nginx conf, php-fpm conf, + /etc/yunohost/apps/nextcloud__2/settings.yml…)
  • Change the id nextcloud for nextcloud__2 in /etc/yunohost/apps/nextcloud__2/settings.yml
  • May be change some value in the mysql database
  • rename the user and group nextcloud into nextcloud__2 and apply owner/group change for each file in /var/www/nextcloud and /home/
  • May be change the user in some config files…
  • May be edit some other apps settings like onlyoffice or borg that reference the app by its app_id
  • Change permission name in LDAP… (THE fun part …)

Note it could be different for each app :confused: , you probably need to read the install and backup script of the app to do it.

And after you have done that (without errors) you can restore your other app nextcloud… If you have made errors, it could erase some part of your new nextcloud__2…

1 Like

Other method, you install a second empty nextcloud (so it will be called nextcloud__2) and you restore manually DB and files from your archive in it.


Thanks. :slight_smile: I think the second method sounds doable. I’m trying to restore a second Discourse app and Discourse has a built in backup function that I’ll try.

I believe that the second method is probably the easiest and safest way to go.
For some apps (such as Discourse apparently ?) it would be almost as easy as restoring the app own backup (not Yunohost one, but using some internal backup&restore process), and for most apps, that is probably a matter of some config files to copy and an export+import of the database… not an easy task, but way easier than the other one…

Note in the future, we have suggested apps should be named randomly with something like:

The problem is it’s longer compared to a simple nextcloud… Feel free to give your point of view on this easy way to fix this problem.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.