Skip to content

Commit

Permalink
Merge pull request #375 from haiwen/update_integrate_collabora_online
Browse files Browse the repository at this point in the history
Update integrate collabora online
  • Loading branch information
freeplant authored Oct 26, 2024
2 parents 003cc42 + 7f52911 commit 6465ed1
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 114 deletions.
37 changes: 37 additions & 0 deletions manual/docker/pro/collabora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
services:
caddy:
ports:
- ${COLLABORA_PORT:-6232}:${COLLABORA_PORT:-6232}

collabora:
image: ${COLLABORA_IMAGE:-collabora/code:24.04.5.1.1}
container_name: seafile-collabora
expose:
- 9980
cap_add:
- MKNOD
environment:
- server_name=${SEAFILE_SERVER_HOSTNAME:?Variable is not set or empty}:${COLLABORA_PORT:-6232}
- username=${COLLABORA_USERNAME:?Variable is not set or empty}
- password=${COLLABORA_PASSWORD:?Variable is not set or empty}
- DONT_GEN_SSL_CERT=true
- TZ=${TIME_ZONE:-Europe/Berlin}
- extra_params=--o:admin_console.enable=${COLLABORA_ENABLE_ADMIN_CONSOLE:-true}
--o:ssl.enable=false
--o:ssl.termination=true
--o:user_interface.mode=classic
--o:remote_font_config.url=${COLLABORA_REMOTE_FONT:-}
--o:logging.file[@enable]=${COLLABORA_ENABLE_FILE_LOGGING:-false}
--o:logging.file.property[0]=/opt/cool/logs/coolwsd.log
#volumes:
# - "${COLLABORA_PATH:-/opt/collabora}/logs:/opt/cool/logs/" # chmod 777 needed
labels:
caddy: ${SEAFILE_SERVER_HOSTNAME:?Variable is not set or empty}:${COLLABORA_PORT:-6232}
caddy.reverse_proxy: "{{upstreams 9980}}"
networks:
- seafile-net

networks:
seafile-net:
name: seafile-net
136 changes: 61 additions & 75 deletions manual/extension/libreoffice_online.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,38 @@ Since Seafile Professional edition 6.0.0, you can integrate Seafile with Collabo

## Setup LibreOffice Online

