From 3c217ae3fe7246867f3ee58999e9e25a7e7d871a Mon Sep 17 00:00:00 2001 From: jon Date: Sat, 25 Sep 2021 12:52:05 -0500 Subject: [PATCH] Initial commit. --- .gitignore | 2 ++ README.md | 37 +++++++++++++++++++++++++++ docker-compose.yml | 34 ++++++++++++++++++++++++ docker/elasticsearch/Dockerfile | 2 ++ docker/nextcloud/Dockerfile | 19 ++++++++++++++ docker/nextcloud/supervisord.conf | 23 +++++++++++++++++ docker/nextcloud/zzz-memory-limit.ini | 1 + 7 files changed, 118 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 docker/elasticsearch/Dockerfile create mode 100644 docker/nextcloud/Dockerfile create mode 100644 docker/nextcloud/supervisord.conf create mode 100644 docker/nextcloud/zzz-memory-limit.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ba2084 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +db/ +html/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..b09ce0f --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ += Nextcloud with OCR and Elasticsearch for Full-Text Searching + +To get elasticsearch to run, you'll need to run this on the host: +sysctl -w vm.max_map_count=262144 + +You can build and start all three containers (nextcloud, db and elasticsearch) with: + +$docker-compose up + +Go to: http://[host]:9900/ + +Make up user/pass, I uncheck installing the additional apps at the bottom + +Disable dashboard under user > settings + +== OCR +1. go into settings > basic settings > set cron +1. install apps (workflow ocr) +1. create flow: + 2. add new ocr flow + 2. when: file created + 2. file mime type > is > pdf document + 2. (USE IS AND NOT MATCHES!!!) + +== Full text + +1. Install apps (full text, full text elastic, full text - files) +1. To to Settings > Full Text Search +1. Configure settings appropriately. Address is: http://user:pass@elasticsearch:9200/ +1. Now you have to run the fulltextsearch index manually one time + 2. shell into container, enable www-data account (chsh) + 2. go to /var/www/html and run: php occ fulltextsearch:index + 2. disable www-data account (chsh back to nologin) + + + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..29e4b97 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3' +services: + nextcloud_db: + image: mariadb + command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW + restart: always + volumes: + - ./db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=hELLO@123 + - MYSQL_PASSWORD=hELLO@123 + - MYSQL_DATABASE=nextcloud + - MYSQL_USER=nextcloud + + nextcloud: + image: nextcloud-ocr + build: ./docker/nextcloud + ports: + - 9900:80 + links: + - nextcloud_db + volumes: + - ./html:/var/www/html + restart: always + + elasticsearch: + image: nextcloud-es + build: ./docker/elasticsearch + ports: + - 9200 + environment: + - "discovery.type=single-node" + + diff --git a/docker/elasticsearch/Dockerfile b/docker/elasticsearch/Dockerfile new file mode 100644 index 0000000..9cb8ec0 --- /dev/null +++ b/docker/elasticsearch/Dockerfile @@ -0,0 +1,2 @@ +FROM elasticsearch:7.14.1 +RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install -b ingest-attachment diff --git a/docker/nextcloud/Dockerfile b/docker/nextcloud/Dockerfile new file mode 100644 index 0000000..40f3e30 --- /dev/null +++ b/docker/nextcloud/Dockerfile @@ -0,0 +1,19 @@ +FROM nextcloud + +# install necessary packages +RUN apt-get update && apt-get install -y ocrmypdf supervisor + +# create supervisord dir +RUN mkdir /var/log/supervisord /var/run/supervisord +COPY supervisord.conf / + +# copy in memory size increase php ini file +# we name it zzz because nextcloud.ini was overriding +COPY zzz-memory-limit.ini /usr/local/etc/php/conf.d/ + +# remove memory limit from nextcloud.ini that overrides that +# todo + +ENV NEXTCLOUD_UPDATE=1 + +CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"] diff --git a/docker/nextcloud/supervisord.conf b/docker/nextcloud/supervisord.conf new file mode 100644 index 0000000..f3a1d81 --- /dev/null +++ b/docker/nextcloud/supervisord.conf @@ -0,0 +1,23 @@ +[supervisord] +nodaemon=true +logfile=/var/log/supervisord/supervisord.log +pidfile=/var/run/supervisord/supervisord.pid +childlogdir=/var/log/supervisord/ +logfile_maxbytes=50MB ; maximum size of logfile before rotation +logfile_backups=10 ; number of backed up logfiles +loglevel=error + +[program:apache2] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=apache2-foreground + +[program:cron] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=/cron.sh + diff --git a/docker/nextcloud/zzz-memory-limit.ini b/docker/nextcloud/zzz-memory-limit.ini new file mode 100644 index 0000000..4977afd --- /dev/null +++ b/docker/nextcloud/zzz-memory-limit.ini @@ -0,0 +1 @@ +memory_limit=1G