只介绍环境搭建 不介绍集成

一、环境要求

内核:Linux
操作系统:centos 或者 ubuntu
容器环境:docker
容器镜像:onlyoffice-documentserver




二、docker下载

Centos 下载 docker

https://download.docker.com/linux/centos/

Centos 7.3 docker yum

http://docker-release-blue-prod.s3-website-us-east-1.amazonaws.com/linux/centos/7/x86_64/stable/Packages/

Centos 静态包

http://docker-release-blue-prod.s3-website-us-east-1.amazonaws.com/linux/static/stable/x86_64/

所有系统下载地址

https://download.docker.com

Linux 下载地址

https://download.docker.com/linux

Docker 20.10下载

http://docker-release-blue-prod.s3-website-us-east-1.amazonaws.com/linux/centos/7/x86_64/stable/Packages/docker-ce-20.10.0-3.el7.x86_64.rpm

centos包安装
yum install docker-ce-20.10.0-3.el7.x86_64.rpm



三、docker-compose下载与安装

Docker-compose

https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64

下载
curl -O https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64

安装docker-compose

将下载的docker-compose 移动到/usr/bin目录下

mv ./docker-compose-Linux-x86_64 /usr/bin/docker-compose




四、以systemctl服务方式后台运行docker

配置docker服务

vim /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
 
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

运行docker systemctl

systemctl start docker

开机自动启动docker

systemctl enable docker

五、使用docker-compose运行onlyoffice

创建docker-compose.yml文件

vim docker-compose.yml

配置onlyoffice-documentserver onlyoffice-rabbitmq onlyoffice-postgresql

version: '2'
services:
  onlyoffice-documentserver:
    build:
      context: .
    container_name: onlyoffice-documentserver
    depends_on:
      - onlyoffice-postgresql
      - onlyoffice-rabbitmq
    environment:
      - DB_TYPE=postgres
      - DB_HOST=onlyoffice-postgresql
      - DB_PORT=5432
      - DB_NAME=onlyoffice
      - DB_USER=onlyoffice
      - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq
      # Uncomment strings below to enable the JSON Web Token validation.
      #- JWT_ENABLED=true
      #- JWT_SECRET=secret
      #- JWT_HEADER=Authorization
      #- JWT_IN_BODY=true
    ports:
      - '8088:80'
      - '443:443'
    stdin_open: true
    restart: always
    stop_grace_period: 60s
    volumes:
      - /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-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: always
    expose:
      - '5672'
    ports:
      - '5672:5672'

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

volumes:
  postgresql_data:

使用docker-compose后台运行onlyoffice

docker-compose up -d

运行之后的效果

在这里插入图片描述

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