# Office专用服务器


# 依赖环境
``` bash
apt update
apt install docker.io
```

/etc/docker/daemon.json
``` bash
# https://oz4vi93h.mirror.aliyuncs.com
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://oz4vi93h.mirror.aliyuncs.com"]
}
EOF
# 备用源地址
{
  "registry-mirrors": [
    "https://docker.m.daocloud.io"
  ]
}
# 重启设置源
systemctl daemon-reload
systemctl restart docker
# 下载镜像
docker pull gotenberg/gotenberg
```


# 核心服务
## 服务1：coolwsd
- 手册 https://sdk.collaboraonline.com/docs/installation/Configuration.html
- 配置 /etc/coolwsd/coolwsd.xml

``` bash
sudo docker build -t fmode-office .
```

## 服务2：gotenberg

``` bash
# 后台启动 haproxy代理
sudo docker run -d -p 3000:3000 gotenberg/gotenberg
sudo docker run -d -p 3001:3000 gotenberg/gotenberg
sudo docker run -d -p 3002:3000 gotenberg/gotenberg
sudo docker run -d -p 3003:3000 gotenberg/gotenberg
# 直接运行
sudo docker run --rm -p 3000:3000 gotenberg/gotenberg
```

``` nginx
 location /docs/ {
        rewrite ^/docs/(.*)$ /$1 break;  # 去掉/docs/前缀

        proxy_pass http://localhost:3000;  # 反向代理到本地的3000
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
```