[GH-ISSUE #175] Token not working correctly with docker-compose #99

Closed
opened 2026-02-26 09:36:19 +03:00 by kerem · 3 comments
Owner

Originally created by @SOIT-SF on GitHub (Jul 22, 2019).
Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/175

Originally assigned to: @agolybev on GitHub.

I'm trying to get the token feature working in the docker-compose file.

I was expecting to be able to turn the feature on and pass a password to the pram
JWT_SECRET
This doesn't seem to work or I'm doing something wrong.
I've been testing with the connection to Nextcloud. When Nextcloud asks for url and secret I put what I've created into the fields, but get back an error that it's unable to connect. But if I leave the secret blank then it's able to connect.
I'm running this on a ubuntu 18.04 machine here is the configuration file I'm running for testing.

version: '2'
services:
  onlyoffice-documentserver-data:
    container_name: onlyoffice-documentserver-data
    image: onlyoffice/documentserver:latest
    environment:
      - ONLYOFFICE_DATA_CONTAINER=true
      - POSTGRESQL_SERVER_HOST=onlyoffice-postgresql
      - POSTGRESQL_SERVER_PORT=5432
      - POSTGRESQL_SERVER_DB_NAME=onlyoffice  
      - POSTGRESQL_SERVER_USER=onlyoffice
      - AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq
      - REDIS_SERVER_HOST=onlyoffice-redis
      - REDIS_SERVER_PORT=6379
    stdin_open: true
    restart: always
    networks:
      - onlyoffice
    volumes:
       - /etc/onlyoffice
       - /var/www/onlyoffice/Data
       - /var/log/onlyoffice
       - /var/lib/onlyoffice/documentserver/App_Data/cache/files
       - /var/www/onlyoffice/documentserver-example/public/files
       - /usr/share/fonts
       
  onlyoffice-documentserver:
    image: onlyoffice/documentserver:latest
    depends_on:
      - onlyoffice-documentserver-data
      - onlyoffice-postgresql
      - onlyoffice-redis
      - onlyoffice-rabbitmq
    environment:
      - ONLYOFFICE_DATA_CONTAINER_HOST=onlyoffice-documentserver-data
      - BALANCE=uri depth 3
      - EXCLUDE_PORTS=443
      - HTTP_CHECK=GET /healthcheck
      - EXTRA_SETTINGS=http-check expect string true
      # Uncomment the string below to redirect HTTP request to HTTPS request.
      - FORCE_SSL=true
      - JWT_ENABLED=true
      - JWT_SECRET=<a password>
    stdin_open: true
    restart: always
    networks:
      - onlyoffice
    expose:
      - '80'
    volumes_from:
     - onlyoffice-documentserver-data

  onlyoffice-haproxy:
    container_name: onlyoffice-haproxy
    image: dockercloud/haproxy:1.5.1
    depends_on:
      - onlyoffice-documentserver
    environment:
      - MODE=http
      # Uncomment the string below to specify the path of ssl certificates
      - CERT_FOLDER=/certs/
    stdin_open: true
    links:
     - onlyoffice-documentserver
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      # Uncomment the string below to map a ssl certificate from host
      # to the proxy container
      #- /app/onlyoffice/DocumentServer/data/certs/onlyoffice.pem:/certs/cert1.pem
      - /data/onlyoffice/certs/onlyoffice.pem:/certs/cert1.pem
    restart: always
    networks:
     - onlyoffice
    ports:
      - '80:80'
      - '443:443'
      - '1936:1936'
       
  onlyoffice-redis:
    container_name: onlyoffice-redis
    image: redis
    restart: always
    networks:
     - onlyoffice
    expose:
      - '6379'

  onlyoffice-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: always
    networks:
     - onlyoffice
    expose:
      - '5672'

  onlyoffice-postgresql:
    container_name: onlyoffice-postgresql
    image: postgres:9.5
    environment:
      - POSTGRES_DB=onlyoffice
      - POSTGRES_USER=onlyoffice
    networks:
      - onlyoffice
    restart: always
    expose:
      - '5432'
    volumes:
      - postgresql_data:/var/lib/postgresql

networks:
  onlyoffice:
    driver: 'bridge'

volumes:
  postgresql_data:
Originally created by @SOIT-SF on GitHub (Jul 22, 2019). Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/175 Originally assigned to: @agolybev on GitHub. I'm trying to get the token feature working in the docker-compose file. I was expecting to be able to turn the feature on and pass a password to the pram JWT_SECRET This doesn't seem to work or I'm doing something wrong. I've been testing with the connection to Nextcloud. When Nextcloud asks for url and secret I put what I've created into the fields, but get back an error that it's unable to connect. But if I leave the secret blank then it's able to connect. I'm running this on a ubuntu 18.04 machine here is the configuration file I'm running for testing. ``` version: '2' services: onlyoffice-documentserver-data: container_name: onlyoffice-documentserver-data image: onlyoffice/documentserver:latest environment: - ONLYOFFICE_DATA_CONTAINER=true - POSTGRESQL_SERVER_HOST=onlyoffice-postgresql - POSTGRESQL_SERVER_PORT=5432 - POSTGRESQL_SERVER_DB_NAME=onlyoffice - POSTGRESQL_SERVER_USER=onlyoffice - AMQP_SERVER_URL=amqp://guest:guest@onlyoffice-rabbitmq - REDIS_SERVER_HOST=onlyoffice-redis - REDIS_SERVER_PORT=6379 stdin_open: true restart: always networks: - onlyoffice volumes: - /etc/onlyoffice - /var/www/onlyoffice/Data - /var/log/onlyoffice - /var/lib/onlyoffice/documentserver/App_Data/cache/files - /var/www/onlyoffice/documentserver-example/public/files - /usr/share/fonts onlyoffice-documentserver: image: onlyoffice/documentserver:latest depends_on: - onlyoffice-documentserver-data - onlyoffice-postgresql - onlyoffice-redis - onlyoffice-rabbitmq environment: - ONLYOFFICE_DATA_CONTAINER_HOST=onlyoffice-documentserver-data - BALANCE=uri depth 3 - EXCLUDE_PORTS=443 - HTTP_CHECK=GET /healthcheck - EXTRA_SETTINGS=http-check expect string true # Uncomment the string below to redirect HTTP request to HTTPS request. - FORCE_SSL=true - JWT_ENABLED=true - JWT_SECRET=<a password> stdin_open: true restart: always networks: - onlyoffice expose: - '80' volumes_from: - onlyoffice-documentserver-data onlyoffice-haproxy: container_name: onlyoffice-haproxy image: dockercloud/haproxy:1.5.1 depends_on: - onlyoffice-documentserver environment: - MODE=http # Uncomment the string below to specify the path of ssl certificates - CERT_FOLDER=/certs/ stdin_open: true links: - onlyoffice-documentserver volumes: - /var/run/docker.sock:/var/run/docker.sock # Uncomment the string below to map a ssl certificate from host # to the proxy container #- /app/onlyoffice/DocumentServer/data/certs/onlyoffice.pem:/certs/cert1.pem - /data/onlyoffice/certs/onlyoffice.pem:/certs/cert1.pem restart: always networks: - onlyoffice ports: - '80:80' - '443:443' - '1936:1936' onlyoffice-redis: container_name: onlyoffice-redis image: redis restart: always networks: - onlyoffice expose: - '6379' onlyoffice-rabbitmq: container_name: onlyoffice-rabbitmq image: rabbitmq restart: always networks: - onlyoffice expose: - '5672' onlyoffice-postgresql: container_name: onlyoffice-postgresql image: postgres:9.5 environment: - POSTGRES_DB=onlyoffice - POSTGRES_USER=onlyoffice networks: - onlyoffice restart: always expose: - '5432' volumes: - postgresql_data:/var/lib/postgresql networks: onlyoffice: driver: 'bridge' volumes: postgresql_data: ```
kerem 2026-02-26 09:36:19 +03:00
Author
Owner

@ShockwaveNN commented on GitHub (Jul 23, 2019):

@downright77086 Hi, I agree. There is some kind of problem using JWT in Docker-Compose.
You can try to use it without docker compose, with Docker image, but we need time to figure out what to do with compose

<!-- gh-comment-id:514243921 --> @ShockwaveNN commented on GitHub (Jul 23, 2019): @downright77086 Hi, I agree. There is some kind of problem using JWT in Docker-Compose. You can try to use it without docker compose, with Docker image, but we need time to figure out what to do with compose
Author
Owner

@SOIT-SF commented on GitHub (Sep 12, 2019):

Hi wondering if there is any update on this one

<!-- gh-comment-id:530985782 --> @SOIT-SF commented on GitHub (Sep 12, 2019): Hi wondering if there is any update on this one
Author
Owner

@agolybev commented on GitHub (Sep 23, 2019):

Hi @downright77086! You have to setup env variables JWT_ENABLED and JWT_SECRET to onlyoffice-documentserver-data container instead of onlyoffice-documentserver.

<!-- gh-comment-id:534182953 --> @agolybev commented on GitHub (Sep 23, 2019): Hi @downright77086! You have to setup env variables `JWT_ENABLED` and `JWT_SECRET` to `onlyoffice-documentserver-data` container instead of `onlyoffice-documentserver`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Docker-DocumentServer-ONLYOFFICE#99
No description provided.