Prepare an Ubuntu 20.04 or 22.04 64bit server with [docker](http://www.docker.com/) installed. Assign a domain name to this server, we use *collabora-online.seafile.com* here. Obtain and install valid TLS/SSL certificates for this server, we use [Let’s Encrypt](https://letsencrypt.org/). Then use Nginx to serve collabora online, config file example (source https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html):
!!! tip "Deployment Tips"

```
server {
listen 443 ssl;
server_name collabora-online.seafile.com;
ssl_certificate /etc/letsencrypt/live/collabora-online.seafile.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/collabora-online.seafile.com/privkey.pem;
# static files
location ^~ /browser {
proxy_pass https://127.0.0.1:9980;
proxy_set_header Host $http_host;
}
# WOPI discovery URL
location ^~ /hosting/discovery {
proxy_pass https://127.0.0.1:9980;
proxy_set_header Host $http_host;
}
# Capabilities
location ^~ /hosting/capabilities {
proxy_pass https://127.0.0.1:9980;
proxy_set_header Host $http_host;
}
# main websocket
location ~ ^/cool/(.*)/ws$ {
proxy_pass https://127.0.0.1:9980;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
# download, presentation and image upload
location ~ ^/(c|l)ool {
proxy_pass https://127.0.0.1:9980;
proxy_set_header Host $http_host;
}
# Admin Console websocket
location ^~ /cool/adminws {
proxy_pass https://127.0.0.1:9980;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
}
```
From Seafile 12.0, Seafile support integrating LibreOffice server on the same host (only support deploying with [Docker](../setup/setup_pro_by_docker.md) with sufficient cores and RAM), as you can follow the steps in this manual.

Otherwise, you can follow the [official document](https://sdk.collaboraonline.com/docs/installation/CODE_Docker_image.html#code-docker-image) to deploy LibreOffice server on a separate host. Then you should follow [here](#Libreoffice-server-on-a-separate-host) to configurate `seahub_settings.py` to enable online office.

then use the following command to setup/start Collabora Online (source https://sdk.collaboraonline.com/docs/installation/CODE_Docker_image.html#code-docker-image):
Download the `collabora.yml`

```
docker pull collabora/code
docker run -t -d -p 127.0.0.1:9980:9980 -e "aliasgroup1=https://<your-dot-escaped-domain>:443" -e "username=***" -e "password=***" --name code --restart always collabora/code
```sh
wget https://manual.seafile.com/12.0/docker/pro/collabora.yml
```

**NOTE:** the `domain` args is the domain name of your Seafile server, if your
Seafile server's domain name is *demo.seafile.com*, the command should be:
Insert `collabora.yml` to field `COMPOSE_FILE` lists (i.e., `COMPOSE_FILE='...,collabora.yml'`) and add the relative options in `.env`

```
docker run -t -d -p 127.0.0.1:9980:9980 -e "aliasgroup1=https://demo.seafile.com:443" -e "username=***" -e "password=***" --name code --restart always collabora/code
```
```sh

For more information about Collabora Online and how to deploy it, please refer to https://www.collaboraoffice.com
COLLABORA_IMAGE=collabora/code:24.04.5.1.1 # image of LibreOffice
COLLABORA_PORT=6232 # expose port
COLLABORA_USERNAME=<your LibreOffice admin username>
COLLABORA_PASSWORD=<your LibreOffice admin password>
COLLABORA_ENABLE_ADMIN_CONSOLE=true # enable admin console or not
COLLABORA_REMOTE_FONT= # remote font url
COLLABORA_ENABLE_FILE_LOGGING=false # use file logs or not, see FQA
```

## Config Seafile

**NOTE:** You must [enable https](../setup_binary/https_with_nginx.md) with valid TLS/SSL certificates with Seafile to use Collabora Online.

Add following config option to seahub_settings.py:

``` python
# From 6.1.0 CE version on, Seafile support viewing/editing **doc**, **ppt**, **xls** files via LibreOffice
# Add this setting to view/edit **doc**, **ppt**, **xls** files
OFFICE_SERVER_TYPE = 'CollaboraOffice'

# Enable LibreOffice Online
ENABLE_OFFICE_WEB_APP = True

# Url of LibreOffice Online's discovery page
# The discovery page tells Seafile how to interact with LibreOffice Online when view file online
# You should change `https://collabora-online.seafile.com/hosting/discovery` to your actual LibreOffice Online server address
OFFICE_WEB_APP_BASE_URL = 'https://collabora-online.seafile.com/hosting/discovery'
OFFICE_WEB_APP_BASE_URL = 'http{s}://seafile.example.com:6232/hosting/discovery'

# Expiration of WOPI access token
# WOPI access token is a string used by Seafile to determine the file's
Expand Down Expand Up @@ -127,4 +71,46 @@ Understanding how theintegration work will help you debug the problem. When a us
3. (LibreOffice Online->seahub) LibreOffice Online receives the request and sends a request to Seahub to get the file content
4. (LibreOffice Online->browser) LibreOffice Online sends the file preview page to the browser.

If you have a problem, please check the Nginx log for Seahub (for step 3) and Collabora Online to see which step is wrong.
## FQA

### About logs

LibreOffice Online container will output the logs in the stdout, you can use following command to access it

```sh
docker logs seafile-collabora
```

If you would like to use file to save log (i.e., a `.log` file), you can modify `.env` with following statment, and remove the notes in the `collabora.yml`

```sh
# .env
COLLABORA_ENABLE_FILE_LOGGING=True
COLLABORA_PATH=/opt/collabora # path of the collabora logs
```

```yml
# collabora.yml
# remove the following notes
...
services:
collabora:
...
volumes:
- "${COLLABORA_PATH:-/opt/collabora}/logs:/opt/cool/logs/" # chmod 777 needed
...
...
```

Create the logs directory, and restart Seafile server

```sh
mkdir -p /opt/collabora
chmod 777 /opt/collabora
docker compose down
docker compose up -d
```

### LibreOffice server on a separate host

If your LibreOffice server on a separate host, you just need to modify the `seahub_settings.py` similar to [deploy on the same host](#config-seafile). The only different is you have to change the field `OFFICE_WEB_APP_BASE_URL` to your LibreOffice host (e.g., `https://collabora-online.seafile.com/hosting/discovery`).
4 changes: 2 additions & 2 deletions manual/extension/only_office.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

From version 6.1.0+ on (including CE), Seafile supports [OnlyOffice](https://www.onlyoffice.com/) to view/edit office files online. In order to use OnlyOffice, you must first deploy an OnlyOffice server.

You can deploy OnlyOffice to the same machine as Seafile using the `onlyoffice.yml` provided by Seafile according to this document, or you can deploy it to a different machine according to [OnlyOffice official document](https://github.com/ONLYOFFICE/Docker-DocumentServer).
!!! tip "Deployment Tips"

> Note: Using the official documentation to deploy to the same machine as Seafile server is no longer recommended after 12.0
You can deploy OnlyOffice to the same machine as Seafile (only support deploying with [Docker](../setup/setup_pro_by_docker.md) with sufficient cores and RAM) using the `onlyoffice.yml` provided by Seafile according to this document, or you can deploy it to a different machine according to [OnlyOffice official document](https://github.com/ONLYOFFICE/Docker-DocumentServer).

## Generate JWT-Token (shared secret)

Expand Down
11 changes: 0 additions & 11 deletions manual/extension/setup_seadoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,3 @@ Placeholder spot for shared volumes. You may elect to store certain persistent i
## Database used by SeaDoc

SeaDoc used one database table `seahub_db.sdoc_operation_log` to store operation logs.

## FAQ

### About SSL

From Seafile 12.0, the SSL is handled by [***Caddy***](https://caddyserver.com/docs/). Caddy is a modern open source web server that mainly binds external traffic and internal services in [seafile docker](../setup/overview.md). The default caddy image is [`lucaslorentz/caddy-docker-proxy:2.9`](https://github.com/lucaslorentz/caddy-docker-proxy), which user only needs to correctly configure the following fields in `.env` to automatically complete the acquisition and update of the certificate:

```shell
SEAFILE_SERVER_PROTOCOL=https
SEAFILE_SERVER_HOSTNAME=example.com
```
52 changes: 26 additions & 26 deletions manual/setup/seafile_docker_autostart.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@ You can use one of the following methods to start Seafile container on system bo

1. Add docker-compose.service

`vim /etc/systemd/system/docker-compose.service`
`vim /etc/systemd/system/docker-compose.service`

```
[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service
[Service]
Type=forking
RemainAfterExit=yes
WorkingDirectory=/opt/
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
```
```
[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service
[Service]
Type=forking
RemainAfterExit=yes
WorkingDirectory=/opt/
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
```

Note: `WorkingDirectory` is the absolute path to the docker-compose.yml file directory.
Note: `WorkingDirectory` is the absolute path to the docker-compose.yml file directory.

2. Set the docker-compose.service file to 644 permissions

```
chmod 644 /etc/systemd/system/docker-compose.service
```
```
chmod 644 /etc/systemd/system/docker-compose.service
```

3. Load autostart configuration

```
systemctl daemon-reload
systemctl enable docker-compose.service
```
```
systemctl daemon-reload
systemctl enable docker-compose.service
```

## Method 2

Expand Down

0 comments on commit 6465ed1

Please sign in to comment.