Skip to content

Instantly share code, notes, and snippets.

@aont
Last active May 2, 2025 09:18
Show Gist options
  • Save aont/9e5366e9981a298d709edf438ae68273 to your computer and use it in GitHub Desktop.
Save aont/9e5366e9981a298d709edf438ae68273 to your computer and use it in GitHub Desktop.

nextcloud setup

version

Item Value
Nextcloud 31.0.4
MariaDB 11.4
elasticsearch 8.18.0
Collabora Office 25.04.1.1

start nextcloud container

docker pull mariadb:11.4
docker pull nextcloud

docker run --rm --name nextcloud_mariadb --hostname mariadb --network nextcloud -e MYSQL_ROOT_PASSWORD=root1234 -e MYSQL_PASSWORD=nextcloud1234 -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -d -v ./nextcloud_mariadb:/var/lib/mysql mariadb:11.4

docker run --rm --name nextcloud_main --hostname nextcloud --network nextcloud -p 1080:80 -d -v ./nextcloud:/var/www/html nextcloud

initial setup

http://hostname:1080

Item Value
login any
password any
data folder /var/www/html/data (default)
database MySQL/MariaDB
database account nextcloud
database password nextcloud1234
database name nextcloud
database hostname mariadb:3306

Full text search

Install following apps:

  • Full text search - Apps
  • Full text search - Elasticsearch Platform
  • Full text search - Files
  • Full text search - OCR

setup elasticsearch

copy default config

es_args=(--name nextcloud_elasticsearch --hostname elasticsearch --net nextcloud -e "discovery.type=single-node" -e  ES_JAVA_OPTS="-Xms6G -Xmx6G")

docker run --rm "${es_args[@]}" -dit elasticsearch:8.18.0 /bin/bash

docker cp nextcloud_elasticsearch:/usr/share/elasticsearch/config ./es/
docker cp nextcloud_elasticsearch:/usr/share/elasticsearch/data ./es/
docker cp nextcloud_elasticsearch:/usr/share/elasticsearch/plugins ./es/

docker stop nextcloud_elasticsearch

set volume bind args.

es_volume_args=(-v ./es/config:/usr/share/elasticsearch/config -v ./es/data:/usr/share/elasticsearch/data -v ./es/plugins:/usr/share/elasticsearch/plugins)

disable ssl

append following on es/config/elasticsearch.yml

xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false

if you had forgotten to do above

Do this afterward:

docker run --rm "${es_args[@]}" "${es_volume_args[@]}" -it elasticsearch:8.18.0 /bin/bash
bin/elasticsearch-keystore remove xpack.security.transport.ssl.keystore.secure_password
bin/elasticsearch-keystore remove xpack.security.transport.ssl.truststore.secure_password
bin/elasticsearch-keystore remove xpack.security.http.ssl.keystore.secure_password

install plugins

docker run --rm "${es_args[@]}" "${es_volume_args[@]}" -it elasticsearch:8.18.0 /bin/bash
./bin/elasticsearch-plugin list
# check whether following plugins are already installed
./bin/elasticsearch-plugin install analysis-kuromoji
./bin/elasticsearch-plugin install analysis-icu
exit

start

# -p 9200:9200 -p 9300:9300 
docker run -d --rm "${es_args[@]}" "${es_volume_args[@]}" elasticsearch:8.18.0

settings for fulltextsearch

Full text search - Administration settings - Nextcloud

Item Value
General / Search Platform Elasticsearch
Elastic Search / Servelet Address http://elasticsearch:9200
Index nextcloud (any)
[Advanced] Analyzer Tokenizer kuromoji_tokenizer
Files - Tesseract OCR / Enable OCR Yes
Languages ja,eng
PDF Yes
Files - Source / External File Index paths and contents

check

check whether fts works

docker exec -it -u www-data nextcloud_main /bin/bash

# whole test and check connection
php ./occ fulltextsearch:test

# generate index
php ./occ fulltextsearch:index

fts daemon container

docker run --rm --name nextcloud_fts --network nextcloud -v ./nextcloud:/var/www/html -u www-data -d nextcloud /var/www/html/occ fulltextsearch:live

to stop daemon

docker exec -it -u www-data nextcloud_fts /var/www/html/occ fulltextsearch:stop

collabora office

To install additional fonts (for example Japanese fonts), we have to prepare out own collabora server. (And Japanese fonts are installed by default?)

note: With own collabora server, iOS app's viewer does not work. (but, with the embeded one, it works...) So I disabled collabora.

docker run --rm -d --network nextcloud -e "extra_params=--o:ssl.enable=false" --name nextcloud_collabora -p 9980:9980 collabora/code

Office - Administration settings - Nextcloud

Item Value
Nextcloud Office / User your own server Yes
URL (and Port) of Collabora Online-server http://hoge:9980

note: The URL should be accessible from user's browser. The host machine's address would be good. Collabora container's address would not be accessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment