onlyoffice

最后发布时间:2023-11-07 22:16:15 浏览量:

学习资料

onlyoffice包括

  • Community Server
  • Document Server (distributed as ONLYOFFICE Docs)
  • Mail Server
  • Talk (instant messaging app).
  • Control Panel

查看onlyoffice-community-server模块的数据库连接密码

cat /var/www/onlyoffice/WebStudio/web.connections.config

<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
  <clear />
  <add name="default" connectionString="Server=127.0.0.1;Database=onlyoffice;User ID=root;Password=12345;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none;AllowPublicKeyRetrieval=true;Connection Timeout=30;Maximum Pool Size=300;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>

配置邮件服务

sudo docker run --net onlyoffice -i -t --restart=always --name onlyoffice-mysql-server2 -p 3306:3306 \
 -v /app/onlyoffice/mysql/conf.d:/etc/mysql/conf.d \
 -v /app/onlyoffice/mysql/initdb:/docker-entrypoint-initdb.d \
 -e MYSQL_ROOT_PASSWORD=my-secret-pw \
 -e MYSQL_DATABASE=onlyoffice \
 mysql:8.0.29

docker run --init  --privileged -i -t --restart=always --name onlyoffice-mail-server2  -p 8081:8081 -p 25:25 -p 143:143 -p 587:587 \
 -e MYSQL_SERVER=192.168.10.30 \
 -e MYSQL_SERVER_PORT=3306 \
 -e MYSQL_ROOT_USER=root \
 -e MYSQL_ROOT_PASSWD=my-secret-pw \
 -e MYSQL_SERVER_DB_NAME=onlyoffice_mailserver \
 -h yourdomain.com \
 onlyoffice/mailserver

cat /etc/hosts

192.168.10.30   yourdomain

生信小木屋

Docker-MailServer使用的开源邮件程序是iRedMail。

ds-example进程

systemctl status ds-example.service
/etc/nginx/includes/ds-example.conf

location ~ ^(\/welcome\/.*)$ {
  expires 365d;
  alias /var/www/onlyoffice/documentserver-example$1;
  index linux.html;
}

