Merge pull request #404 from haiwen/update_12.0_cluster_deployment

update 12.0 docker-cluster deployment & CLUSTER_INIT_ES_PORT default …
This commit is contained in:
Daniel Pan 2024-11-23 15:40:47 +08:00 committed by GitHub
commit 7f44aae88f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 280 additions and 26 deletions

View File

@ -45,7 +45,7 @@ INIT_S3_SECRET_KEY=<your-secret-key> # pro edition only
CLUSTER_INIT_MODE=true # cluster only
CLUSTER_INIT_MEMCACHED_HOST=<your memcached host> # cluster only
CLUSTER_INIT_ES_HOST=<your elasticsearch server HOST> # cluster only
CLUSTER_INIT_ES_PORT=<your elasticsearch server port> # cluster only
CLUSTER_INIT_ES_PORT=9200 # cluster only
CLUSTER_MODE=frontend # cluster only
@ -114,7 +114,7 @@ NOTIFICATION_SERVER_VOLUME=/opt/notification-data
- `CLUSTER_INIT_MODE`: (only valid in pro edition at deploying first time). Cluster initialization mode, in which the necessary configuration files for the service to run will be generated (but **the service will not be started**). If the configuration file already exists, no operation will be performed. The default value is `true`. When the configuration file is generated, ***be sure to set this item to `false`***.
- `CLUSTER_INIT_MEMCACHED_HOST`: (only valid in pro edition at deploying first time). Cluster Memcached host. (If your Memcached server dose not use port `11211`, please modify the [seahub_settings.py](./seahub_settings_py.md) and [seafile.conf](./seafile-conf.md)).
- `CLUSTER_INIT_ES_HOST`: (only valid in pro edition at deploying first time). Your cluster Elasticsearch server host.
- `CLUSTER_INIT_ES_PORT`: (only valid in pro edition at deploying first time). Your cluster Elasticsearch server port.
- `CLUSTER_INIT_ES_PORT`: (only valid in pro edition at deploying first time). Your cluster Elasticsearch server port. Default is `9200`.
- `CLUSTER_MODE`: Seafile service node type, i.e., `frontend` (default) or `backend`
## S3 storage backend configurations (only valid in pro edition at deploying first time)

View File

@ -15,7 +15,7 @@ SEAFILE_MYSQL_DB_PASSWORD=<MySQL password for user seafile>
CLUSTER_INIT_MODE=true # if you have the configurations file, please set to false
CLUSTER_INIT_MEMCACHED_HOST=<your memcached host> # only valid in config init
CLUSTER_INIT_ES_HOST=<your elasticsearch server HOST> # only valid in config init
CLUSTER_INIT_ES_PORT=<your elasticsearch server port> # only valid in config init
CLUSTER_INIT_ES_PORT=9200 # only valid in config init
CLUSTER_MODE=frontend # backend for backend node

View File

@ -18,7 +18,7 @@ services:
- CLUSTER_INIT_MODE=${CLUSTER_INIT_MODE:-false}
- CLUSTER_INIT_MEMCACHED_HOST=${CLUSTER_INIT_MEMCACHED_HOST:-}
- CLUSTER_INIT_ES_HOST=${CLUSTER_INIT_MEMCACHED_HOST:-}
- CLUSTER_INIT_ES_PORT=${CLUSTER_INIT_ES_PORT:-}
- CLUSTER_INIT_ES_PORT=${CLUSTER_INIT_ES_PORT:-9200}
- CLUSTER_MODE=${CLUSTER_MODE:-frontend}
- TIME_ZONE=${TIME_ZONE:-UTC}
- INIT_S3_STORAGE_BACKEND_CONFIG=${INIT_S3_STORAGE_BACKEND_CONFIG:-false}

View File

