diff --git a/manual/extension/setup_seadoc.md b/manual/extension/setup_seadoc.md index fd06d55a1..a68c1b757 100644 --- a/manual/extension/setup_seadoc.md +++ b/manual/extension/setup_seadoc.md @@ -40,30 +40,33 @@ SeaDoc has the following deployment methods with different situations: - 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. +### SeaDoc and Seafile docker (single-node mode) are deployed on the same host + +1. Download the `seadoc.yml` and integrate SeaDoc in Seafile docker. ```shell wget https://manual.seafile.com/12.0/docker/seadoc.yml ``` - Modify `.env`, and insert `seadoc.yml` into `COMPOSE_FILE`, and enable SeaDoc server +2. Modify `.env`, and insert `seadoc.yml` into `COMPOSE_FILE`, and enable SeaDoc server ```shell COMPOSE_FILE='seafile-server.yml,caddy.yml,seadoc.yml' ENABLE_SEADOC=true - SEADOC_SERVER_URL=https://example.seafile.com/sdoc-server + SEADOC_SERVER_URL=https://seafile.example.com/sdoc-server ``` -=== "Situation 2" - Download and modify the `.env` and `seadoc.yml` files. +### SeaDoc deploys on a new host or the same host with Seafile server (cluster and standalone) + +1. Download and modify the `.env` and `seadoc.yml` files. ```sh wget https://manual.seafile.com/12.0/docker/seadoc/1.0/standalone/seadoc.yml wget -O .env https://manual.seafile.com/12.0/docker/seadoc/1.0/standalone/env ``` - Then modify the `.env` file according to your environment. The following fields are needed to be modified: + +2. Then modify the `.env` file according to your environment. The following fields are needed to be modified: | variable | description | |------------------------|---------------------------------------------------------------------------------------------------------------| @@ -76,120 +79,70 @@ SeaDoc has the following deployment methods with different situations: | `SEAFILE_SERVER_HOSTNAME`| Seafile host name | | `SEAFILE_SERVER_PROTOCOL`| http or https | - !!! note - 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: - - ":80" - ... - ``` - - Now your `SEADOC_SERVER_URL` should be: - ``` - {SEAFILE_SERVER_PROTOCOL}://{SEAFILE_SERVER_HOSTNAME}: - ``` - === "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/ - ``` +3. By default, SeaDoc server listens to port 80. If the port is already taken by another service (e.g., deploy SeaDoc on the same machine where Seafile server is running), ***you have to change the listening port of SeaDoc***: + + + Modify `seadoc.yml` + + ```yml + services: + seadoc: + ... + ports: + - ":80" + ... + ``` + +4. Modify `seafile.nginx.conf` to setup reverse proxy, **please replace `127.0.0.1:80` to `host:port` of your Seadoc server** + ``` + 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.01: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: + ```sh + {SEAFILE_SERVER_PROTOCOL}://{SEAFILE_SERVER_HOSTNAME}/sdoc-server/ + #e.g., https://seafile.example.com/sdoc-server/ + ``` + +## Start SeaDoc server Start SeaDoc server with the following command @@ -197,8 +150,6 @@ Start SeaDoc server with the following command docker compose up -d ``` - - Now you can use SeaDoc! ## SeaDoc directory structure diff --git a/manual/setup/cluster_deploy_with_docker.md b/manual/setup/cluster_deploy_with_docker.md index 85c162744..3679c64c3 100644 --- a/manual/setup/cluster_deploy_with_docker.md +++ b/manual/setup/cluster_deploy_with_docker.md @@ -12,7 +12,7 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate ## Deploy Seafile service -### Deploy seafile frontend nodes +### Deploy the first Seafile frontend node 1. Create the mount directory @@ -124,9 +124,14 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate - `INIT_S3_KEY_ID` - `INIT_S3_SECRET_KEY` -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 + !!! tip + We recommend that you check that the relevant configuration files are correct and copy the `SEAFILE_VOLUME` directory before the service is officially started, because only the configuration files are generated after initialization. You can directly migrate the entire copied `SEAFILE_VOLUME` to other nodes later: + + ```sh + cp -r /opt/seafile/shared /opt/seafile/shared-bak + ``` -9. Restart the container to start the service in frontend node +8. Restart the container to start the service in frontend node ```sh docker compose down @@ -165,6 +170,15 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate Done. ``` +### Deploy the others Seafile frontend nodes + +You can directly copy all the directories generated by the first frontend node, including the Docker-compose files (e.g., `seafile-server.yml`, `.env`) and modified configuration files, and then start the seafile docker container: + +```sh +docker compose down +docker compose up -d +``` + ### Deploy seafile backend node 1. Create the mount directory @@ -343,3 +357,7 @@ $ systemctl enable --now keepalived ``` So far, Seafile cluster has been deployed. + +## (Optional) Deploy SeaDoc server + +You can follow [here](../extension/setup_seadoc.md) to deploy SeaDoc server. And then modify `SEADOC_SERVER_URL` in your `.env` file