Understanding Containers through Nextcloud

We are into week 3 of our Reclaim Edtech flex course “Understanding Containers,” and I have to say Taylor Jadin is doing a bang-up job taking folks through the basics. Yesterday was the premiere of week 3’s video that covers using load balancers, mapping domains, installing SSL certificates, and more. In week 2 we went through installing Nextcloud and it all started in week 1 with a broader framework for understanding containers as well as getting familiar with Reclaim Cloud. Taylor’s pacing has been excellent, and his weekly videos are accompanied by a weekly blog post with all necessary resources as well as a to-do list. The way he has set it up has a very ds106 weekly assignment vibe, and I am loving it.* I’m also loving Taylor’s Container Glossary, which provides a nice guide for understanding the basic terminology and concepts undergirding containers.

So, this week I sat down to catch up on my Nextcloud work, so what follows are mostly notes for me, but if they come in useful all the better. I used Taylor’s basic docker-compose.yml file to spin up a very basic Nextcloud instance within a Docker Engine node on Reclaim Cloud.

You would copy this docker-compose.yml file into a directory like ~/nextcloud/ and be sure to change the port from 8080:80 to 80:80. Then run the following command:

docker-compose up -d

At that point you’ll have a basic SQLite driven instance of Nextcloud on the default Reclaim Cloud domain, something like nextcloud.uk.reclaim.cloud. I also wanted to get a separate instance running MariaDB spun-up given that works well for larger setups and syncs with various devices more seamlessly. To do this you can either spin up a new Docker Engine node in a separate environment (which is what I did for testing purposes), or just replace the contents of the existing docker-compose.yml with the directives for creating a Nextcloud instance that uses MariaDB.

To do this you need to completely remove the existing containers from the original instance using the following command:

docker-compose down -v

The -v is import  in the above command because it not only spins down containers, but entirely removes them. From there I go back into ~/nextcloud and edit the docker-compose.yml file replacing what’s there with these details (be sure to create your own passwords):

Image of docker-compose.yml file for a MariaDB Nextcloud setup

This is the docker-compose.yml file for a MariaDB Nextcloud setup

Once you update the docker-compose.yml file with the new details and passwords, being sure, once again, to change the port from 8080:80 to 80:80. Save the file and run the following command to spin it up:

docker-compose up -d

After that you should have Nextcloud running on a MariaDB instance. Go to the reclaim.cloud URL and setup the account.

Once you have done that and you want to map a custom domain you will need to add a Nginx load balancer to the environment, ensuring it has a public IP address. After that, grab the public IP address and use it to point an A record for a custom domain, something like cloud.bavatuesdays.com.

Once that is done you can remove the public IP address from the Nextcloud node (not the Load Balancer). From now on the load balancer will provide the public IP, so the IP originally associated with the Nextcloud node is no longer of use so no need to pay for it.

There are 3 more things to do: 1) add a Let’s Encrypt Certificate using the Load Balancer addon and specifying the mapped domain; 2) redirect to  SSL using Nginx, which Taylor blogged; and 3) ensuring your mapped domain is recognized by NextCloud by editing the /var/lib/docker/volumes/nextcloud_nextcloud/_data/config/config.php file to include the custom mapped domain like shown on line 25 below:

Image of the config.php file that needs to be edited to include the domain name

config.php file that needs to be edited to include the domain name, this was for my SQLite instance

Once you do these edits be sure to restart the respective nodes in your environments. I was able to get both the SQlite and MariaDB instance up and running, and it’s worth noting the MariaDB environment uses 8 Cloudlets (roughly $24 per month) versus the SQLite instance using 4 Cloudlets (roughly $12 per month).

Ok, that’s my Nextcloud progress thus far and I understand there may be some gaps in the notes above, so feel free to ask any clarifying questions in the comments.

______________________

*Most of us at Reclaim are struggling with not sharing these immediately after they are produced given they are currently part of our subscription model for Reclaim Edtech, but whether or not that continues to make sense as a model remains a question.

This entry was posted in docker, reclaim, Reclaim Edtech and tagged , , , , . Bookmark the permalink.

1 Response to Understanding Containers through Nextcloud

  1. Reverend says:

    Will this comment sync across both servers in the multi-region?

Leave a Reply to Reverend Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.