Tag: nextcloud

Enable HTTPS for NextCloud Docker using `docker-compose`

Enable HTTPS for NextCloud Docker using docker-compose

By default, NextCloud Docker doesn't enable HTTPS.

Steps

Create

  • Create folders
    • /app/nextcloud/data/db: for MySQL database
    • /app/nextcloud/data/db_conf: for MySQL database configuration (don't see anything in it)
    • /app/nextcloud/data/cert: for nextcloud certificates
    • /app/nextcloud/data/html: for nextcloud data and packages
  • Create docker-compose.yml
  • Create Dockerfile.nextcloud
  • Run docker-compose build
  • Run docker-compose up -d

Destroy

  • Run docker-compose down

Docker Compose

docker-compose.yml:

version: '3'

services:
  db:
    image: mariadb:latest
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - /app/nextcloud/data/db:/var/lib/mysql
      - /app/nextcloud/data/db_conf:/etc/mysql/conf.d
    environment:
      - MYSQL_ROOT_PASSWORD=<mysql_root_password>
      - MYSQL_PASSWORD=<mysql_user_password>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    build:
      context: .
      dockerfile: Dockerfile.nextcloud
    restart: always
    ports:
      - 80:80
      - 443:443
    links:
      - db
    volumes:
      - /app/nextcloud/data/html:/var/www/html
      - /app/nextcloud/data/cert/fullchain.pem:/etc/ssl/certs/ssl-cert-snakeoil.pem
      - /app/nextcloud/data/cert/privkey.pem:/etc/ssl/private/ssl-cert-snakeoil.key
    environment:
      - MYSQL_PASSWORD=<mysql_user_password>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db

Dockerfile.nextcloud

  • Define base docker image as nextcloud:latest
  • Enable ssl module
  • Enable default-ssl site
FROM nextcloud:latest

RUN a2enmod ssl
RUN a2ensite default-ssl

References

Unable to login after set admin password when setting up NextCloud

Unable to login after set admin password when setting up

After installed NextCloud using NextCloud Docker, unable to login using newly created admin password.

Solution

Use Google Chrome to login, it doesn't work in Firefox and Microsoft Edge. After fully completed setup, Firefox works again.

Update NextCloudPi

Update NextCloudPi

If go thru NextCloudPI WebUI to update NextCloudPi or NextCloud running by NextCloudPi in Docker, errors could be occurred, which can lead the user not found error. The correct way to do is recreate container using new image.

Note: /data in container must be mapped or backed up.

Update NextCloudPI Image

docker image pull ownyourbits/nextcloudpi-x86

Remove existing container

docker stop nextcloudpi
docker rm nextcloudpi

Recreate container

Use the previous docker parameter, make sure /data was mapped.

docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /app/nc/data:/data --name nextcloudpi ownyourbits/nextcloudpi-x86 $IP

Update NextCloudPi

Login to NextCloudPi, the NextCloudPi will update itself, need to wait for the process pigz completed.

Restore data from backup (If required)

Go to Backup => nc-backup-auto in NextCloudPi WebUI, to find out the backup path, and restore the latest if required.

Manual Update NextCloud

Go to Updates => nc-update-nextcloud in NextCloudPi WebUI, to update NextCloud Manually.

Unable to show login page for NextCloud

Unable to show login page for NextCloud

NextCloud shows Internal Server Error on first page.

Error

In docker log, shows following message

Class 'OCP\\User' not found

and it points to following file

/data/nextcloud/apps/epubreader/lib/Hooks.php

Warning before

There was an warning message pointing to epubreader app, shows untruested source, but after I reinstalled it, the message disappered.

Fix

Access docker

docker exec -it nextcloudpi bash

Move the epubreader app to /tmp directory.

mv /data/nextcloud/apps/epubreader/ /tmp/

Restart NextCloudPi docker container

Next

After fixed, if try to install EPUB/CBZ/PDF ebook reader app again, following message appears.

Error: This app cannot be enabled because it makes the server unstable

If force install it, NextCloud will appear Internal Server Error again.

NextCloud missing .ocdata error

NextCloud missing .ocdata error

After run NextCloudPi many days, got following message

Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.

Fix

Go to nextcloud/data, create an empty file

cd nexcloud/data
touch .ocdata

But I don't know why it was missing.

References

Nextcloud problem: missing .ocdata file [solution]

NextCloud menu display incorrectly

NextCloud menu display incorrectly

A strange error happens in some browsers, NextCloud menu become a big page vertically, and one password textbox there requesting password, but the password is not working.

Not specific OS or browser

In my iMac, Safari is not working. In my one Windows machine, Firefox is not working. By the way, the Firefox has sync enabled and it is working in another PC. Google Chrome and Microsoft Edge have no issue.

Debugging

There is programming error, the contents were downloaded from following website directly, not the NextCloud server. Browser blocked them.

https://raw.githubusercontent.com

Solution

Disable "Theming App" in NextCloud Apps screen.

References

NextCloud page not displaying correctly

Install App in NextCloud Manually

Install App in NextCloud Manually

Got issue to see AppStore in NextCloud, could not fix it.

Tried, but failed

Set appstore in config.php

Updated config.php with following options, but failed.

'appstoreenabled' => true,
'appstoreurl' => 'https://apps.nextcloud.com/api/v1',

But successfully using curl tested access to https://apps.nextcloud.com/api/v1.

Using occ

php occ app:list

Can not see Apps in AppStore

Manual installation

  • Download App from app.nextcloud.com, extract to nextcloud/apps folder.

  • Change owner to www-data:www-data

  • Go to GUI Apps => Disabled apps, refresh page

  • Then the app should be listed.

  • Click on install to install it.

References

Apps management
Using the occ command

NextCloud password manager – Passwords

NextCloud password manager - Passwords

NextCloud password manager, Passwords is an add-on feature of NextCloud, it can be used to save passwords.

Support

It supports Firefox, Chrome, but not Safari. It also supports iOS and Android.

It doesn\'t support OS, such as SSH.

Interface

The interface is too complex compare with other system default password saving features, not user friendly.

Pros

Have notes for password, which allows saving more info.

References

Password managers for Nextcloud

Install a NextCloud server using old MacBook Pro

Install a NextCloud server using old MacBook Pro

The plan is to install ubuntu OS on MacBook Pro with core 2 due CPU, then install NextCloud as docker container.

Install Ubuntu Server

The installation had been done on MacBook Pro with iSCSI root partition.

Refer to Ubuntu with UEFI iSCSI root on x86_64 for details.

Install NextCloudPi docker

The NextCloudPi docker image has all necessary components to run NextCloud server, and it is easy for start up.

Steps

Installation

Run following command, IP is the IP address of the server itself.

docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /app/nc/data:/data --name nextcloudpi ownyourbits/nextcloudpi-x86 $IP

Activate

Access URL https://$IP:4443/, record two pair of user id and password

  • NextCloudPi web interface at port 4443
  • NextCloud at port 443

Update patches

Login to NextCloudPi web interface (port 4443), execute tasks under Updates.

Set Maintenance Mode off

If there was a failure, server went to maintenance mode, then update config/config.php accordingly.

'maintenance' => false,

Another method is using NextCloudPi web interface (port 4443), Tools -> nc-maintenance to disable.

Configure incoming access

Enable new trust domain

Add the newly registered domain name in NGINX and Let's Encrypt in config/config.php

'trusted_domains' =>
array (
  0 => '192.168.0.29',
  1 => 'cloud.example.com',
),

Another method is using NextCloudPi web interface (port 4443), config -> nc-trusted-domains to configure.

Clients' configuration

Using CalDAV to add account for Calendar and Contacts.
Install Password Manager App

Local by pass proxy

To by pass proxy, the internal DNS server needs to point the IP address of nextcloud server to internal server IP. For example, add alias for nextcloud server IP in dnsmasq host entry.

After that, needs to install same certificates in proxy into nextcloudpi server. There are quite number of answers in Internet, but none of them works.

End up, I changed the certificates used in apache2 configuration using following steps

Change Apache SSL certificate

References

NextCloudPi dockers for x86 and ARM
NextCloudPi docker for Raspberry Pi
How to get started with NCP docker
HowTo: Add a new trusted domain
Synchronizing with iOS
Synchronizing with macOS

Plan install a NextCloud server at home

Plan install a NextCloud server at home

Planning to have a NextCloud server at home. There are many solutions.

Solutions

Synology

Install NextCloud as docker in Synology ds1812+ or ds2419+, but

  • Unable to use other system next time.
  • Expose all data in NAS
  • CPU and memory limited

But consider use it as storage via iSCSI.

TrueNAS

Install NextCloud on TrueNAS is officially supported. It is installed as docker container in TrueNAS, but

  • Use more power as the system running on a normal PC
  • Migration might be hard

Raspberry Pi

Install NextCloud on Raspberry Pi, a few options there

  • Install directly on OS, but will mix up with OS as well
  • Install as docker, needs to have correct structure to be maintained
  • Install as NextCloudPi, limited storage on SD card

First plan

After considered all above, first plan will be

  • Install on a Pi which has 1GB ethernet port
  • Install BerryBoot and boot from Synology iSCSI disk
  • Configure storage utilize Synology NAS

Pros

  • Separate storage and application
  • Low power
  • Easy to replace the hardware
  • Got official update regularly

Second plan

After read some documents on line, feel the raspberry pi at current stage still isn't good for NextCloud. The major issue is the CPU speed, which also caused 1GB ethernet performance drop to 40MB/s.

I think I had better use my core 2 due machine to install NextCloud. Maybe I will try it on Raspberry Pi 4 with 8GB RAM later as well.

References

NextCloud Website
BerryBoot Installation
BerryBoot iSCSI Installation
Berryboot install NextCloudPi on an external drive step by step
Nextcloud now officially supported on TrueNAS
NextCloud Plugin on TrueNAS