location /example/ {
  proxy_pass http://example/;

  proxy_set_header X-Forwarded-Host $the_host;
  proxy_set_header X-Forwarded-Proto $the_scheme;
  proxy_set_header X-Forwarded-Path /example;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

配置nginx 80 代理自己的http服务

cat sites-available/onlyoffice可以看到该配置文件暴露端口是80,并且导入配置文件/etc/nginx/includes/onlyoffice-communityserver-*.conf

server {
	listen 80;
	charset utf-8;
    add_header Access-Control-Allow-Origin $header_access_control_allow_origin;
    add_header X-Frame-Options $header_x_frame_options;
	large_client_header_buffers 4 16k;
        set $X_REWRITER_URL $the_scheme://$the_host;
        if ($http_x_rewriter_url != '') {
                set $X_REWRITER_URL $http_x_rewriter_url ;
        }
	include /etc/nginx/includes/onlyoffice-communityserver-*.conf;
}

创建文件includes/onlyoffice-communityserver-php-proxy.conf,写入以下内容:

location /doc/ {
	proxy_pass http://localhost:8094;
	proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

创建文件conf.d/php.conf写入以下内容

server {
  listen 0.0.0.0:8094;
  listen [::]:8094 default_server;
 # server_tokens off;
 	index index.php index.html index.htm index.nginx-debian.html; 
        root /application/php/;
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php-fpm.sock;
        }	
  #set $secure_link_secret AxTkMQE01vw1wypnTYiP;
  #include /etc/nginx/includes/ds-*.conf;
}

通过解析deb取消插件安装节省网速

dpkg-deb -x onlyoffice-documentserver_7.4.1-36_amd64.deb onlyoffice-doc
dpkg-deb -e onlyoffice-documentserver_7.4.1-36_amd64.deb onlyoffice-doc

生信小木屋

生信小木屋

systemctl status ds-docservice.service
documentserver-pluginsmanager.sh -r false --update=/var/www/onlyoffice/documentserver/sdkjs-plugins/plugin-list-default.json

docker-compose.groups.yml

  • onlyoffice-mysql-server
  • onlyoffice-community-server
  • onlyoffice-elasticsearch
  • onlyoffice-control-panel
version: '3'
services:
  onlyoffice-mysql-server:
    container_name: onlyoffice-mysql-server
    image: mysql:8.0.29
    environment:
     - MYSQL_ROOT_PASSWORD=my-secret-pw
    networks:
     - onlyoffice
    stdin_open: true
    tty: true
    restart: always
    volumes:
     - ./config/mysql/conf.d:/etc/mysql/conf.d
     - ./config/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
     - mysql_data:/var/lib/mysql
  onlyoffice-community-server:
    container_name: onlyoffice-community-server
    image: onlyoffice/communityserver:12.0.1.1748
    depends_on:
     - onlyoffice-mysql-server
     - onlyoffice-elasticsearch
    environment:
     - ONLYOFFICE_CORE_MACHINEKEY=core_secret
     - CONTROL_PANEL_PORT_80_TCP=80
     - CONTROL_PANEL_PORT_80_TCP_ADDR=onlyoffice-control-panel
     - MYSQL_SERVER_ROOT_PASSWORD=my-secret-pw
     - MYSQL_SERVER_DB_NAME=onlyoffice
     - MYSQL_SERVER_HOST=onlyoffice-mysql-server
     - MYSQL_SERVER_USER=onlyoffice_user
     - MYSQL_SERVER_PASS=onlyoffice_pass
     - ELASTICSEARCH_SERVER_HOST=onlyoffice-elasticsearch
     - ELASTICSEARCH_SERVER_HTTPPORT=9200
    networks:
     - onlyoffice
    ports:
     - '80:80'
     - '443:443'
     - '5222:5222'
    stdin_open: true
    tty: true
    restart: always
    privileged: true
#    cgroup: host
    volumes:
     - community_data:/var/www/onlyoffice/Data
     - community_log:/var/log/onlyoffice
     - community_letsencrypt:/etc/letsencrypt
     - /sys/fs/cgroup:/sys/fs/cgroup:rw
     - ./certs:/var/www/onlyoffice/Data/certs
  onlyoffice-elasticsearch:
    image: onlyoffice/elasticsearch:7.16.3
    container_name: onlyoffice-elasticsearch
    restart: always
    environment:
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g -Dlog4j2.formatMsgNoLookups=true"
      - "indices.fielddata.cache.size=30%"
      - "indices.memory.index_buffer_size=30%" 
      - "ingest.geoip.downloader.enabled=false"
    networks:
    - onlyoffice    
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65535
        hard: 65535
    volumes:
      - es_data:/usr/share/elasticsearch/data
    expose:
      - "9200"
      - "9300"
  onlyoffice-control-panel:
    container_name: onlyoffice-control-panel
    depends_on:
     - onlyoffice-community-server
    image: onlyoffice/controlpanel:3.1.1.467
    environment:
     - ONLYOFFICE_CORE_MACHINEKEY=core_secret
    expose:
      - '80'
      - '443'
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - controlpanel_data:/var/www/onlyoffice/Data
      - controlpanel_log:/var/log/onlyoffice
    networks:
      - onlyoffice
    stdin_open: true
    tty: true
networks:
  onlyoffice:
    driver: 'bridge'
volumes:
  community_mysql:
  community_data:
  community_log:
  community_letsencrypt:
  controlpanel_data:
  controlpanel_log:
  mysql_data:
  es_data:

docker-compose.workspace.yml

  • onlyoffice-mysql-server
  • onlyoffice-community-server
  • onlyoffice-elasticsearch
  • onlyoffice-document-server
  • onlyoffice-mail-server
  • onlyoffice-control-panel
version: '3'
services:
  onlyoffice-mysql-server:
    container_name: onlyoffice-mysql-server
    image: mysql:8.0.29
    environment:
     - MYSQL_ROOT_PASSWORD=my-secret-pw
    networks:
     - onlyoffice
    stdin_open: true
    tty: true
    restart: always
    volumes:
     - ./config/mysql/conf.d:/etc/mysql/conf.d
     - ./config/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
     - mysql_data:/var/lib/mysql
  onlyoffice-community-server:
    container_name: onlyoffice-community-server
    image: onlyoffice/communityserver:12.0.1.1748
    depends_on:
     - onlyoffice-mysql-server
     - onlyoffice-document-server
     - onlyoffice-mail-server
     - onlyoffice-elasticsearch
    environment:
     - ONLYOFFICE_CORE_MACHINEKEY=core_secret
     - CONTROL_PANEL_PORT_80_TCP=80
     - CONTROL_PANEL_PORT_80_TCP_ADDR=onlyoffice-control-panel
     - DOCUMENT_SERVER_PORT_80_TCP_ADDR=onlyoffice-document-server
     - DOCUMENT_SERVER_JWT_ENABLED=true
     - DOCUMENT_SERVER_JWT_SECRET=jwt_secret
     - DOCUMENT_SERVER_JWT_HEADER=AuthorizationJwt
     - MYSQL_SERVER_ROOT_PASSWORD=my-secret-pw
     - MYSQL_SERVER_DB_NAME=onlyoffice
     - MYSQL_SERVER_HOST=onlyoffice-mysql-server
     - MYSQL_SERVER_USER=onlyoffice_user
     - MYSQL_SERVER_PASS=onlyoffice_pass
     - MAIL_SERVER_API_PORT=8081
     - MAIL_SERVER_API_HOST=onlyoffice-mail-server
     - MAIL_SERVER_DB_HOST=onlyoffice-mysql-server
     - MAIL_SERVER_DB_PORT=3306
     - MAIL_SERVER_DB_NAME=onlyoffice_mailserver
     - MAIL_SERVER_DB_USER=mail_admin
     - MAIL_SERVER_DB_PASS=Isadmin123
     - ELASTICSEARCH_SERVER_HOST=onlyoffice-elasticsearch
     - ELASTICSEARCH_SERVER_HTTPPORT=9200
    networks:
     - onlyoffice
    ports:
     - '80:80'
     - '443:443'
     - '5222:5222'
    stdin_open: true
    tty: true
    restart: always
    privileged: true
#    cgroup: host
    volumes:
     - community_data:/var/www/onlyoffice/Data
     - community_log:/var/log/onlyoffice
     - community_letsencrypt:/etc/letsencrypt
     - document_data:/var/www/onlyoffice/DocumentServerData
     - /sys/fs/cgroup:/sys/fs/cgroup:rw
     - ./certs:/var/www/onlyoffice/Data/certs
  onlyoffice-elasticsearch:
    image: onlyoffice/elasticsearch:7.16.3
    container_name: onlyoffice-elasticsearch
    restart: always
    environment:
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g -Dlog4j2.formatMsgNoLookups=true"
      - "indices.fielddata.cache.size=30%"
      - "indices.memory.index_buffer_size=30%" 
      - "ingest.geoip.downloader.enabled=false"
    networks:
    - onlyoffice    
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65535
        hard: 65535
    volumes:
      - es_data:/usr/share/elasticsearch/data
    expose:
      - "9200"
      - "9300"
  onlyoffice-document-server:
    container_name: onlyoffice-document-server
    image: onlyoffice/documentserver:7.1.1.23
    stdin_open: true
    tty: true
    restart: always
    environment:
     - JWT_ENABLED=true
     - JWT_SECRET=jwt_secret
     - JWT_HEADER=AuthorizationJwt
    networks:
      - onlyoffice
    expose:
      - '80'
      - '443'
    volumes:
       - document_data:/var/www/onlyoffice/Data
       - document_log:/var/log/onlyoffice
       - ./document_fonts:/usr/share/fonts/truetype/custom
       - document_forgotten:/var/lib/onlyoffice/documentserver/App_Data/cache/files/forgotten
  onlyoffice-mail-server:
    container_name: onlyoffice-mail-server
    image: onlyoffice/mailserver:1.6.75
    depends_on:
      - onlyoffice-mysql-server
    hostname: ${MAIL_SERVER_HOSTNAME}
    environment:
       - MYSQL_SERVER=onlyoffice-mysql-server
       - MYSQL_SERVER_PORT=3306
       - MYSQL_ROOT_USER=mail_admin
       - MYSQL_ROOT_PASSWD=Isadmin123
       - MYSQL_SERVER_DB_NAME=onlyoffice_mailserver
    networks:
      - onlyoffice
    restart: always
    privileged: true
    ports: ['25:25','143:143','587:587']
    stdin_open: true
    tty: true
    expose:
      - '8081'
      - '3306'
    volumes:
      - mail_data:/var/vmail
      - mail_certs:/etc/pki/tls/mailserver
      - mail_log:/var/log
  onlyoffice-control-panel:
    container_name: onlyoffice-control-panel
    depends_on:
     - onlyoffice-document-server
     - onlyoffice-mail-server
     - onlyoffice-community-server
    image: onlyoffice/controlpanel:3.1.1.467
    environment:
     - ONLYOFFICE_CORE_MACHINEKEY=core_secret
    expose:
      - '80'
      - '443'
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - controlpanel_data:/var/www/onlyoffice/Data
      - controlpanel_log:/var/log/onlyoffice
    networks:
      - onlyoffice
    stdin_open: true
    tty: true
networks:
  onlyoffice:
    driver: 'bridge'
volumes:
  mail_data:
  mail_certs:
  mail_log:
  mail_mysql:
  document_data:
  document_log:
  document_forgotten:
  community_mysql:
  community_data:
  community_log:
  community_letsencrypt:
  controlpanel_data:
  controlpanel_log:
  mysql_data:
  es_data:
+ systemctl enable onlyofficeRadicale.service
+ systemctl enable onlyofficeTelegram.service
+ systemctl enable onlyofficeSocketIO.service
+ systemctl enable onlyofficeThumb.service
+ systemctl enable onlyofficeFeed.service
+ systemctl enable onlyofficeIndex.service
+ systemctl enable onlyofficeJabber.service
+ systemctl enable onlyofficeMailAggregator.service
+ systemctl enable onlyofficeMailWatchdog.service
+ systemctl enable onlyofficeMailCleaner.service
+ systemctl enable onlyofficeNotify.service
+ systemctl enable onlyofficeBackup.service
+ systemctl enable onlyofficeStorageMigrate.service
+ systemctl enable onlyofficeStorageEncryption.service
+ systemctl enable onlyofficeUrlShortener.service
+ systemctl enable onlyofficeThumbnailBuilder.service
 mysql --silent --skip-column-names -h onlyoffice-mysql-server -P 3306 -u onlyoffice_user --password=onlyoffice_pass -D onlyoffice
mysql --silent --skip-column-names -h onlyoffice-mysql-server -P 3306 -u onlyoffice_user --password=onlyoffice_pass -D onlyoffice -e 'INSERT INTO mail_server_server (mx_record, connection_string, server_type, smtp_settings_id, imap_settings_id)                        VALUES ('\'''\'', '\''{"DbConnection" : "Server=onlyoffice-mysql-server;Database=onlyoffice_mailserver;User ID=mail_admin;Password=Isadmin123;Pooling=True;Character Set=utf8;AutoEnlist=false;SSL Mode=None;Connection Timeout=30;Maximum Pool Size=300;", "Api":{"Protocol":"http", "Server":"172.20.0.7", "Port":"8081", "Version":"v1","Token":""}}'\'', 2, '\''1002'\'', '\''1001'\'');'
 bash /app/assets/tools/wait-for-it.sh onlyoffice-document-server:8000 --quiet -s -- echo 'Document Server is up'