Two NextClouds sharing Storage

Hey,

I currently have a private NextCloud server up and running for our intranet which is accessed over a VPN and does not have a public facing IP address.

I am about to setup a second instance of NextCloud which does have a public facing IP address for our clients in order for us to be able to share files with each other securely.

I would like the file storage to be shared between the private instance and public instance so that when a client uploads data on the public instance we can access it from our private instance and when we put data into a client folder on the private instance they can see it on their public instance when they log in.

Is this possible?

The reason I want to do this is because I want to avoid transferring data via another service (email etc.) as we work in legal and compliance services so have to take security very seriously.

I was planning on putting the public instance on its own server which I suspect would complicate things further (I can run it on the same server as the private instance but obviously this creates a much higher security risk because then we are exposing our intranet to the world.

I currently run a Proxmox cluster with Ceph so I could potentially make storage available to both servers without any issue I just need to know if this is possible with NextCloud? I was thinking of using federated sharing but not sure if that will work between private and public networks?

Thanks in advance.

maybe you are looking for this:

https://docs.nextcloud.com/server/13/admin_manual/configuration_files/federated_cloud_sharing_configuration.html

Sadly that doesn’t work because I am using one private and one public instance of nextcloud. if I try to share from the public to the private instance using federated sharing it fails (it doesn’t accept my federated ID from the private server); and if I try to share from the private to the public instance it fails (because it cannot access the private server in order connect to the share).

you could mount the public nextcloud as external storage to your private cloud via webdav.

Yeah that was my thought too - I did that and everything went nuts. CPU usage locked up completely and I got the following error spat out in the Nextcloud log file:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘SELECT fileid, storage, path, path_hash, parent, name, mimetype, mimepart, size, mtime, storage_mtime, encrypted, etag, permissions, checksum FROM oc_filecache WHERE storage = ? AND path_hash = ?’ with params [1, “e8147787f0abd5564b546d2892a20b05”]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

  1. /usr/share/nginx/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128: Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException(‘An exception oc…’, Object(Doctrine\DBAL\Driver\PDOException))
  2. /usr/share/nginx/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 855: Doctrine\DBAL\DBALException driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), ‘SELECT fileid…’, Array)
  3. /usr/share/nginx/nextcloud/lib/private/DB/Connection.php - line 195: Doctrine\DBAL\Connection->executeQuery(‘SELECT fileid…’, Array, Array, NULL)
  4. /usr/share/nginx/nextcloud/lib/private/Files/Cache/Cache.php - line 137: OC\DB\Connection->executeQuery(‘SELECT fileid…’, Array)
  5. /usr/share/nginx/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 69: OC\Files\Cache\Cache->get(‘appdata_ock0nmm…’)
  6. /usr/share/nginx/nextcloud/lib/private/Files/View.php - line 1315: OC\Files\Cache\Wrapper\CacheWrapper->get(‘appdata_ock0nmm…’)
  7. /usr/share/nginx/nextcloud/lib/private/Files/View.php - line 1369: OC\Files\View->getCacheEntry(Object(OCA\RansomwareProtection\StorageWrapper), ‘appdata_ock0nmm…’, ‘/appdata_ock0nm…’)
  8. /usr/share/nginx/nextcloud/lib/private/Files/Node/Root.php - line 198: OC\Files\View->getFileInfo(’/appdata_ock0nm…’)
  9. [internal function] OC\Files\Node\Root->get(’/appdata_ock0nm…’)
  10. /usr/share/nginx/nextcloud/lib/private/Files/Node/LazyRoot.php - line 64: call_user_func_array(Array, Array)
  11. /usr/share/nginx/nextcloud/lib/private/Files/Node/LazyRoot.php - line 141: OC\Files\Node\LazyRoot->__call(‘get’, Array)
  12. /usr/share/nginx/nextcloud/lib/private/Files/AppData/AppData.php - line 79: OC\Files\Node\LazyRoot->get(‘appdata_ock0nmm…’)
  13. /usr/share/nginx/nextcloud/lib/private/Files/AppData/AppData.php - line 105: OC\Files\AppData\AppData->getAppDataFolder()
  14. /usr/share/nginx/nextcloud/lib/private/Template/JSCombiner.php - line 94: OC\Files\AppData\AppData->getFolder(‘core’)
  15. /usr/share/nginx/nextcloud/lib/private/Template/JSResourceLocator.php - line 113: OC\Template\JSCombiner->process(’/usr/share/ngin…’, ‘core/js/merged-…’, ‘core’)
  16. /usr/share/nginx/nextcloud/lib/private/Template/JSResourceLocator.php - line 69: OC\Template\JSResourceLocator->cacheAndAppendCombineJsonIfExist(’/usr/share/ngin…’, ‘core/js/merged-…’)
  17. /usr/share/nginx/nextcloud/lib/private/Template/ResourceLocator.php - line 78: OC\Template\JSResourceLocator->doFind(‘js/merged-templ…’)
  18. /usr/share/nginx/nextcloud/lib/private/TemplateLayout.php - line 306: OC\Template\ResourceLocator->find(Array)
  19. /usr/share/nginx/nextcloud/lib/private/TemplateLayout.php - line 146: OC\TemplateLayout findJavascriptFiles(Array)
  20. /usr/share/nginx/nextcloud/lib/private/legacy/template.php - line 207: OC\TemplateLayout->__construct(‘error’, ‘’)
  21. /usr/share/nginx/nextcloud/lib/private/Template/Base.php - line 132: OC_Template->fetchPage()
  22. /usr/share/nginx/nextcloud/lib/private/legacy/template.php - line 351: OC\Template\Base->printPage()
  23. /usr/share/nginx/nextcloud/index.php - line 70: OC_Template printExceptionErrorPage(Object(Doctrine\DBAL\Exception\DriverException))
  24. {main}

You should open a ticket at the nextcloud support.
I just “connected” two nextcloud installtions and didn’t run into such a problem.

Was one on a private network and the other on a public network?

I have tried it again just now setup as WebDav and NextCloud - both caused CPU to go through the roof as soon as I connected them.

Even when I remove the external storage the resources stay maxed and I have to completely reboot the server to get it stable again.

OK found the issue (existing bug) W2G2 is the cause - I disabled it and can do the external storage with no problems now.