Sign inSign up

synology/spreadsheet-api

By synology

•Updated about 1 year ago

API server for Synology Spreadsheet

Image
API management
1

5.6K

synology/spreadsheet-api repository overview

⁠Synology Spreadsheet API

Spreadsheet API is not part of the Office package. This image provides a proxy service between clients and DSM. Each worker is dedicated to a single user and a single spreadsheet. An user can have multiple workers for different spreadsheets at the same time.

Note: It is DISCOURAGED to run the container and Office on the same DSM. The server can consume significant resources, especially if there are numerous active spreadsheets. The server performs essential computations when loading spreadsheets.

⁠Compatibility

Docker Image TagSynology Office
3.4.13.7.0 or higher
3.3.23.6.0 ~ 3.6.2

⁠API Guide

⁠Setup

Run the server with

docker run -e AUTH_SECRET=secret-key-for-auth-token -p '3000:3000' synology/spreadsheet-api:{tagname}

Below summarizes available environment variables (those with * are required):

VariablesDefaultDescription
AUTH_SECRET *NAThe secret key for JWT token. The server cannot run without this variable.
METRICS_TOKENNAMonitor server health by retrieving real-time metrics with the token. Keep it secret as the metrics may contain confidential data. Metrics are inaccessible if it is not set.
LOKI_HOSTNASend warnings and errors to a Loki server running on this URL. Keep it secret as the logs may contain confidential data. Logs are printed to stdout if it is not set.
HOST0.0.0.0The address the server listens to.
PORT3000The port the server listens to.
WORKER_TIMEOUT600,000Time (milliseconds) before closing an inactive worker.
USER_TIMEOUT60,000Time (milliseconds) before closing an user with no worker.

⁠Secure Connection

By default, the setup above only accepts HTTP connections. The following tools can be used to handle secure connections (HTTPS):

⁠Monitor

⁠Prometheus

Create jobs to collect metrics

# prometheus.yml
scrape_configs:
  - job_name: 'system-metrics'
    metrics_path: '/spreadsheets/admin/fastifyMetrics'
    params:
      metrics_token: ['{your METRICS_TOKEN}']
    static_configs:
      - targets: ['{your Spreadsheet API server ip}']
  - job_name: 'user-metrics'
    metrics_path: '/spreadsheets/admin/metrics'
    params:
      metrics_token: ['{your METRICS_TOKEN}']
    static_configs:
      - targets: ['{your Spreadsheet API server ip}']
⁠Loki

Run a Loki server on the URL specified by LOKI_HOST to collect logs.

# loki.yml
target: all
server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  wal:
    dir: /tmp/loki/wal
  chunk_idle_period: 30m
  chunk_retain_period: 0s
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2018-04-15
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb:
    directory: /tmp/loki/index
  filesystem:
    directory: /tmp/loki/chunks
⁠Grafana
  1. Run the server (refer to docker-compose.yml below)
  2. Import the dashboards : API⁠, CPU & Memory⁠, Node.js⁠
  3. Configure prometheus & loki data sources in UI
# docker-compose.yml

volumes:
  grafana-data-vol:

services:
  prometheus:
    image: prom/prometheus:latest
    command: [ "--config.file=/etc/prometheus/prometheus.yml" ]
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"
  loki:
    image: grafana/loki
    ports:
      - 3100:3100
    command: [ "-config.file=/etc/loki/loki.yml" ]
    volumes:
      - ./loki/loki.yml:/etc/loki/loki.yml
      - ./loki/index:/tmp/loki/index
      - ./loki/chunks:/tmp/loki/chunks
      - ./loki/wal:/tmp/loki/wal
  grafana:
    image: grafana/grafana
    volumes:
      - grafana-data-vol:/var/lib/grafana
    ports:
      - 3000:3000
    environment:
      - GF_SECURITY_ADMIN_USER={your username}
      - GF_SECURITY_ADMIN_PASSWORD={your password}
      - GF_SERVER_DOMAIN={your server domain}

Tag summary

Content type

Image

Digest

sha256:f991f0146…

Size

388.2 MB

Last updated

about 1 year ago

docker pull synology/spreadsheet-api