diff --git a/manual/config/details_about_file_search.md b/manual/config/details_about_file_search.md index c7d94d2a..7c22a136 100644 --- a/manual/config/details_about_file_search.md +++ b/manual/config/details_about_file_search.md @@ -36,23 +36,51 @@ repo_files_index_name = your-repo-files-index-name # default is `repofiles` Full text search is not enabled by default to save system resources. If you want to enable it, you need to follow the instructions below. -First you have to set the value of `index_office_pdf` option in `seafevents.conf` to `true`. +### Modify `seafevents.conf` -Then restart seafile server +=== "Deploy in Docker" + ```sh + cd /opt/seafile-data/seafile/conf + nano seafevents.conf + ``` +=== "Deploy from binary packages" + ```sh + cd /opt/seafile/conf + nano seafevents.conf + ``` -``` - cd /data/haiwen/seafile-pro-server-1.7.0/ - ./seafile.sh restart +set `index_office_pdf` to `true` +```conf +... +[INDEX FILES] +... +index_office_pdf=true +... ``` -You need to delete the existing search index and recreate it. +### Restart Seafile server -``` - ./pro/pro.py search --clear - ./pro/pro.py search --update +=== "Deploy in Docker" + ```sh + docker exec -it seafile bash + cd /scripts + ./seafile.sh restart + + # delete the existing search index and recreate it + ./pro/pro.py search --clear + ./pro/pro.py search --update + ``` +=== "Deploy from binary packages" + ```sh + cd /opt/seafile/seafile-server-latest + ./seafile.sh restart + + # delete the existing search index and recreate it + ./pro/pro.py search --clear + ./pro/pro.py search --update + ``` -``` ## Common problems @@ -60,18 +88,27 @@ You need to delete the existing search index and recreate it. You can rebuild search index by running: -``` -./pro/pro.py search --clear -./pro/pro.py search --update +=== "Deploy in Docker" + ```sh + docker exec -it seafile bash + cd /scripts + ./pro/pro.py search --clear + ./pro/pro.py search --update + ``` +=== "Deploy from binary packages" + ```sh + cd /opt/seafile/seafile-server-latest + ./pro/pro.py search --clear + ./pro/pro.py search --update + ``` -``` +!!! tip + If this does not work, you can try the following steps: -If this does not work, you can try the following steps: - -1. Stop Seafile -2. Remove the old search index `rm -rf pro-data/search` -3. Restart Seafile -4. Wait one minute then run `./pro/pro.py search --update` + 1. Stop Seafile + 2. Remove the old search index `rm -rf pro-data/search` + 3. Restart Seafile + 4. Wait one minute then run `./pro/pro.py search --update` ### Access the AWS elasticsearch service using HTTPS @@ -106,12 +143,17 @@ The search index is updated every 10 minutes by default. So before the first ind * Make sure you have started Seafile Server * Update the search index manually: - -``` -cd haiwen/seafile-pro-server-2.0.4 -./pro/pro.py search --update - -``` +=== "Deploy in Docker" + ```sh + docker exec -it seafile bash + cd /scripts + ./pro/pro.py search --update + ``` +=== "Deploy from binary packages" + ```sh + cd /opt/seafile/seafile-server-latest + ./pro/pro.py search --update + ``` ### Encrypted files cannot be searched @@ -130,122 +172,16 @@ The search functionality is based on Elasticsearch, which is a java process. You Restart the seafile service to make the above changes take effect: -``` -./seafile.sh restart -./seahub.sh restart - -``` - -## Distributed indexing - -If you use a cluster to deploy Seafile, you can use distributed indexing to realize real-time indexing and improve indexing efficiency. The indexing process is as follows: - -![](../images/distributed-indexing.png) - -### Install redis and modify configuration files - -First, install redis on all frontend nodes(If you use redis cloud service, skip this step and modify the configuration files directly): - -For Ubuntu: - -``` -$ apt install redis-server -``` - -For CentOS: - -``` -$ yum install redis -``` - -Then, install python redis third-party package on all frontend nodes: - -``` -$ pip install redis -``` - -Next, modify the `seafevents.conf` on all frontend nodes, add the following config items: - -``` -[EVENTS PUBLISH] -mq_type=redis # must be redis -enabled=true - -[REDIS] -server=127.0.0.1 # your redis server host -port=6379 # your redis server port -password=xxx # your redis server password, if not password, do not set this item -``` - -Next, modify the `seafevents.conf` on the backend node to disable the scheduled indexing task, because the scheduled indexing task and the distributed indexing task conflict. - -``` -[INDEX FILES] -enabled=true - | - V -enabled=false -``` - -Next, restart Seafile to make the configuration take effect: - -``` -$ ./seafile.sh restart && ./seahub.sh restart -``` - -### Deploy distributed indexing - -First, prepare a seafes master node and several seafes slave nodes, the number of slave nodes depends on your needs. Deploy Seafile on these nodes, and copy the configuration files in the `conf` directory from the frontend nodes. The master node and slave nodes do not need to start Seafile, but need to read the configuration files to obtain the necessary information. - -Next, create a configuration file `index-master.conf` in the `conf` directory of the master node, e.g. - -``` -[DEFAULT] -mq_type=redis # must be redis - -[REDIS] -server=127.0.0.1 # your redis server host -port=6379 # your redis server port -password=xxx # your redis server password, if not password, do not set this item -``` - -Execute `./run_index_master.sh [start/stop/restart]` in the `seafile-server-last` directory to control the program to start, stop and restart. - -Next, create a configuration file `index-slave.conf` in the `conf` directory of all slave nodes, e.g. - -``` -[DEFAULT] -mq_type=redis # must be redis -index_workers=2 # number of threads to create/update indexes, you can increase this value according to your needs - -[REDIS] -server=127.0.0.1 # your redis server host -port=6379 # your redis server port -password=xxx # your redis server password, if not password, do not set this item -``` - -Execute `./run_index_worker.sh [start/stop/restart]` in the `seafile-server-last` directory to control the program to start, stop and restart. - -!!! note - - The index worker connects to backend storage directly. You don't need to run seaf-server in index worker node. - - - -### Some commands in distributed indexing - -Rebuild search index, execute in the `seafile-server-last` directory: - -``` -$ ./pro/pro.py search --clear -$ ./run_index_master.sh python-env index_op.py --mode resotre_all_repo -``` - -List the number of indexing tasks currently remaining, execute in the `seafile-server-last` directory: - -``` -$ ./run_index_master.sh python-env index_op.py --mode show_all_task -``` - - -The above commands need to be run on the master node. +=== "Deploy in Docker" + ```sh + docker exec -it seafile bash + cd /scripts + ./seafile.sh restart + ./seahub.sh restart + ``` +=== "Deploy from binary packages" + ```sh + cd /opt/seafile/seafile-server-latest + ./seafile.sh restart + ./seahub.sh restart + ``` diff --git a/manual/config/roles_permissions.md b/manual/config/roles_permissions.md index 4c54aa03..f3c0239d 100644 --- a/manual/config/roles_permissions.md +++ b/manual/config/roles_permissions.md @@ -1,26 +1,33 @@ # Roles and Permissions Support -You can add/edit roles and permission for users. A role is just a group of users with some pre-defined permissions, you can toggle user roles in user list page at admin panel. +You can add/edit roles and permission for users. A role is just a group of users with some pre-defined permissions, you can toggle user roles in user list page at admin panel. For most permissions, the meaning can be easily obtained from the variable name. The following is a further detailed introduction to some variables. -`role_quota` is used to set quota for a certain role of users. For example, we can set the quota of employee to 100G by adding `'role_quota': '100g'`, and leave other role of users to the default quota. +- `role_quota` is used to set quota for a certain role of users. For example, we can set the quota of employee to 100G by adding `'role_quota': '100g'`, and leave other role of users to the default quota. -`can_add_public_repo` is to set whether a role can create a public library, default is "False". +- `can_add_public_repo` is to set whether a role can create a public library, default is `False`. -!!! warning "The `can_add_public_repo` option will not take effect if you configure global `CLOUD_MODE = True`" + !!! tip "Since version 11.0.9 pro, `can_share_repo` is added to limit users' ability to share a library" -The `storage_ids` permission is used for assigning storage backends to users with specific role. More details can be found in [multiple storage backends](../setup/setup_with_multiple_storage_backends.md). + !!! warning "The `can_add_public_repo` option will not take effect if you configure global `CLOUD_MODE = True`" -Since version 10.0, `upload_rate_limit` and `download_rate_limit` are added to limit upload and download speed for users with different roles. **After configured the rate limit, run the following command in the `seafile-server-latest` directory to make the configuration take effect**: +- `storage_ids` permission is used for assigning storage backends to users with specific role. More details can be found in [multiple storage backends](../setup/setup_with_multiple_storage_backends.md). -``` -./seahub.sh python-env python3 seahub/manage.py set_user_role_upload_download_rate_limit -``` +- `upload_rate_limit` and `download_rate_limit` are added to limit upload and download speed for users with different roles. -Since version 11.0.9 pro, `can_share_repo` is added to limit users' ability to share a library. + !!! note + After configured the rate limit, run the following command in the `seafile-server-latest` directory to make the configuration take effect: + + ```sh + ./seahub.sh python-env python3 seahub/manage.py set_user_role_upload_download_rate_limit + ``` Seafile comes with two build-in roles `default` and `guest`, a default user is a normal user with permissions as followings: -``` +!!! tip "New in 12.0" + - `can_drag_drop_folder_to_sync`: allow or deny user to sync folder by draging and droping + - `can_export_files_via_mobile_client`: allow or deny user to export files in using mobile client + +```py 'default': { 'can_add_repo': True, 'can_share_repo': True, @@ -32,9 +39,11 @@ Seafile comes with two build-in roles `default` and `guest`, a default user is a 'can_generate_upload_link': True, 'can_send_share_link_mail': True, 'can_invite_guest': False, + 'can_drag_drop_folder_to_sync': True, 'can_connect_with_android_clients': True, 'can_connect_with_ios_clients': True, 'can_connect_with_desktop_clients': True, + 'can_export_files_via_mobile_client': True, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': True, @@ -44,7 +53,7 @@ Seafile comes with two build-in roles `default` and `guest`, a default user is a ``` While a guest user can only read files/folders in the system, here are the permissions for a guest user: -``` +```py 'guest': { 'can_add_repo': False, 'can_share_repo': False, @@ -56,9 +65,11 @@ While a guest user can only read files/folders in the system, here are the permi 'can_generate_upload_link': False, 'can_send_share_link_mail': False, 'can_invite_guest': False, + 'can_drag_drop_folder_to_sync': False, 'can_connect_with_android_clients': False, 'can_connect_with_ios_clients': False, 'can_connect_with_desktop_clients': False, + 'can_export_files_via_mobile_client': False, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': False, @@ -71,7 +82,7 @@ While a guest user can only read files/folders in the system, here are the permi If you want to edit the permissions of build-in roles, e.g. default users can invite guest, guest users can view repos in organization, you can add following lines to `seahub_settings.py` with corresponding permissions set to `True`. -``` +```py ENABLED_ROLE_PERMISSIONS = { 'default': { 'can_add_repo': True, @@ -83,10 +94,12 @@ ENABLED_ROLE_PERMISSIONS = { 'can_generate_share_link': True, 'can_generate_upload_link': True, 'can_send_share_link_mail': True, - 'can_invite_guest': True, + 'can_invite_guest': False, + 'can_drag_drop_folder_to_sync': True, 'can_connect_with_android_clients': True, 'can_connect_with_ios_clients': True, 'can_connect_with_desktop_clients': True, + 'can_export_files_via_mobile_client': True, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': True, @@ -97,16 +110,18 @@ ENABLED_ROLE_PERMISSIONS = { 'can_add_repo': False, 'can_share_repo': False, 'can_add_group': False, - 'can_view_org': True, + 'can_view_org': False, 'can_add_public_repo': False, 'can_use_global_address_book': False, 'can_generate_share_link': False, 'can_generate_upload_link': False, 'can_send_share_link_mail': False, 'can_invite_guest': False, + 'can_drag_drop_folder_to_sync': False, 'can_connect_with_android_clients': False, 'can_connect_with_ios_clients': False, 'can_connect_with_desktop_clients': False, + 'can_export_files_via_mobile_client': False, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': False, @@ -148,7 +163,7 @@ Users can invite a guest user by providing his/her email address, system will em If you want to add a new role and assign some users with this role, e.g. new role `employee` can invite guest and can create public library and have all other permissions a default user has, you can add following lines to `seahub_settings.py` -``` +```py ENABLED_ROLE_PERMISSIONS = { 'default': { 'can_add_repo': True, @@ -161,9 +176,11 @@ ENABLED_ROLE_PERMISSIONS = { 'can_generate_upload_link': True, 'can_send_share_link_mail': True, 'can_invite_guest': False, + 'can_drag_drop_folder_to_sync': True, 'can_connect_with_android_clients': True, 'can_connect_with_ios_clients': True, 'can_connect_with_desktop_clients': True, + 'can_export_files_via_mobile_client': True, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': True, @@ -181,9 +198,11 @@ ENABLED_ROLE_PERMISSIONS = { 'can_generate_upload_link': False, 'can_send_share_link_mail': False, 'can_invite_guest': False, + 'can_drag_drop_folder_to_sync': False, 'can_connect_with_android_clients': False, 'can_connect_with_ios_clients': False, 'can_connect_with_desktop_clients': False, + 'can_export_files_via_mobile_client': False, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': False, @@ -201,9 +220,11 @@ ENABLED_ROLE_PERMISSIONS = { 'can_generate_upload_link': True, 'can_send_share_link_mail': True, 'can_invite_guest': True, + 'can_drag_drop_folder_to_sync': True, 'can_connect_with_android_clients': True, 'can_connect_with_ios_clients': True, 'can_connect_with_desktop_clients': True, + 'can_export_files_via_mobile_client': True, 'storage_ids': [], 'role_quota': '', 'can_publish_repo': True, diff --git a/manual/config/seahub_customization.md b/manual/config/seahub_customization.md index c256d792..bf33531a 100644 --- a/manual/config/seahub_customization.md +++ b/manual/config/seahub_customization.md @@ -2,7 +2,16 @@ ## Customize Seahub Logo and CSS -Create a folder `/seahub-data/custom`. Create a symbolic link in `seafile-server-latest/seahub/media` by `ln -s ../../../seahub-data/custom custom`. +Create customize folder + +=== "Deploy in Docker" + ```sh + mkdir -p /opt/seafile-data/seahub/media/custom + ``` +=== "Deploy from binary packages" + ```sh + mkdir /opt/seafile/seafile-server-latest/seahub/media/custom + ``` During upgrading, Seafile upgrade script will create symbolic link automatically to preserve your customization. @@ -12,7 +21,7 @@ Add your logo file to `custom/` Overwrite `LOGO_PATH` in `seahub_settings.py` -```python +```py LOGO_PATH = 'custom/mylogo.png' ``` @@ -29,8 +38,8 @@ Add your favicon file to `custom/` Overwrite `FAVICON_PATH` in `seahub_settings.py` -```python -FAVICON_PATH = 'custom/favicon.png' +```py +LOGO_PATH = 'custom/favicon.png' ``` ### Customize Seahub CSS @@ -39,28 +48,24 @@ Add your css file to `custom/`, for example, `custom.css` Overwrite `BRANDING_CSS` in `seahub_settings.py` -```python -BRANDING_CSS = 'custom/custom.css' +```py +LOGO_PATH = 'custom/custom.css' ``` - ## Customize help page -**Note:** Since version 2.1. - -First go to the custom folder - -``` -cd /seahub-data/custom -``` - -then run the following commands - -``` -mkdir templates -mkdir templates/help -cp ../../seafile-server-latest/seahub/seahub/help/templates/help/install.html templates/help/ -``` +=== "Deploy in Docker" + ```sh + mkdir -p /opt/seafile-data/seahub/media/custom/templates/help/ + cd /opt/seafile-data/seahub/media/custom + cp ../../help/templates/help/install.html templates/help/ + ``` +=== "Deploy from binary packages" + ```sh + mkdir /opt/seafile/seafile-server-latest/seahub/media/custom/templates/help/ + cd /opt/seafile/seafile-server-latest/seahub/media/custom + cp ../../help/templates/help/install.html templates/help/ + ``` Modify the `templates/help/install.html` file and save it. You will see the new help page. @@ -100,7 +105,8 @@ CUSTOM_NAV_ITEMS = [ ] ``` -**Note: The `icon` field currently only supports icons in Seafile that begin with `sf2-icon`. You can find the list of icons here: +!!! note + The `icon` field currently only supports icons in Seafile that begin with `sf2-icon`. You can find the list of icons here: Then restart the Seahub service to take effect. diff --git a/manual/config/seahub_settings_py.md b/manual/config/seahub_settings_py.md index fb3b0258..b2df700a 100644 --- a/manual/config/seahub_settings_py.md +++ b/manual/config/seahub_settings_py.md @@ -11,34 +11,35 @@ Refer to [email sending documentation](sending_email.md). Seahub caches items(avatars, profiles, etc) on file system by default(/tmp/seahub_cache/). You can replace with Memcached or Redis. -### Memcached +=== "Memcached" -``` -# on Debian/Ubuntu 18.04+ -apt-get install memcached libmemcached-dev -y -pip3 install --timeout=3600 pylibmc django-pylibmc + ``` + # on Debian/Ubuntu 18.04+ + apt-get install memcached libmemcached-dev -y + pip3 install --timeout=3600 pylibmc django-pylibmc -systemctl enable --now memcached -``` + systemctl enable --now memcached + ``` -Add the following configuration to `seahub_settings.py`. + Add the following configuration to `seahub_settings.py`. -``` -CACHES = { - 'default': { - 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', - 'LOCATION': '127.0.0.1:11211', - }, -} + ``` + CACHES = { + 'default': { + 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', + 'LOCATION': '127.0.0.1:11211', + }, + } -``` + ``` +=== "Redis" -### Redis + !!! success "Redis supported is added in Seafile version 11.0" -Redis support is added in version 11.0. + 1. Install Redis with package installers in your OS. -Please refer to [Django's documentation about using Redis cache](https://docs.djangoproject.com/en/4.2/topics/cache/#redis). + 2. Please refer to [Django's documentation about using Redis cache](https://docs.djangoproject.com/en/4.2/topics/cache/#redis). ## Security settings @@ -526,12 +527,19 @@ def custom_get_groups(request): !!! danger "You should NOT change the name of `custom_get_groups` and `seahub_custom_functions/__init__.py`" -!!! success +!!! tip * You need to restart seahub so that your changes take effect. + === "Deploy in Docker" + ```bash + docker exec -it seafile bash + cd /scripts + ./seahub.sh restart + ``` + === "Deploy from binary packages" + ```bash + cd /opt/seafile/seafile-server-latest + ./seahub.sh restart + ``` + * If your changes don't take effect, You may need to delete 'seahub_setting.pyc'. (A cache file) - - ```bash - ./seahub.sh restart - - ``` diff --git a/manual/extension/distributed_indexing.md b/manual/extension/distributed_indexing.md new file mode 100644 index 00000000..101fe78f --- /dev/null +++ b/manual/extension/distributed_indexing.md @@ -0,0 +1,122 @@ +# Distributed indexing + +If you use a cluster to deploy Seafile, you can use distributed indexing to realize real-time indexing and improve indexing efficiency. The indexing process is as follows: + +![](../images/distributed-indexing.png) + +## Install redis and modify configuration files + +### 1. Install redis on all frontend nodes + +!!! tip + If you use redis cloud service, skip this step and modify the configuration files directly + +=== "Ubuntu" + ``` + $ apt install redis-server + ``` +=== "CentOS" + ``` + $ yum install redis + ``` + +### 2. Install python redis third-party package on all frontend nodes + +``` +$ pip install redis +``` + +### 3. Modify the `seafevents.conf` on all frontend nodes + +Add the following config items + +``` +[EVENTS PUBLISH] +mq_type=redis # must be redis +enabled=true + +[REDIS] +server=127.0.0.1 # your redis server host +port=6379 # your redis server port +password=xxx # your redis server password, if not password, do not set this item +``` + +### 4. Modify the `seafevents.conf` on the backend node + +Disable the scheduled indexing task, because the scheduled indexing task and the distributed indexing task conflict. + +``` +[INDEX FILES] +enabled=true + | + V +enabled=false +``` + +### 5. Restart Seafile + +=== "Deploy in Docker" + ```sh + docker exec -it seafile bash + cd /scripts + ./seafile.sh restart && ./seahub.sh restart + ``` +=== "Deploy from binary packages" + ```sh + cd /opt/seafile/seafile-server-latest + ./seafile.sh restart && ./seahub.sh restart + ``` + +## Deploy distributed indexing + +First, prepare a seafes master node and several seafes slave nodes, the number of slave nodes depends on your needs. Deploy Seafile on these nodes, and copy the configuration files in the `conf` directory from the frontend nodes. The master node and slave nodes do not need to start Seafile, but need to read the configuration files to obtain the necessary information. + +Next, create a configuration file `index-master.conf` in the `conf` directory of the master node, e.g. + +``` +[DEFAULT] +mq_type=redis # must be redis + +[REDIS] +server=127.0.0.1 # your redis server host +port=6379 # your redis server port +password=xxx # your redis server password, if not password, do not set this item +``` + +Execute `./run_index_master.sh [start/stop/restart]` in the `seafile-server-last` directory (or `/scripts` inner the Seafile-docker container) to control the program to start, stop and restart. + +Next, create a configuration file `index-slave.conf` in the `conf` directory of all slave nodes, e.g. + +``` +[DEFAULT] +mq_type=redis # must be redis +index_workers=2 # number of threads to create/update indexes, you can increase this value according to your needs + +[REDIS] +server=127.0.0.1 # your redis server host +port=6379 # your redis server port +password=xxx # your redis server password, if not password, do not set this item +``` + +Execute `./run_index_worker.sh [start/stop/restart]` in the `seafile-server-last` directory (or `/scripts` inner the Seafile-docker container) to control the program to start, stop and restart. + +!!! note + + The index worker connects to backend storage directly. You don't need to run seaf-server in index worker node. + +## Some commands in distributed indexing + +Rebuild search index, execute in the `seafile-server-last` directory (or `/scripts` inner the Seafile-docker container): + +``` +$ ./pro/pro.py search --clear +$ ./run_index_master.sh python-env index_op.py --mode resotre_all_repo +``` + +List the number of indexing tasks currently remaining, execute in the `seafile-server-last` directory (or `/scripts` inner the Seafile-docker container): + +``` +$ ./run_index_master.sh python-env index_op.py --mode show_all_task +``` + +The above commands need to be run on the master node. diff --git a/mkdocs.yml b/mkdocs.yml index 7e54b4d7..d29f6658 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -134,6 +134,8 @@ nav: - Collabora Online Integration: extension/libreoffice_online.md - OnlyOffice Integration: extension/only_office.md - Office Online Server Integration (Pro): extension/office_web_app.md + - Cluster: + - Distributed indexing: extension/distributed_indexing.md - Virus Scan (Pro): - Outline: extension/virus_scan.md - Virus scan with ClamAV: extension/virus_scan_with_clamav.md