@ -10,6 +10,24 @@ Since Seafile Professional edition 6.0.0, you can integrate Seafile with Collabo
Otherwise, you can follow the [official document](https://sdk.collaboraonline.com/docs/installation/CODE_Docker_image.html#code-docker-image) to deploy CollaboraOnline server on a separate host. Then you should follow [here](#Libreoffice-server-on-a-separate-host) to configure `seahub_settings.py` to enable online office.
!!! note
To integrate *LibreOffice* with Seafile, you have to enable **HTTPS** in your Seafile server:
=== "Deploy in Docker"
Modify `.env` file:
```sh
SEAFILE_SERVER_PROTOCOL=https
```
=== "Deploy from binary packages"
Please follow the links to enable https:
- [Nginx](../setup_binary/https_with_nginx.md)
- [Apache](../setup_binary/https_with_apache.md)
Download the `collabora.yml`
```sh
@ -33,10 +51,11 @@ COLLABORA_ENABLE_FILE_LOGGING=false # use file logs or not, see FQA
Add following config option to seahub_settings.py:
``` python
OFFICE_SERVER_TYPE = 'CollaboraOffice'
ENABLE_OFFICE_WEB_APP = True
OFFICE_WEB_APP_BASE_URL = 'http{s}://seafile.example.com:6232/hosting/discovery'
OFFICE_WEB_APP_BASE_URL = 'https://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

View File

@ -6,16 +6,6 @@ Seafile supports [OnlyOffice](https://www.onlyoffice.com/) to view/edit office f
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)
> From Seafile 12.0, OnlyOffice's JWT verification will be forced to enable
Secure communication between Seafile and OnlyOffice is granted by a shared secret. You can get the JWT secret by following command
```shell
pwgen -s 40 1
```
## Deployment of OnlyOffice
Download the `onlyoffice.yml`
@ -40,6 +30,13 @@ ONLYOFFICE_PORT=6233
ONLYOFFICE_JWT_SECRET=<your jwt secret>
```
!!! note
From Seafile 12.0, OnlyOffice's JWT verification will be forced to enable. Secure communication between Seafile and OnlyOffice is granted by a shared secret. You can get the JWT secret by following command
```shell
pwgen -s 40 1
```
Also modify `seahub_settings.py`
```py
@ -49,7 +46,8 @@ ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt',
ONLYOFFICE_JWT_SECRET = '<your jwt secret>'
```
> By default OnlyOffice will use port **6233** used for communication between Seafile and Document Server, You can modify the bound port by specifying `ONLYOFFICE_PORT`, and port in the term `ONLYOFFICE_APIJS_URL` in `seahub_settings.py` has been modified together.
!!! tip
By default OnlyOffice will use port **6233** used for communication between Seafile and Document Server, You can modify the bound port by specifying `ONLYOFFICE_PORT`, and port in the term `ONLYOFFICE_APIJS_URL` in `seahub_settings.py` has been modified together.
### Advanced: Custom settings of OnlyOffice
@ -101,7 +99,8 @@ docker-compose down
docker-compose up -d
```
After the installation process is finished, visit this page to make sure you have deployed OnlyOffice successfully: `http{s}://{your Seafile server's domain or IP}:6233/welcome`, you will get **Document Server is running** info at this page.
!!! success
After the installation process is finished, visit this page to make sure you have deployed OnlyOffice successfully: `http{s}://{your Seafile server's domain or IP}:6233/welcome`, you will get **Document Server is running** info at this page.
## FAQ

View File

@ -31,9 +31,16 @@ Here is the workflow when a user open sdoc file in browser
## Deployment method
SeaDoc has the following deployment methods:
SeaDoc has the following deployment methods with different situations:
=== "SeaDoc and Seafile docker are deployed on the same host"
- **Situation 1**: Deploy SeaDoc server with the same host as Seafile Server deploy in single-node docker mode
- **Situation 2**: Deploy SeaDoc server on:
- A new host
- Same host with Seafile server cluster (frontend node)
- Same host with Seafile server deploy from binary packages
=== "Situation 1"
Download the `seadoc.yml` and integrate SeaDoc in Seafile docker.
```shell
@ -48,7 +55,7 @@ SeaDoc has the following deployment methods:
ENABLE_SEADOC=true
SEADOC_SERVER_URL=https://example.seafile.com/sdoc-server
```
=== "Deploy SeaDoc on a new host"
=== "Situation 2"
Download and modify the `.env` and `seadoc.yml` files.
@ -70,7 +77,117 @@ SeaDoc has the following deployment methods:
| `SEAFILE_SERVER_PROTOCOL`| http or https |
!!! note
Please bind SeaDoc server url and ip in the load balance(or reverse proxy) configuration after starting SeaDoc server
By default, SeaDoc server listens to port `80`. If SeaDoc is deployed on the same machine as Seafile server (including deploying from binary packages and Seafile cluster mode), you need to change the **listening port of SeaDoc server** or **set up a proxy** for SeaDoc server.
=== "Modify listening port"
Modify `seadoc.yml`
```yml
services:
seadoc:
...
ports:
- "<your SeaDoc server port>:80"
...
```
Now your `SEADOC_SERVER_URL` should be:
```
{SEAFILE_SERVER_PROTOCOL}://{SEAFILE_SERVER_HOSTNAME}:<your SeaDoc server port>
```
=== "set up a proxy"
Modify `seafile.nginx.conf`
=== "Seafile cluster"
```
location /sdoc-server/ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
return 204;
}
proxy_pass http://sdoc-server:80/;
proxy_redirect off;
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-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100m;
}
location /socket.io {
proxy_pass http://sdoc-server:80;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_redirect off;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
```
=== "Seafile deploy from binary packages"
```
location /sdoc-server/ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
return 204;
}
proxy_pass http://127.0.0.1:80/;
proxy_redirect off;
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-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100m;
}
location /socket.io {
proxy_pass http://127.0.0.1:80;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_redirect off;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
```
Now your `SEADOC_SERVER_URL` should be:
```
{SEAFILE_SERVER_PROTOCOL}://{SEAFILE_SERVER_HOSTNAME}/sdoc-server/
```

View File

@ -39,7 +39,7 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
4. Modify the [variables](../config/env.md) in `.env` (especially the terms like `<...>`).
!!! tip
If you have already deployed AWS S3 storage backend and plan to apply it to Seafile cluster, you can modify the variables in `.env` to [set them synchronously during initialization](../config/env.md#s3-storage-backend-configurations-only-valid-in-pro-edition-at-deploying-first-time).
If you have already deployed S3 storage backend and plan to apply it to Seafile cluster, you can modify the variables in `.env` to [set them synchronously during initialization](../config/env.md#s3-storage-backend-configurations-only-valid-in-pro-edition-at-deploying-first-time).
5. Start the Seafile docker
@ -49,9 +49,65 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
$ docker compose up -d
```
Because CLUSTER_INIT_MODE is true in the `.env` file, Seafile docker will be started in init mode and generate configuration files.
!!! success "Cluster init mode"
Because CLUSTER_INIT_MODE is true in the `.env` file, Seafile docker will be started in init mode and generate configuration files. As the results, you can see the following lines if you trace the Seafile container (i.e., `docker logs seafile`):
```log
---------------------------------
This is your configuration
---------------------------------
server name: seafile
server ip/domain: seafile.example.com
seafile data dir: /opt/seafile/seafile-data
fileserver port: 8082
database: create new
ccnet database: ccnet_db
seafile database: seafile_db
seahub database: seahub_db
database user: seafile
Generating seafile configuration ...
done
Generating seahub configuration ...
-----------------------------------------------------------------
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------
run seafile server: ./seafile.sh { start | stop | restart }
run seahub server: ./seahub.sh { start <port> | stop | restart <port> }
-----------------------------------------------------------------
If you are behind a firewall, remember to allow input/output of these tcp ports:
-----------------------------------------------------------------
port of seafile fileserver: 8082
port of seahub: 8000
When problems occur, Refer to
https://download.seafile.com/published/seafile-manual/home.md
for information.
[2024-11-21 02:22:37] Updating version stamp
Start init
Init success
```
6. In initialization mode, the service will not be started. During this time you can check the generated configuration files (e.g., MySQL, Memcached, Elasticsearch) in configuration files:
6. Check the generated configuration files (e.g., MySQL, Memcached, Elasticsearch) in configuration files
- [seafevents.conf](../config/seafevents-conf.md)
- [seafile.conf](../config/seafile-conf.md)
- [seahub_settings.py](../config/seahub_settings_py.md)
@ -68,13 +124,47 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
- `INIT_S3_KEY_ID`
- `INIT_S3_SECRET_KEY`
8. Restart the container to start the service in frontend node
8. (Optional) You can follow [here](../extension/setup_seadoc.md#deployment-method) to deploy SeaDoc server (please refer ***Situation 2***). And then modify `SEADOC_SERVER_URL` in your `.env` file
9. Restart the container to start the service in frontend node
```sh
docker compose down
docker compose up -d
```
!!! success "Frontend node starts successfully"
After executing the above command, you can trace the logs of container `seafile` (i.e., `docker logs seafile`). You can see the following message if the frontend node starts successfully:
```logs
*** Running /etc/my_init.d/01_create_data_links.sh...
*** Booting runit daemon...
*** Runit started as PID 20
*** Running /scripts/enterpoint.sh...
2024-11-21 03:02:35 Nginx ready
2024-11-21 03:02:35 This is an idle script (infinite loop) to keep container running.
---------------------------------
Seafile cluster frontend mode
---------------------------------
Starting seafile server, please wait ...
License file /opt/seafile/seafile-license.txt does not exist, allow at most 3 trial users
Seafile server started
Done.
Starting seahub at port 8000 ...
Seahub is started
Done.
```
### Deploy seafile backend node
1. Create the mount directory
@ -98,8 +188,37 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
```sh
docker compose up -d
```
!!! success "Backend node starts successfully"
After executing the above command, you can trace the logs of container `seafile` (i.e., `docker logs seafile`). You can see the following message if the backend node starts successfully:
```logs
*** Running /etc/my_init.d/01_create_data_links.sh...
*** Booting runit daemon...
*** Runit started as PID 21
*** Running /scripts/enterpoint.sh...
2024-11-21 03:11:59 Nginx ready
2024-11-21 03:11:59 This is an idle script (infinite loop) to keep container running.
---------------------------------
Seafile cluster backend mode
---------------------------------
Starting seafile server, please wait ...
License file /opt/seafile/seafile-license.txt does not exist, allow at most 3 trial users
Seafile server started
Done.
Starting seafile background tasks ...
Done.
```
## Deployment load balance (Optional)
## Deploy load balance (Optional)
### Install HAproxy and Keepalived services