[GUIDE] Nextcloud on WD My Cloud

You have no idea how many zillions of database configurations and docker hub examples I’ve tried… I’m looking forward to test this one!

Hello, were you guys able to get the interface running without interfering with the WD My Cloud interface?

You can choose a self-signed certificate instead of letsencrypt and run Nextcloud on another port, but then you get the annoying browser warnings (like for the https version of the wd web interface).

Thanks! Do you have any idea what would be required to avoid the annoying browser warnings. I’m not intimately familiar with the nuances of certificates. Perhaps if you create a certificate for the server to use, while sshed into it, and then trust the certificate when attempting to visit it?

Letsencrypt must use the standardized ports 80 and 443 to be certified authority (CA). If they wouldn’t follow the standard practices, their certificates would no longer be trusted by other CAs and your users will get browser warnings about untrusted certificates. See here.
It’s literally the definition of a certificate: proof of trust by multiple authorities.

Problem
The WD web interface occupies port 80 and 443.
Solution A
Stop the WD web interface so you can use Letsencrypt and automatic certificate renewal and browser comfort. Enable WD web interface again when you need it after stopping the nginx proxy service.
Solution B
Don’t use Letsencrypt and live with a bit less comfort. You’ll need to do your own research on how to use a custom port. Surf to https://{yournasIP} to get a taste.
Solution C
Don’t use this guide at all and live happily ever after without Nextcloud.

The level of required comfort depends a bit on your user base: is it just for you or do you want to serve other people as well… Do you use many different browser instances or not (you’ll have to accept the certificate on all of them).

Hi, thanks again for the input. I’m ok with accepting the certificate in multiple places (generally only use one browser anyways), and it is only me who will be accessing the device, for 99% of the time at least.

I’m looking to set up something like the following on the My Cloud device:
MySQL - NextCloud
NextCloud
GitLab
JIRA
MySQL - Custom DB
WebServer
VPN

Currently considering docker as a means to achieve at least most of these items, since it seems fairly straightforward, but have never used docker either, I found this video a little earlier, which was great but still am lacking confidence:

They use nginex and letsencrypt sort of like you’re suggesting, I think…

Edit: Apparently you were the one who made that original post.

Your posts have been super helpful!

Hello, I’m trying to install Nextcloud on My PR4100, but getting following error:
root@MyCloudPR4100 nextcloud # git clone GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud

-sh: git: not found

root@MyCloudPR4100 nextcloud # /opt/bin/opkg install git

Package git (2.21.0-1) installed in root is up to date.

DO you have any sudgestion?
Thank you.

/opt/bin is not in your PATH by default. Either login again over SSH to activate /etc/profile from the freshly installed entware package or source the file.

. /etc/profile

Important issue!

  1. Downloaded and successfully installed docker,
  2. Downloaded and successfully installed Entware
  3. Install python, setuptools and pip.
    **4. Can’t install docker-compose with pip.
    I’m getting following error:
    unable to execute ’x86_64-openwrt-linux-gnu-gcc’: No such file or directory
    error: command ’x86_64-openwrt-linux-gnu-gcc’ failed with exit status 1

ERROR: Command “/opt/bin/python2 -u -c ’import setuptools,
tokenize;file=’”’“’/tmp/pip-install-BYwYn3/cffi/setup.py’”’“’;f=getattr(tokenize,
’”’“’open’”’“’, open)(file);code=f.read().replace(’”’“’\r\n’”’“’,
’”’“’\n’”’“’);f.clos
e();exec(compile(code, file, ’”’“’exec’”’“’))’ install --record
/tmp/pip-record-QUJKxq/install-record.txt
–single-version-externally-managed --prefix
/tmp/pip-build-env-LTNu8A/overlay --compile” failed with error code 1
in /tmp/pip-
install-BYwYn3/cffi/

