Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create onlyoffice extension #857

Merged
merged 21 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config = {
'store':'',
'thumbnails':'',
'webdav':'',
'onlyoffice':'frontend'
},
'apiTests': {
'coreBranch': 'master',
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/onlyoffice/ @LukasHirt
7 changes: 7 additions & 0 deletions changelog/unreleased/create-onlyoffice-extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Create OnlyOffice extension

Tags: OnlyOffice

We've created an OnlyOffice extension which enables users to create and edit docx documents and open spreadsheets and presentations.

https://github.com/owncloud/ocis/pull/857
10 changes: 10 additions & 0 deletions docs/extensions/onlyoffice/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "OnlyFffice"
date: 2018-05-02T00:00:00+00:00
weight: 10
geekdocRepo: https://github.com/owncloud/ocis/onlyoffice
geekdocEditPath: edit/master/docs
geekdocFilePath: _index.md
---

This service enables users open documents, spreadsheets and presentations in the OnlyOffice app installed in ownCloud 10.
28 changes: 28 additions & 0 deletions docs/extensions/onlyoffice/building.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "Building"
date: 2018-05-02T00:00:00+00:00
weight: 30
geekdocRepo: https://github.com/owncloud/ocis/onlyoffice
geekdocEditPath: edit/master/docs
geekdocFilePath: building.md
---

{{< toc >}}

As this project is built with Go, so you need to install that first. The installation of Go is out of the scope of this document, please follow the official documentation for [Go](https://golang.org/doc/install), to build this project you have to install Go >= v1.12. After the installation of the required tools you need to get the sources:

{{< highlight txt >}}
git clone https://github.com/owncloud/ocis/onlyoffice.git
cd ocis-onlyoffice
{{< / highlight >}}

All required tool besides Go itself and make are bundled or getting automatically installed within the `GOPATH`. All commands to build this project are part of our `Makefile`.

## Backend

{{< highlight txt >}}
make generate
make build
{{< / highlight >}}

Finally you should have the binary within the `bin/` folder now, give it a try with `./bin/onlyoffice -h` to see all available options.
272 changes: 272 additions & 0 deletions docs/extensions/onlyoffice/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
---
title: "Getting Started"
date: 2018-05-02T00:00:00+00:00
weight: 20
geekdocRepo: https://github.com/owncloud/ocis/onlyoffice
geekdocEditPath: edit/master/docs
geekdocFilePath: getting-started.md
---

{{< toc >}}

## Installation

So far we are offering two different variants for the installation. You can choose between [Docker](https://www.docker.com/) or pre-built binaries which are stored on our download mirrors and GitHub releases. Maybe we will also provide system packages for the major distributions later if we see the need for it.

### Docker

TBD

### Binaries

TBD

## Configuration

We provide overall three different variants of configuration. The variant based on environment variables and commandline flags are split up into global values and command-specific values.

### Envrionment variables

If you prefer to configure the service with environment variables you can see the available variables below.

#### Global

ONLYOFFICE_CONFIG_FILE
: Path to config file, empty default value

ONLYOFFICE_LOG_LEVEL
: Set logging level, defaults to `info`

ONLYOFFICE_LOG_COLOR
: Enable colored logging, defaults to `true`

ONLYOFFICE_LOG_PRETTY
: Enable pretty logging, defaults to `true`

#### Server

ONLYOFFICE_TRACING_ENABLED
: Enable sending traces, defaults to `false`

ONLYOFFICE_TRACING_TYPE
: Tracing backend type, defaults to `jaeger`

ONLYOFFICE_TRACING_ENDPOINT
: Endpoint for the agent, empty default value

ONLYOFFICE_TRACING_COLLECTOR
: Endpoint for the collector, empty default value

ONLYOFFICE_TRACING_SERVICE
: Service name for tracing, defaults to `onlyoffice`

ONLYOFFICE_DEBUG_ADDR
: Address to bind debug server, defaults to `0.0.0.0:9224`

ONLYOFFICE_DEBUG_TOKEN
: Token to grant metrics access, empty default value

ONLYOFFICE_DEBUG_PPROF
: Enable pprof debugging, defaults to `false`

ONLYOFFICE_DEBUG_ZPAGES
: Enable zpages debugging, defaults to `false`

ONLYOFFICE_HTTP_ADDR
: Address to bind http server, defaults to `0.0.0.0:9220`

ONLYOFFICE_HTTP_NAMESPACE
: The http namespace

ONLYOFFICE_HTTP_ROOT
: Root path of http server, defaults to `/`

#### Health

ONLYOFFICE_DEBUG_ADDR
: Address to debug endpoint, defaults to `0.0.0.0:9224`

### Commandline flags

If you prefer to configure the service with commandline flags you can see the available variables below.

#### Global

--config-file
: Path to config file, empty default value

--log-level
: Set logging level, defaults to `info`

--log-color
: Enable colored logging, defaults to `true`

--log-pretty
: Enable pretty logging, defaults to `true`

#### Server

--tracing-enabled
: Enable sending traces, defaults to `false`

--tracing-type
: Tracing backend type, defaults to `jaeger`

--tracing-endpoint
: Endpoint for the agent, empty default value

--tracing-collector
: Endpoint for the collector, empty default value

--tracing-service
: Service name for tracing, defaults to `onlyoffice`

--debug-addr
: Address to bind debug server, defaults to `0.0.0.0:9224`

--debug-token
: Token to grant metrics access, empty default value

--debug-pprof
: Enable pprof debugging, defaults to `false`

--debug-zpages
: Enable zpages debugging, defaults to `false`

--http-addr
: Address to bind http server, defaults to `0.0.0.0:9220`

--http-namespace
: Namespace for internal services communication, defaults to `com.owncloud.web`

--http-root
: Root path of http server, defaults to `/`

#### Health

--debug-addr
: Address to debug endpoint, defaults to `0.0.0.0:9224`

### Configuration file

So far we support the file formats `JSON` and `YAML`, if you want to get a full example configuration just take a look at [our repository](https://github.com/owncloud/ocis/onlyoffice/tree/master/config), there you can always see the latest configuration format. These example configurations include all available options and the default values. The configuration file will be automatically loaded if it's placed at `/etc/ocis/onlyoffice.yml`, `${HOME}/.ocis/onlyoffice.yml` or `$(pwd)/config/onlyoffice.yml`.

## Usage

The program provides a few sub-commands on execution. The available configuration methods have already been mentioned above. Generally you can always see a formated help output if you execute the binary via `ocis-onlyoffice --help`.

### Server

The server command is used to start the http and debug server on two addresses within a single process. The http server is serving the general webservice while the debug server is used for health check, readiness check and to server the metrics mentioned below. For further help please execute:

{{< highlight txt >}}
ocis-onlyoffice server --help
{{< / highlight >}}

### Health

The health command is used to execute a health check, if the exit code equals zero the service should be up and running, if the exist code is greater than zero the service is not in a healthy state. Generally this command is used within our Docker containers, it could also be used within Kubernetes.

{{< highlight txt >}}
ocis-onlyoffice health --help
{{< / highlight >}}

## Metrics

This service provides some [Prometheus](https://prometheus.io/) metrics through the debug endpoint, you can optionally secure the metrics endpoint by some random token, which got to be configured through one of the flag `--debug-token` or the environment variable `ONLYOFFICE_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9224/metrics`.

go_gc_duration_seconds
: A summary of the GC invocation durations

go_gc_duration_seconds_sum
: A summary of the GC invocation durations

go_gc_duration_seconds_count
: A summary of the GC invocation durations

go_goroutines
: Number of goroutines that currently exist

go_info
: Information about the Go environment

go_memstats_alloc_bytes
: Number of bytes allocated and still in use

go_memstats_alloc_bytes_total
: Total number of bytes allocated, even if freed

go_memstats_buck_hash_sys_bytes
: Number of bytes used by the profiling bucket hash table

go_memstats_frees_total
: Total number of frees

go_memstats_gc_cpu_fraction
: The fraction of this program's available CPU time used by the GC since the program started

go_memstats_gc_sys_bytes
: Number of bytes used for garbage collection system metadata

go_memstats_heap_alloc_bytes
: Number of heap bytes allocated and still in use

go_memstats_heap_idle_bytes
: Number of heap bytes waiting to be used

go_memstats_heap_inuse_bytes
: Number of heap bytes that are in use

go_memstats_heap_objects
: Number of allocated objects

go_memstats_heap_released_bytes
: Number of heap bytes released to OS

go_memstats_heap_sys_bytes
: Number of heap bytes obtained from system

go_memstats_last_gc_time_seconds
: Number of seconds since 1970 of last garbage collection

go_memstats_lookups_total
: Total number of pointer lookups

go_memstats_mallocs_total
: Total number of mallocs

go_memstats_mcache_inuse_bytes
: Number of bytes in use by mcache structures

go_memstats_mcache_sys_bytes
: Number of bytes used for mcache structures obtained from system

go_memstats_mspan_inuse_bytes
: Number of bytes in use by mspan structures

go_memstats_mspan_sys_bytes
: Number of bytes used for mspan structures obtained from system

go_memstats_next_gc_bytes
: Number of heap bytes when next garbage collection will take place

go_memstats_other_sys_bytes
: Number of bytes used for other system allocations

go_memstats_stack_inuse_bytes
: Number of bytes in use by the stack allocator

go_memstats_stack_sys_bytes
: Number of bytes obtained from system for stack allocator

go_memstats_sys_bytes
: Number of bytes obtained from system

go_threads
: Number of OS threads created

promhttp_metric_handler_requests_in_flight
: Current number of scrapes being served

promhttp_metric_handler_requests_total
: Total number of scrapes by HTTP status code
10 changes: 10 additions & 0 deletions docs/extensions/onlyoffice/license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "License"
date: 2018-05-02T00:00:00+00:00
weight: 40
geekdocRepo: https://github.com/owncloud/ocis/onlyoffice
geekdocEditPath: edit/master/docs
geekdocFilePath: license.md
---

This project is licensed under the [Apache 2.0](https://github.com/owncloud/ocis/onlyoffice/blob/master/LICENSE) license. For the license of the used libraries you have to check the respective sources.
2 changes: 2 additions & 0 deletions ocis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ require (
github.com/owncloud/ocis/ocis-phoenix v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/ocis-pkg v0.1.0
github.com/owncloud/ocis/ocs v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/onlyoffice v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/proxy v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/settings v0.0.0-20200918114005-1a0ddd2190ee
github.com/owncloud/ocis/storage v0.0.0-20201015120921-38358ba4d4df
Expand All @@ -44,6 +45,7 @@ replace (
github.com/owncloud/ocis/ocis-phoenix => ../ocis-phoenix
github.com/owncloud/ocis/ocis-pkg => ../ocis-pkg
github.com/owncloud/ocis/ocs => ../ocs
github.com/owncloud/ocis/onlyoffice => ../onlyoffice
github.com/owncloud/ocis/proxy => ../proxy
github.com/owncloud/ocis/settings => ../settings
github.com/owncloud/ocis/storage => ../storage
Expand Down
3 changes: 3 additions & 0 deletions ocis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us
github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-bindata/go-bindata v3.1.1+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi v4.1.0+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8=
Expand Down Expand Up @@ -1208,6 +1209,8 @@ github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20200828085053-37fcf3c8f853 h1:ei
github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20200828085053-37fcf3c8f853/go.mod h1:vnpYlDkhVoiuUAuTnY4Ajz2d5Alz0c/49AxptOLTpYA=
github.com/owncloud/ocis-pkg v1.3.0/go.mod h1:Wo0QfOmhadh2vNcUoQIsw2yaOT3zeftk+xaOOwP3y88=
github.com/owncloud/ocis-pkg/v2 v2.0.1/go.mod h1:7bVnn3VUaqdmvpMkXF0QVEF1fRugs35hSkuVTAq9yjk=
github.com/owncloud/ocis-pkg/v2 v2.2.0/go.mod h1:MXv7QzsYsu4YWuyJxhq1kLLmJa/r5gbqHe1FXulMHaw=
github.com/owncloud/ocis-pkg/v2 v2.4.0 h1:/3ZOd4txtwjiNKJA9iLT9BjrJw5YgHSX13fQR4BYfGY=
github.com/owncloud/ocis-pkg/v2 v2.4.0/go.mod h1:FSzIvhx9HcZcq4jgNaDowNvM7PTX/XCyoMvyfzidUpE=
github.com/owncloud/ocis-settings v0.3.2-0.20200827193534-8caf098e6537/go.mod h1:vRge9QDkOsc6j76gPBmZs1Z5uOPrV4DIkZCgZCEFwBA=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
Expand Down
Loading