diff --git a/manual/docker/ce/env b/manual/docker/ce/env index a5351c6d..5fdfc4a9 100644 --- a/manual/docker/ce/env +++ b/manual/docker/ce/env @@ -32,3 +32,7 @@ SEADOC_VOLUME=/opt/seadoc-data ENABLE_SEADOC=false SEADOC_SERVER_URL=http://example.seafile.com/sdoc-server + + +NOTIFICATION_SERVER_IMAGE=seafileltd/notification-server:12.0-latest +NOTIFICATION_SERVER_VOLUME=/opt/notification-data diff --git a/manual/docker/notification-server.yml b/manual/docker/notification-server.yml index caa2a33c..8b394722 100644 --- a/manual/docker/notification-server.yml +++ b/manual/docker/notification-server.yml @@ -2,10 +2,10 @@ services: notification-server: image: ${NOTIFICATION_SERVER_IMAGE:-seafileltd/notification-server:12.0-latest} - container_name: seafile-notification-server + container_name: notification-server restart: always volumes: - - ${NOTIFICATION_SERVER_VOLUME:-/opt/notification-data/}:/shared + - ${NOTIFICATION_SERVER_VOLUME:-/opt/notification-data}:/shared # ports: # - "8083:8083" environment: @@ -15,7 +15,6 @@ services: - SEAFILE_MYSQL_DB_PASSWORD=${SEAFILE_MYSQL_DB_PASSWORD:?Variable is not set or empty} - SEAFILE_MYSQL_DB_CCNET_DB_NAME=${SEAFILE_MYSQL_DB_CCNET_DB_NAME:-ccnet_db} - SEAFILE_MYSQL_DB_SEAFILE_DB_NAME=${SEAFILE_MYSQL_DB_SEAFILE_DB_NAME:-seafile_db} - - TIME_ZONE=${TIME_ZONE:-Etc/UTC} - JWT_PRIVATE_KEY=${JWT_PRIVATE_KEY:?Variable is not set or empty} - SEAFILE_LOG_TO_STDOUT=${SEAFILE_LOG_TO_STDOUT:-false} - NOTIFICATION_SERVER_LOG_LEVEL=${NOTIFICATION_SERVER_LOG_LEVEL:-info} diff --git a/manual/docker/pro/env b/manual/docker/pro/env index 4c162a0b..1740a9d8 100644 --- a/manual/docker/pro/env +++ b/manual/docker/pro/env @@ -34,3 +34,7 @@ SEADOC_VOLUME=/opt/seadoc-data ENABLE_SEADOC=false SEADOC_SERVER_URL=http://example.seafile.com/sdoc-server + + +NOTIFICATION_SERVER_IMAGE=seafileltd/notification-server:12.0-latest +NOTIFICATION_SERVER_VOLUME=/opt/notification-data diff --git a/manual/extension/notification-server.md b/manual/extension/notification-server.md index 14db8eb9..44b7dc7e 100644 --- a/manual/extension/notification-server.md +++ b/manual/extension/notification-server.md @@ -16,108 +16,26 @@ The notification server uses websocket protocol and maintains a two-way communic ## How to configure and run -Since seafile-10.0.0, you can configure a notification server to send real-time notifications to clients. In order to run the notification server, you need to add the following configurations under seafile.conf: +Since seafile-12.0.0, we use docker to deploy the notification server. First deploy Seafile docker, then download `notification-server.yml` and modify the `.env` file: -``` -# jwt_private_key are required.You should generate it manually. -[notification] -enabled = true -# the ip of notification server. (Do not modify the host when using Nginx or Apache, as Nginx or Apache will proxy the requests to this address) -host = 127.0.0.1 -# the port of notification server -port = 8083 -# the log level of notification server -# You can set log_level to debug to print messages sent to clients. -log_level = info -# jwt_private_key is used to generate jwt token and authenticate seafile server -jwt_private_key = M@O8VWUb81YvmtWLHGB2I_V7di5-@0p(MF*GrE!sIws23F +```sh +wget https://manual.seafile.com/12.0/docker/notification-server.yml ``` -You can generate jwt_private_key with the following command: - -``` -# generate jwt_private_key -openssl rand -base64 32 +Modify `.env`, and insert `notification-server.yml` into `COMPOSE_FILE` +```env +COMPOSE_FILE='seafile-server.yml,caddy.yml,notification-server.yml' ``` -We generally recommend deploying notification server behind nginx, the notification server can be supported by adding the following nginx configuration: - -``` -map $http_upgrade $connection_upgrade { -default upgrade; -'' close; -} - -server { - location /notification/ping { - proxy_pass http://127.0.0.1:8083/ping; - access_log /var/log/nginx/notif.access.log; - error_log /var/log/nginx/notif.error.log; - } - - location /notification { - proxy_pass http://127.0.0.1:8083/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - access_log /var/log/nginx/notif.access.log; - error_log /var/log/nginx/notif.error.log; - } -} - -``` - -Or add the configuration for Apache: - -``` - ProxyPass /notification/ping http://127.0.0.1:8083/ping/ - ProxyPassReverse /notification/ping http://127.0.0.1:8083/ping/ - - ProxyPass /notification ws://127.0.0.1:8083/ - ProxyPassReverse /notification ws://127.0.0.1:8083/ -``` - -> According to [apache ProxyPass document](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass): - -> The configured ProxyPass and ProxyPassMatch rules are checked in the order of configuration. The first rule that matches wins. So usually you should sort conflicting ProxyPass rules starting with the longest URLs first. Otherwise, later rules for longer URLS will be hidden by any earlier rule which uses a leading substring of the URL. Note that there is some relation with worker sharing. - -the final configuration for Apache should be like: - -``` - # - # notification server - # - ProxyPass /notification/ping http://127.0.0.1:8083/ping/ - ProxyPassReverse /notification/ping http://127.0.0.1:8083/ping/ - - ProxyPass /notification ws://127.0.0.1:8083/ - ProxyPassReverse /notification ws://127.0.0.1:8083/ - - # - # seafile fileserver - # - ProxyPass /seafhttp http://127.0.0.1:8082 - ProxyPassReverse /seafhttp http://127.0.0.1:8082 - RewriteRule ^/seafhttp - [QSA,L] - - # - # seahub - # - SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 - ProxyPreserveHost On - ProxyPass / http://127.0.0.1:8000/ - ProxyPassReverse / http://127.0.0.1:8000/ -``` - -After that, you can run notification server with the following command: - -``` -./seafile.sh restart +You can run notification server with the following command: +```sh +docker compose up -d ``` ## Checking notification server status + When the notification server is working, you can access `http://127.0.0.1:8083/ping` from your browser, which will answer `{"ret": "pong"}`. If you have a proxy configured, you can access `https://{server}/notification/ping` from your browser instead. ## Compatible client @@ -137,19 +55,17 @@ There is no additional features for notification server in the Pro Edition. It w If you enable [clustering](../setup_binary/deploy_in_a_cluster.md), You need to deploy notification server on one of the servers, or a separate server. The load balancer should forward websockets requests to this node. -On each Seafile frontend node, the notification server configuration should be the same as in community edition: +Modify `notification-server.yml`, and open 8083 port -``` -[notification] -enabled = true -# the ip of notification server. -host = 192.168.1.134 -# the port of notification server -port = 8083 -# the log level of notification server -log_level = info -# jwt_private_key is used to generate jwt token and authenticate seafile server -jwt_private_key = M@O8VWUb81YvmtWLHGB2I_V7di5-@0p(MF*GrE!sIws23F +```yml +services: + + notification-server: + image: ${NOTIFICATION_SERVER_IMAGE:-seafileltd/notification-server:12.0-latest} + ... + ports: + - "8083:8083" + ... ``` You need to configure load balancer according to the following forwarding rules: diff --git a/manual/upgrade/upgrade_notes_for_12.0.x.md b/manual/upgrade/upgrade_notes_for_12.0.x.md index dbb6887d..073f3b05 100644 --- a/manual/upgrade/upgrade_notes_for_12.0.x.md +++ b/manual/upgrade/upgrade_notes_for_12.0.x.md @@ -80,6 +80,10 @@ Note: JWT_PRIVATE_KEY, A random string with a length of no less than 32 characte ### 4) Start Seafile-12.0.x server +### Upgrade notification server + +Since seafile-12.0.0, we use docker to deploy the notification server. Please follow the document to [enable notification server](../extension/notification-server.md) + ## Upgrade SeaDoc from 0.8 to 1.0 If you have deployed SeaDoc v0.8 with Seafile v11.0, you can upgrade it to 1.0 use the following two steps: