From 098b41f9d84c86275dbc8fe1b91b37aa0370b972 Mon Sep 17 00:00:00 2001 From: Dave Conroy Date: Mon, 17 Sep 2018 05:33:41 -0700 Subject: [PATCH] 1.0 - Production Release --- CHANGELOG.md | 8 + Dockerfile | 393 +++++++-------- README.md | 113 ++++- examples/docker-compose.yml | 9 +- install/etc/cont-init.d/10-loolwsd | 20 +- install/etc/logrotate.d/loolwsd | 5 +- install/etc/s6/services/10-loolwsd/run | 4 +- .../libreoffice-online.conf | 5 + .../scripts/check-lool.py | 40 ++ zabbix_templates/libreoffice-online.xml | 452 ++++++++++++++++++ 10 files changed, 813 insertions(+), 236 deletions(-) create mode 100644 install/etc/zabbix/zabbix_agentd.conf.d/libreoffice-online.conf create mode 100755 install/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py create mode 100644 zabbix_templates/libreoffice-online.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c15adf..625e07a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.0 2018-09-15 + +* Switch to Ubuntu 16.04 +* Use Multi Stage Build to keep image size down +* Libreoffice 6.0.4.2 +* Libreoffice Online 6.0.4.2 +* Poco 1.9.0 + ## 0.2 2018-03-19 * Working LibreOffice online 5.37.2 diff --git a/Dockerfile b/Dockerfile index 48e035b..2f93981 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,117 +1,74 @@ -FROM tiredofit/debian:stretch +FROM tiredofit/ubuntu:16.04 as builder LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)" ### Set Environment Variables -ENV ADMIN_USER=admin \ - ADMIN_PASS=libreoffice \ - LIBREOFFICE_BRANCH=master \ - LIBREOFFICE_COMMIT=376eaac300a303c4ad2193fb7f6a7522caf550b9 \ +ENV LIBREOFFICE_BRANCH=master \ + ## 6.0.6.2 + LIBREOFFICE_COMMIT=0857a8f6d8dd1b5b9114e9e0c1e1b6b98394434f \ LOOL_BRANCH=master \ - LOOL_COMMIT=fba8488b2549f531fcc0d4e1e7228a7345c2f57d \ - MAX_CONNECTIONS=2000 \ - MAX_DOCUMENTS=1000 \ - POCO_VERSION=1.9.0 + ## 3.2.0.4 + LOOL_COMMIT=9927458251fd069e11efc8e83c78449497cc2048 \ + MAX_CONNECTIONS=5000 \ + ## Uses Approximately 20mb per document open + MAX_DOCUMENTS=5000 -### Add User Accounts -RUN useradd lool -G sudo && \ - mkdir /home/lool && \ - chown lool:lool /home/lool -R && \ - -### Add Repositories - echo "deb http://ftp.us.debian.org/debian/ jessie-backports main" >>/etc/apt/sources.list && \ - echo "deb-src http://ftp.us.debian.org/debian/ jessie-backports main" >>/etc/apt/sources.list && \ - echo "deb http://deb.debian.org/debian stretch contrib" >> /etc/apt/sources.list && \ +### Get Updates +RUN apt-get update && \ + apt-get -y install apt-transport-https && \ + echo "deb https://collaboraoffice.com/repos/Poco/ /" >> /etc/apt/sources.list.d/poco.list && \ + echo "deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted" >> /etc/apt/sources.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D && \ curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ - -### Downgrade LibSSL - echo "Package: openssl libssl1.0.0 libssl-dev libssl-doc" >> /etc/apt/preferences.d/00_ssl && \ - echo "Pin: release a=jessie-backports" >> /etc/apt/preferences.d/00_ssl && \ - echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/00_ssl && \ - apt-get update && \ - apt-get install openssl libssl-dev locales -y --allow-downgrades && \ - -### Setup Distribution + \ + ## Install Poco Libs + apt-get -y install \ + libpoco-dev \ + libpocodata60 \ + libpocofoundation60 \ + libpocojson60 \ + libpocodataodbc60 \ + libpococrypto60 \ + libpoconet60 \ + libpoconetssl60 \ + libpocoutil60 \ + libpocoxml60 \ + libpocozip60 \ + && \ + \ + mkdir -p /home/lool && \ + useradd lool -G sudo && \ + chown lool:lool /home/lool -R && \ echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \ - apt-get upgrade -y && \ + \ + ## Add Build Dependencies apt-get install -y \ - ant \ - automake \ - bison \ - build-essential \ - ccache \ cpio \ - doxygen \ - flex \ - g++ \ git \ - gperf \ - graphviz \ - junit4 \ - libcap2-bin \ libcap-dev \ - libcppunit-dev \ - libcppunit-doc \ - libcunit1 \ - libcunit1-dev \ - libcups2-dev \ - libegl1-mesa-dev \ - libfontconfig1-dev \ - libgl1-mesa-dev \ - libgstreamer1.0-dev \ - libgstreamer-plugins-base1.0-dev \ - libgtk2.0-dev \ - libgtk-3-dev \ - libkrb5-dev \ + libghc-zlib-dev \ libpam0g-dev \ - libpcap0.8 \ - libpcap0.8-dev \ - libpng16.16 \ - libpng-dev \ - libssl-dev \ libtool \ - libxml2-utils \ - libxrandr-dev \ - libxrender-dev \ - libxslt1-dev \ - libxt-dev \ - lsof \ - m4 \ - make \ - nasm \ nodejs \ - openjdk-8-jdk \ - openssl \ - pkg-config \ - procps \ - python3-dev \ - python-dev \ - python-lxml \ python-polib \ sudo \ + translate-toolkit \ ttf-mscorefonts-installer \ - uuid-runtime \ wget \ - xsltproc \ - zip \ && \ - + \ apt-get build-dep -y \ libreoffice \ && \ - - -### Build and Install Poco Libraries - mkdir -p /usr/src/poco && \ - curl -sSL https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}-all.tar.gz | tar xvfz - --strip 1 -C /usr/src/poco && \ - cd /usr/src/poco && \ - ./configure --prefix=/opt/poco && \ - make install - -### Build and Install Libreoffice (This'll take a while) -RUN git clone -b ${LIBREOFFICE_BRANCH} https://github.com/LibreOffice/core.git /usr/src/libreoffice-core && \ + \ +### Build Fetch LibreOffice - This will take a while.. + git clone -b ${LIBREOFFICE_BRANCH} https://github.com/LibreOffice/core.git /usr/src/libreoffice-core && \ cd /usr/src/libreoffice-core && \ + echo "lo_sources_ver="`env | grep LIBREOFFICE_VERSION | cut -d'-' -f2` > sources.ver && \ git reset --hard ${LIBREOFFICE_COMMIT} && \ - chown -R lool /usr/src/libreoffice-core && \ + git submodule init && \ + git submodule update translations && \ + git submodule update dictionaries && \ + cd /usr/src/libreoffice-core && \ echo "--disable-dbus \n\ --disable-dconf \n\ --disable-epm \n\ @@ -143,11 +100,11 @@ RUN git clone -b ${LIBREOFFICE_BRANCH} https://github.com/LibreOffice/core.git / --with-external-thes-dir=/usr/share/mythes \n\ --with-fonts \n\ --with-galleries=no \n\ ---with-lang=\n\ +--with-lang=en-GB en-US\n\ --with-linker-hash-style=both \n\ --with-system-dicts \n\ --with-system-zlib \n\ ---with-theme=tango \n\ +--with-theme=galaxy \n\ --without-branding \n\ --without-help \n\ --without-java \n\ @@ -163,159 +120,159 @@ RUN git clone -b ${LIBREOFFICE_BRANCH} https://github.com/LibreOffice/core.git / --without-system-postgresql \n\ --prefix=/opt/libreoffice \n\ " > /usr/src/libreoffice-core/distro-configs/LibreOfficeOnline.conf && \ - sudo -u lool ./autogen.sh --with-distro="LibreOfficeOnline" && \ + ./autogen.sh --with-distro="LibreOfficeOnline" && \ + rm -rf /usr/src/libreoffice-core/translations /usr/src/lobreoffice-core/dictionaries && \ + chown -R lool /usr/src/libreoffice-core && \ sudo -u lool make && \ cd /usr/src/libreoffice-core && \ mkdir -p /opt/libreoffice && \ chown -R lool /opt/libreoffice && \ sudo -u lool make install && \ - sudo -u lool cp -R /usr/src/libreoffice-core/instdir /opt/libreoffice/ && \ - cd /usr/src - + cp -R /usr/src/libreoffice-core/instdir/* /opt/libreoffice/ && \ + cd /usr/src && \ + \ ### Build LibreOffice Online (Not as long as above) -RUN git clone -b ${LOOL_BRANCH} https://github.com/LibreOffice/online.git /usr/src/libreoffice-online && \ - npm install -g npm && \ - npm install -g jake && \ - chown -R lool /usr/src/libreoffice-online && \ + git clone -b ${LOOL_BRANCH} https://github.com/LibreOffice/online.git /usr/src/libreoffice-online && \ cd /usr/src/libreoffice-online && \ - sudo -u lool git reset --hard ${LOOL_COMMIT} && \ - sudo -u lool ./autogen.sh && \ - sudo -u lool ./configure --enable-silent-rules \ + git reset --hard ${LOOL_COMMIT} && \ + npm install -g \ + bootstrap \ + browserify-css \ + d3 \ + d3 \ + eslint \ + evol-colorpicker \ + exorcist \ + jake \ + npm \ + uglify-js \ + && \ + \ + cd /usr/src/libreoffice-online && \ + ./autogen.sh && \ + ./configure --enable-silent-rules \ --with-lokit-path=/usr/src/libreoffice-online/bundled/include \ - --with-lo-path=/usr/src/libreoffice-online/instdir \ + --with-lo-path=/opt/libreoffice \ --with-max-connections=${MAX_CONNECTIONS} \ --with-max-documents=${MAX_DOCUMENTS} \ - --with-poco-includes=/opt/poco/include \ - --with-poco-libs=/opt/poco/lib \ --with-logfile=/var/log/lool/lool.log \ --prefix=/opt/lool \ --sysconfdir=/etc \ --localstatedir=/var && \ - sudo -u lool make -j$cpu && \ + ( cd loleaflet/po && ../../scripts/downloadpootle.sh ) && \ + ( cd loleaflet && make l10n) || exit 1 && \ + ( scripts/locorestrings.py /usr/src/libreoffice-online /usr/src/libreoffice-core/translations ) && \ + make -j`nproc` && \ mkdir -p /opt/lool && \ chown -R lool /opt/lool && \ - sudo -u lool make install && \ + cp -R loolwsd.xml /opt/lool/ && \ + cp -R loolkitconfig.xcu /opt/lool && \ + make install && \ cd /usr/src && \ - -### Setup Directories and Permissions - mkdir -p /opt/lool/jails && \ - chown -R lool /opt/* && \ - mkdir -p /var/cache/loolwsd && \ - chown -R lool /var/cache/loolwsd && \ - mkdir -p /var/log/lool && \ - chown -R lool /var/log/lool && \ - setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /opt/lool/bin/loolforkit && \ - setcap cap_sys_admin=ep /opt/lool/bin/loolmount && \ - mkdir -p /usr/share/hunspell && \ - mkdir -p /usr/share/hyphen && \ - mkdir -p /usr/share/mythes && \ - -### Setup LibreOffice Online Jails - sudo -u lool /opt/lool/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/libreoffice/instdir/ - -### Cleanup -RUN npm uninstall -g npm jake && \ - apt-get purge -y \ - ant \ - automake \ - binutils-mingw-w64-i686 \ - bison \ - build-essential \ - ccache \ - coinor-libcbc-dev \ - coinor-libcoinmp-dev \ - flex \ - g++ \ - gcc \ - gcc-6 \ - git \ - gperf \ - graphviz \ - java-common \ - junit4 \ - libcap-dev \ - libcppunit-dev \ - libcppunit-doc \ - libcunit1-dev \ - libegl1-mesa-dev \ - libfontconfig1-dev \ - libgl1-mesa-dev \ - libgtk-3-dev \ - libgtk2.0-dev \ - libkrb5-dev \ - libpam0g-dev \ - libpcap0.8 \ - libpcap0.8-dev \ - libpng-dev \ - librevenge-dev \ - libsane-dev \ - libssl-dev \ - libstdc++-6-dev \ - libvisio-dev \ - libwpg-dev \ - libxrandr-dev \ - libxrender-dev \ - libxslt1-dev \ - libxt-dev \ - linux-libc-dev \ - m4 \ - make \ - manpages \ - manpages-dev \ - mingw-w64-i686-dev \ - nasm \ - nodejs \ - openjdk-8-jdk \ - perl \ - pkg-config \ - python \ - python-dev \ - python-lxml \ - python-polib \ - python2.7-minimal \ - python3 \ - python3-dev \ - unixodbc-dev \ - wget \ - x11-* \ - zlib1g-dev \ - doxygen \ - libx11-doc \ - ucpp \ - libapache-pom-java \ - libx11-dev \ - libxdmcp-dev \ - libc-l10n \ - locales \ - lp-solve \ - fastjar \ - x11proto-core-dev \ - && \ - - apt-get purge --auto-remove -y && \ - -## Install Last little bit of packages that may have been removed during cleanup - apt-get install -y \ - cups \ - libgl1-mesa-glx \ - libsm6 \ - libx11-6 \ - && \ - + \ + apt-get autoremove -y && \ apt-get clean && \ - -## Filesystem Cleanup +### Cleanup rm -rf /usr/src/* && \ - rm -rf /home/lool/.npm /root/.npm && \ - rm -rf /home/lool/.ccache /root/.ccache && \ rm -rf /usr/share/doc && \ rm -rf /usr/share/man && \ rm -rf /usr/share/locale && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /var/log/* +FROM registry.selfdesign.org/docker/ubuntu:16.04 +LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)" + +### Set Defaults +ENV ADMIN_USER=admin \ + ADMIN_PASS=libreoffice \ + LOG_LEVEL=warning \ + DICTIONARIES="en_GB en_US" \ + ENABLE_SMTP=false \ + PYTHONWARNINGS=ignore + +### Grab Compiled Assets from builder image +COPY --from=builder /opt/ /opt/ + +### Install Dependencies +RUN adduser --quiet --system --group --home /opt/lool lool && \ + \ + apt-get update && \ + apt-get upgrade -y && \ + echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \ + apt-get install -y\ + adduser \ + apt-transport-https \ + cpio \ + findutils \ + fonts-droid-fallback \ + fonts-noto-cjk \ + libcups2 \ + libfontconfig1 \ + libfreetype6 \ + libgl1-mesa-glx \ + libpam0g \ + libpng12-0 \ + libxcb-render0 \ + libxcb-shm0 \ + libxinerama1 \ + libxrender1 \ + locales-all \ + python3-requests \ + python3-websocket \ + sudo \ + ttf-mscorefonts-installer \ + && \ + \ + echo "deb https://collaboraoffice.com/repos/Poco/ /" >> /etc/apt/sources.list.d/poco.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D && \ + apt-get update && \ + apt-get -y install \ + libpocodata60 \ + libpocofoundation60 \ + libpocojson60 \ + libpocodataodbc60 \ + libpococrypto60 \ + libpoconet60 \ + libpoconetssl60 \ + libpocoutil60 \ + libpocoxml60 \ + libpocozip60 \ + && \ + \ +### Setup Directories and Permissions + mkdir -p /etc/loolwsd && \ + mv /opt/lool/loolwsd.xml /etc/loolwsd/ && \ + mv /opt/lool/loolkitconfig.xcu /etc/loolwsd/ && \ + chown -R lool /etc/loolwsd && \ + mkdir -p /opt/lool/jails && \ + chown -R lool /opt/* && \ + mkdir -p /var/cache/loolwsd && \ + chown -R lool /var/cache/loolwsd && \ + setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /opt/lool/bin/loolforkit && \ + setcap cap_sys_admin=ep /opt/lool/bin/loolmount && \ + mkdir -p /usr/share/hunspell && \ + mkdir -p /usr/share/hyphen && \ + mkdir -p /usr/share/mythes && \ + \ +### Setup LibreOffice Online Jails + sudo -u lool /opt/lool/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/libreoffice && \ + \ + apt-get autoremove -y && \ + apt-get clean && \ + \ + rm -rf /usr/src/* && \ + rm -rf /usr/share/doc && \ + rm -rf /usr/share/man && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/log/* && \ + mkdir -p /var/log/lool && \ + touch /var/log/lool/loolwsd.log && \ + chown -R lool /var/log/lool + ### Networking Configuration EXPOSE 9980 ### Assets ADD install / + diff --git a/README.md b/README.md index a6316bc..9514212 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,112 @@ -Dockerized LibreOffice Online using same variables as the CODE version. However Document Restrictions and User Restrictions have been -raised. Better Documentation coming. +# hub.docker.com/r/tiredofit/libreoffice-online + +[![Build Status](https://img.shields.io/docker/build/tiredofit/libreoffice-online.svg)](https://hub.docker.com/r/tiredofit/libreoffice-online) +[![Docker Pulls](https://img.shields.io/docker/pulls/tiredofit/libreoffice-online.svg)](https://hub.docker.com/r/tiredofit/libreoffice-online) +[![Docker Stars](https://img.shields.io/docker/stars/tiredofit/libreoffice-online.svg)](https://hub.docker.com/r/tiredofit/libreoffice-online) +[![Docker +Layers](https://images.microbadger.com/badges/image/tiredofit/libreoffice-online.svg)](https://microbadger.com/images/tiredofit/libreoffice-online) + +# Introduction + +This will build a container for [LibreOffice Online](https://libreoffice.org/) for editing documents in a browser from supported applications + +* This Container uses a [customized Ubuntu Linux base](https://hub.docker.com/r/tiredofit/ubuntu) which includes [s6 overlay](https://github.com/just-containers/s6-overlay) enabled for PID 1 Init capabilities, [zabbix-agent](https://zabbix.org) for individual container monitoring, Cron also installed along with other tools (bash,curl, less, logrotate, nano, vim) for easier management. + +* Configurable Concurrent User and Document Limit (set to generarous values by default) +* Zabbix Monitoring of Active Documents, Users, Memory Consumed + +[Changelog](CHANGELOG.md) + +# Authors + +- [Dave Conroy](https://github.com/tiredofit) + +# Table of Contents + +- [Introduction](#introduction) + - [Changelog](CHANGELOG.md) +- [Prerequisites](#prerequisites) +- [Installation](#installation) +- [Quick Start](#quick-start) +- [Configuration](#configuration) + - [Database](#database) + - [Data Volumes](#data-volumes) + - [Environment Variables](#environmentvariables) + - [Networking](#networking) +- [Maintenance](#maintenance) + - [Shell Access](#shell-access) +- [References](#references) + +# Prerequisites + +This image assumes that you are using a reverse proxy such as [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy) and optionally the [Let's Encrypt Proxy Companion @ https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) in order to serve your pages. However, it will run just fine on it's own if you map appropriate ports. + + +# Installation + +Automated builds of the image are available on [Docker Hub](https://hub.docker.com/tiredofit/libreoffice-online) and is the +recommended method of installation. + +If you decide to compile this, it will take quite a few hours. + + +```bash +docker pull tiredofit/libreoffice-online +``` + +The following image tags are available: + +* `latest` - Libreoffice 6.0.6.2 with Collabora Office Online 3.2.0.4 + +# Quick Start + +* The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/). See the examples folder for a working [docker-compose.yml](examples/docker-compose.yml) that can be modified for development or production use. + +* Set various [environment variables](#environment-variables) to understand the capabilities of this image. A Sample `docker-compose.yml` is provided that will work right out of the box for most people without any fancy optimizations. + +* Map [persistent storage](#data-volumes) for access to configuration and data files for backup. + +# Configuration + +### Persistent Storage + +The following directories should be mapped for persistent storage in order to utilize the container effectively. + +| Folder | Description | +|-----------|-------------| +| `/var/log/loolwsd` | Log files + +### Environment Variables + +Along with the Environment Variables from the [Base image](https://hub.docker.com/r/tiredofit/ubuntu), below is the complete list of available options that can be used to customize your installation. + +| Parameter | Description | +|-----------|-------------| +| `ADMIN_USER` | User for accessing Administration Console - Default `admin` | +| `ADMIN_PASS` | Password for accessing Administration Console - Default `libreoffice` | +| `ALLOWED_HOSTS` | Set which domains which can access service - Example: `^(.*)\.example\.org` | +| `DICTIONARIES` | Spell Check Languages - Available `de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru` - Default `en_GB en_US` | +| `LOG_LEVEL` | Log Level - Available `none, fatal, critical, error, warning, notice, information, debug, trace` - Default `warning` | + +### Networking + +The following ports are exposed. + +| Port | Description | +|-----------|-------------| +| `9880` | Libreoffice Web Services | + +# Maintenance +#### Shell Access + +For debugging and maintenance purposes you may want access the containers shell. + +```bash +docker exec -it (whatever your container name is e.g. libreoffice-online) bash +``` + +# References + +* https://libreoffice.org + diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index 55d2917..a743079 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -6,15 +6,20 @@ cap_add: - MKNOD environment: - - domain=allowedhostname.example.com - VIRTUAL_HOST=libreoffice.example.com - VIRTUAL_NETWORK=nginx-proxy - VIRTUAL_PORT=9980 - VIRTUAL_PROTO=https - - LETSENCRYPT_HOST=code.example.com + - LETSENCRYPT_HOST=libreoffice.example.com - LETSENCRYPT_EMAIL=techsupport@example.com - ZABBIX_HOSTNAME=libreoffice-app + + - ADMIN_USER=admin + - ADMIN_PASS=libreoffice + - ALLOWED_HOSTS=allowedhostname.example.com + - DICTIONARIES="en_GB en_US" + - LOG_LEVEL=warning networks: - proxy-tier diff --git a/install/etc/cont-init.d/10-loolwsd b/install/etc/cont-init.d/10-loolwsd index ca2276e..524347f 100755 --- a/install/etc/cont-init.d/10-loolwsd +++ b/install/etc/cont-init.d/10-loolwsd @@ -1,5 +1,9 @@ #!/usr/bin/with-contenv bash +mkdir -p /var/log/lool +touch /var/log/lool/loolwsd.log +chown -R lool /var/log/lool + rm /opt/lool/systemplate/etc/resolv.conf ln -s /etc/resolv.conf /opt/lool/systemplate/etc/resolv.conf @@ -27,14 +31,14 @@ mv certs/ca/root.crt.pem /etc/loolwsd/ca-chain.cert.pem rm -rf /tmp/ssl fi -# Replace trusted host and set admin username and password -perl -pi -e "s/localhost<\/host>/${domain}<\/host>/g" /etc/loolwsd/loolwsd.xml -perl -pi -e "s/.*<\/username>/${username}<\/username>/" /etc/loolwsd/loolwsd.xml -perl -pi -e "s/.*<\/password>/${password}<\/password>/" /etc/loolwsd/loolwsd.xml -perl -pi -e "s/.*<\/server_name>/${server_name}<\/server_name>/" /etc/loolwsd/loolwsd.xml - -mkdir -p /var/log/lool -chown -R lool /var/log/lool +# Replace Configureation directives +perl -pi -e "s/.*<\/allowed_languages>/${LANGUAGES}<\/allowed_languages>/" /etc/loolwsd/loolwsd.xml +perl -pi -e "s/.*<\/level>/${LOG_LEVEL}<\/level>/" /etc/loolwsd/loolwsd.xml +perl -pi -e "s/localhost<\/host>/${ALLOWED_HOSTS}<\/host>/g" /etc/loolwsd/loolwsd.xml +perl -pi -e "s/localhost<\/host>/${ALLOWED_HOSTS}<\/host>/g" /etc/loolwsd/loolwsd.xml +perl -pi -e "s/.*<\/username>/${ADMIN_USER}<\/username>/" /etc/loolwsd/loolwsd.xml +perl -pi -e "s/.*<\/password>/${ADMIN_PASS}<\/password>/" /etc/loolwsd/loolwsd.xml +perl -pi -e "s/.*<\/server_name>/${HOSTNAME}<\/server_name>/" /etc/loolwsd/loolwsd.xml mkdir -p /tmp/state echo 'Initialization Complete' >/tmp/state/10-loolwsd-init diff --git a/install/etc/logrotate.d/loolwsd b/install/etc/logrotate.d/loolwsd index a3c1fe3..117fa13 100644 --- a/install/etc/logrotate.d/loolwsd +++ b/install/etc/logrotate.d/loolwsd @@ -5,9 +5,6 @@ missingok compress dateext - sharedscripts - postrotate - s6-svc -h /var/run/s6/services/10-loolwsd - endscript + copytruncate } diff --git a/install/etc/s6/services/10-loolwsd/run b/install/etc/s6/services/10-loolwsd/run index d2af968..65d1756 100755 --- a/install/etc/s6/services/10-loolwsd/run +++ b/install/etc/s6/services/10-loolwsd/run @@ -10,5 +10,5 @@ if [ ! -f /tmp/state/10-loolwsd ]; then fi echo '**' -echo '** [libreoffice-online] Starting loolwsd' -exec s6-setuidgid lool /opt/lool/bin/loolwsd --version --o:sys_template_path=/opt/lool/systemplate --o:lo_template_path=/opt/libreoffice/instdir --o:child_root_path=/opt/lool/jails --o:file_server_root_path=/opt/lool/share/loolwsd storage.filesystem[@allow]=true --o:admin_console.username=${ADMIN_USER} --o:admin_console.password=${ADMIN_PASS} > /var/log/lool/loolwsd.log +echo '** [libreoffice-online] Starting Libreoffice Online Web Services daemon' +exec s6-setuidgid lool /opt/lool/bin/loolwsd --version --o:sys_template_path=/opt/lool/systemplate --o:lo_template_path=/opt/libreoffice --o:child_root_path=/opt/lool/jails --o:file_server_root_path=/opt/lool/share/loolwsd storage.filesystem[@allow]=true --o:admin_console.username=${ADMIN_USER} --o:admin_console.password=${ADMIN_PASS} >> /var/log/lool/loolwsd.log diff --git a/install/etc/zabbix/zabbix_agentd.conf.d/libreoffice-online.conf b/install/etc/zabbix/zabbix_agentd.conf.d/libreoffice-online.conf new file mode 100644 index 0000000..5b80fca --- /dev/null +++ b/install/etc/zabbix/zabbix_agentd.conf.d/libreoffice-online.conf @@ -0,0 +1,5 @@ +UserParameter=lool.mem_consumed,/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py | grep 'lool.mem.consumed' | awk '{print $2}' +UserParameter=lool.active_users,/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py | grep 'lool.active_users_count' | awk '{print $2}' +UserParameter=lool.active_docs,/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py | grep 'lool.active_docs' | awk '{print $2}' +UserParameter=lool.bytes_sent,/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py | grep 'lool.sent_bytes' | awk '{print $2}' +UserParameter=lool.bytes_received,/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py | grep 'lool.recv_bytes' | awk '{print $2}' diff --git a/install/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py b/install/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py new file mode 100755 index 0000000..c22b45c --- /dev/null +++ b/install/etc/zabbix/zabbix_agentd.conf.d/scripts/check-lool.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 + +import requests +from websocket import create_connection,WebSocket +import ssl +import sys +import os + +requests.packages.urllib3.disable_warnings() + +def get_token_value(url,username,password): + r = requests.get(url,auth=(username,password),verify=False) + token_value = r.cookies['jwt'] + return token_value + +def get_doc_info(socket_url,token_value): + data = {} + ws = create_connection(socket_url,sslopt={"cert_reqs": ssl.CERT_NONE}) + """Authenticating with Server """ + ws.send('auth '+'jwt='+token_value) + """Now fetching information """ + word = ['active_users_count', 'active_docs_count', 'mem_consumed', 'sent_bytes', 'recv_bytes'] + for i in word: + ws.send(i) + result = ws.recv() + result = result.split() + data[result[0]] = result[1] + ws.close() + return data + +if __name__ == '__main__': + url = "https://localhost:9980/loleaflet/dist/admin/admin.html" + username = os.getenv('ADMIN_USER') + password = os.getenv('ADMIN_PASS') + token_value = get_token_value(url,username,password) + socket_url = "wss://localhost:9980/lool/adminws" + data = get_doc_info(socket_url,token_value) + for key,value in data.items() : + print("lool."+key , value) + diff --git a/zabbix_templates/libreoffice-online.xml b/zabbix_templates/libreoffice-online.xml new file mode 100644 index 0000000..5dd639d --- /dev/null +++ b/zabbix_templates/libreoffice-online.xml @@ -0,0 +1,452 @@ + + + 3.4 + 2018-09-17T12:09:21Z + + + Templates + + + + + + + + {APP - Libreoffice Online:proc.num[loolwsd].sum(#3)}=0 + 0 + + Libreoffice Online Service is down + 0 + + + 0 + 4 + + 0 + 0 + + + + + + + Active Documents + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + 1A7C11 + 0 + 2 + 0 + + APP - Libreoffice Online + lool.active_docs + + + + + + Active Users + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + 1A7C11 + 0 + 2 + 0 + + APP - Libreoffice Online + lool.active_users + + + + + + All Statistics + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + 1A7C11 + 0 + 2 + 0 + + APP - Libreoffice Online + lool.active_docs + + + + 1 + 0 + F63100 + 0 + 2 + 0 + + APP - Libreoffice Online + lool.active_users + + + + 2 + 0 + 2774A4 + 0 + 2 + 0 + + APP - Libreoffice Online + lool.mem_consumed + + + + + + Memory Consumed + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + 1A7C11 + 0 + 2 + 0 + + APP - Libreoffice Online + lool.mem_consumed + + + + + +