ERROR: Command “/opt/bin/python2 /opt/lib/python2.7/site-packages/pip
install --ignore-installed --no-user --prefix
/tmp/pip-build-env-LTNu8A/overlay --no-warn-script-location
–no-binary :none: --only-binary :none: -i Simple index
’setuptools>=18.5’ wheel ’cffi>=1.8,!=1.11.3; python_implementation !=
’”’“’PyPy’”’“’’” failed with error code 1 in None

Do you have any solution for this??

Here’s some inspiration: https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/apache/proxy

EDIT: if you use the 3-container stack, it’s a bit easier to make changes to the nginx config, see https://github.com/stefaang/multiarch-letsencrypt-nginx-proxy/blob/master/nginx-proxy-3containers/docker-compose.yaml

I have a WD My Cloud, too. I always use Windows OS. As the WD My Cloud Desktop is not working a long time, and I have to visit it by Western Digital. While my WD device has not been able to connect mostly. It makes the device becomes a storage disk at home.
Coincidently I found this post. While I know almost nothing about this. Although I tried and searched a lot, it seems still very difficult for me.
Following your steps and my understanding,

  1. I installed a Docker Desktop on my Win10, not run a NextCloud image till now.
  2. I applied a free domain online.
  3. I set and open the port 80 and 443 in the router.
  4. I installed a PuTTY to into My Cloud.
    That’s all I did. And I am stuck here and I don’t how to do next. I think I have a misunderstanding on Step 1. Please give me more guide.
    And I want to make sure if it works finally, does that mean I can access my cloud using the NextCloud’s applications for Desktop and mobile?

If you can’t get past step 1, this guide won’t be for you. Sorry mate.

I’ve been playing with Owncloud and Nextcloud on lighttpd via Entware on an EX2 Ultra box and added my findings here:

I added these features to the original guide:

  • LetsEncrypt certificates
  • Redis cache
  • MySQL data store
  • Browser caching for better browser experience

It’s an alternative to the docker based setup and seems to be a bit more stable.
I may even put all of it into a simple package.

there are plans to officially support the nextcloud

There’s no official support planned.

But I did spend a lot of time tweaking my entware based installation and it runs way smoother than the docker based installation. I also have a workaround for the disabled WD web interface.
I’d say, stay tuned and subscribe to this topic as a huge update is on the way.

1 Like

At first: thanks a lot for this Guide !.
My NextCloud with Docker installation is already finish. :slight_smile:

Only one question :grimacing:: How do I connect my NextCloud container to the MySQL database?

Using the standard SQlite I can setup the NextCloud without issues, but if I try to change the Database (at the setup beginning) an error message appears saying the following :
“Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory”

My NAS: PR2100 FW: 2.31.195


Thanks in advance for any help

Regards!

The WD OS runs a MySQL server.

ps w | grep mysql
netstat -tulnp | grep 3306

Either you stop this server or you run the docker MySQL on another port.
I’d suggest to remove all containers (docker-compose down and docker container prune).
Then setup again and verify the db container is running

docker ps

I believe I had to link them in the last field with 127.0.0.1:3306, I remember some issues with name resolution for localhost.

Check the docker logs for anything going wrong.

Thank you so much for your help Tfl :smiley:!.

The solution was:
1 - I completed the Setup instalaltion again using the standard SQlite DB
2 - Using the “Portainer” I just add this Container: - apache_app_1; apache_letsencrypt_companion_1; apache_proxy_1 to the “Network” : apaIche_default (see image attached).



3 - docker-compose down
4 - COMPOSE_HTTP_TIMEOUT=120 docker-compose up

and now the docker container is connected to the MySQL DB.
I have no Idea why , but I’m very happy to see that is working fine.

And thanks again Tfl for your help and for this incredible GUIDE!

Best Regards!

1 Like

Glad it works for you. I think you may remove that apache_proxy-tier network, just put all containers in a single network.

Hello !

Question, by typing this command:

docker-compose up -d

i get this error:
-sh: docker-compose: not found

Any Ideas ?
Many Thanks.