ladral / qnap-nextcloud

Nextcloud on a QNAP NAS with HTTPS connection within a local area network
MIT License
47 stars 9 forks source link

qnap-nextcloud

Requirements

User Creation

Create a new user which will be used for docker containers, so that they are not running as root (primarily for security reasons). Go to "Users" from the main screen QTS, select "Create User" and create a user called "dockeruser"

User Creation

Folder Creation

Create a new shared folder that we will keep all docker appdata in. Load up "File Station" and create a new share by clicking on the + next to the Data Volume.

Folder Creation

Call the folder Docker and give full read/write access to this folder to the newly created dockeruser. Everything else can be left as default.

Folder Privileges

Once the Docker folder is created, create another folder called nextcloud within the Docker folder.

Get User IDs

Now the UID/GID of the user dockeruser need to be figured out. Use your favourite method to ssh into the QNAP NAS and run the following command:

id <username>

Replace with the user you created earlier (dockeruser). The result of the command should look like this:

Result:

[~] # id dockeruser
uid=500(dockeruser) gid=100(everyone) groups=100(everyone)
[~] #

Note the UID and the GID and replace the ID's in the docker-compose.yml file (see comments in the docker-compose file).

Container Creation

Create a new container based on the docker-compose.yml file.

Container Creation

Open the Container Station and select Applications from the management menu. Click on the Create button.

Create Container Application

Download the docker-compose.yml from the repository and replace the passwords and the dockeruser id/group (see comments in the docker-compose file).

Choose a name for the Container and paste the content of the docker-compose.yml into the YAML section and click on the create button.

Setup Nextcloud

After the container is created, open the Nextcloud web interface on https://NAS-IP:9443/

Nextcloud Settings

Fill in the credentials for the administrator account.

Select MySQL/MariaDB as database and use the database credentials defined in the docker-compose.yml file. (MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, container_name)

Click Install to finish the Nextcloud setup.

Update Container

To keep everything up to date the containers need to be updated frequently.

Pull Images

Select Images from the management menu and pull the latest images for mariadb and nextcloud.

Recreate Application

Select Applications from the management menu and recreate the application.

Remove Images

Select Images from the management menu and remove the unused images linuxserver/nextcloud and linuxserver/mariadb.

Update Nextcloud

To update Nextcloud, it is not possible to do so directly from the web interface. Instead, the update process involves pulling the new image and recreating the container with it. When the container starts up, it automatically detects if an update is required and performs it accordingly.

It's important to note that Nextcloud can only be upgraded one major version at a time. For example, if you want to upgrade from version 26 to 28, you will first need to upgrade from version 26 to 27, and then from 27 to 28. In such cases, you will need to recreate the container with a specific version tag instead of using the latest tag. Once you have reached the latest major version, you can switch back to using the latest tag for updates.

Nextcloud Maintenance

Occasionally, you may encounter missing database (DB) indices in your Nextcloud setup. These missing indices can be identified within the Nextcloud web interface, specifically in the administrative settings section.

To simplify the process of addressing missing DB indices, it is recommended to run the commands within Container Station. Container Station provides a convenient environment for executing commands related to a container. By utilizing Container Station, you can easily run the 'occ db:add-missing-indices' command and ensure that any missing indices are added promptly.

Nextcloud Container

Select Container from the management menu and select the nextcloud container.

Execute

Select Execute from the upper menu of the nextcloud container.

Add Execution

Select Add and insert the command you wish to execute. For example, you can use the command occ db:add-missing-indices. This command will ensure that any missing indices in the database are added. Once you have inserted the command, click on the Save button to save it. Now, you can execute the command. If you need to re-execute the command in the future, don't worry! The command is now saved and can be easily accessed. Simply navigate to the saved commands section and select the desired command. It will be executed again, allowing you to perform the necessary actions whenever required.

Migrate to Container Station 3

Starting from Container Station 3, it is no longer possible to set resource limits directly within the docker-compose file. As a result, it is important to remove all deploy sections from the docker-compose file to ensure that the containers start successfully.

# remove this section 
    deploy:
      resources:
        limits:
          cpus: 1.20
          memory: 4096M

Resource limits can be manually configured in the advanced settings. This allows you to define specific limits for CPU usage and memory allocation.

Create Container Application

Links