Build docs locally and multiple storage backends for docker

This commit is contained in:
yangheran 2024-03-15 10:42:11 +08:00
parent 238a66d28c
commit 2a5fcac9d7
2 changed files with 132 additions and 36 deletions

View File

@ -3,3 +3,13 @@
Manual for Seafile server
The web site: https://haiwen.github.io/seafile-admin-docs/
## Serve docs locally
These docs are built using 'mkdocs'. Install the tooling by running:
```
pip3 install mkdocs-material mkdocs-awesome-pages-plugin mkdocs-material-extensions
```
Start up the development server by running `mkdocs serve` in the project root directory. Browse at `http://127.0.0.1:8000/seafile-admin-docs/`.

View File

@ -12,7 +12,7 @@ To use this feature, you need to:
1. Define storage classes in seafile.conf.
2. Enable multiple backend feature in seahub and choose a mapping policy.
## Defining Storage Classes
## Outline
In Seafile server, a storage backend is represented by the concept of "storage class". A storage class is defined by specifying the following information:
@ -27,6 +27,8 @@ In Seafile server, a storage backend is represented by the concept of "storage c
commit, fs, and blocks can be stored in different storages. This provides the most flexible way to define storage classes.
## Seafile Configuration
As Seafile server before 6.3 version doesn't support multiple storage classes, you have to explicitly enable this new feature and define storage classes with a different syntax than how we define storage backend before.
First, you have to enable this feature in seafile.conf.
@ -44,45 +46,129 @@ memcached_options = --SERVER=<the IP of Memcached Server> --POOL-MIN=10 --POOL-M
* enable_storage_classes If this is set to true, the storage class feature is enabled. You must define the storage classes in a JSON file provided in the next configuration option.
* storage_classes_fileSpecifies the path for the JSON file that contains the storage class definition.
### Notes for Docker Installs
If installing Seafile as Docker containers, place the `seafile_storage_classes.json` file on your local disk in a sub-directory of the location that is mounted to the `seafile` container, and set the `storage_classes_file` configuration above to a path ***relative to the `/shared/` directory mounted on the `seafile` container***.
For example, if the configuration of the `seafile` container in your `docker-compose.yml` file is similar to the following:
```yaml
// docker-compose.yml
services:
seafile:
container_name: seafile
volumes:
- /opt/seafile-data:/shared
```
Then place the JSON file within any sub-directory of `/opt/seafile-data` (such as `/opt/seafile-data/conf/`) and then configure `seafile.conf` like so:
```toml
[storage]
enable_storage_classes = true
storage_classes_file = /shared/conf/seafile_storage_classes.json
[memcached]
memcached_options = --SERVER=<the IP of Memcached Server> --POOL-MIN=10 --POOL-MAX=100
```
## Defining Storage Backends
The JSON file is an array of objects. Each object defines a storage class. The fields in the definition corresponds to the information we need to specify for a storage class. Below is an example:
```
```json
[
{
"storage_id": "hot_storage",
"name": "Hot Storage",
"is_default": true,
"commits": {"backend": "s3", "bucket": "seafile-commits", "key": "ZjoJ8RPNDqP1vcdD60U4wAHwUQf2oJYqxN27oR09", "key_id": "AKIAIOT3GCU5VGCCL44A"},
"fs": {"backend": "s3", "bucket": "seafile-fs", "key": "ZjoJ8RPNDqP1vcdD60U4wAHwUQf2oJYqxN27oR09", "key_id": "AKIAIOT3GCU5VGCCL44A"},
"blocks": {"backend": "s3", "bucket": "seafile-blocks", "key": "ZjoJ8RPNDqP1vcdD60U4wAHwUQf2oJYqxN27oR09", "key_id": "AKIAIOT3GCU5VGCCL44A"}
},
{
"storage_id": "cold_storage",
"name": "Cold Storage",
"is_default": false,
"fs": {"backend": "fs", "dir": "/storage/seafile/seafile-data"},
"commits": {"backend": "fs", "dir": "/storage/seafile/seafile-data"},
"blocks": {"backend": "fs", "dir": "/storage/seafile/seaflle-data"}
},
{
"storage_id": "swift_storage",
"name": "Swift Storage",
"fs": {"backend": "swift", "tenant": "adminTenant", "user_name": "admin", "password": "openstack", "container": "seafile-commits", "auth_host": "192.168.56.31:5000", "auth_ver": "v2.0"},
"commits": {"backend": "swift", "tenant": "adminTenant", "user_name": "admin", "password": "openstack", "container": "seafile-fs", "auth_host": "192.168.56.31:5000", "auth_ver": "v2.0"},
"blocks": {"backend": "swift", "tenant": "adminTenant", "user_name": "admin", "password": "openstack", "container": "seafile-blocks", "auth_host": "192.168.56.31:5000", "auth_ver": "v2.0", "region": "RegionTwo"}
}
{
"storage_id": "ceph_storage",
"name": "ceph Storage",
"fs": {"backend": "ceph", "ceph_config": "/etc/ceph/ceph.conf", "pool": "seafile-fs"},
"commits": {"backend": "ceph", "ceph_config": "/etc/ceph/ceph.conf", "pool": "seafile-commits"},
"blocks": {"backend": "ceph", "ceph_config": "/etc/ceph/ceph.conf", "pool": "seafile-blocks"}
}
{
"storage_id": "hot_storage",
"name": "Hot Storage",
"is_default": true,
"commits": {
"backend": "s3",
"bucket": "seafile-commits",
"key": "ZjoJ8RPNDqP1vcdD60U4wAHwUQf2oJYqxN27oR09",
"key_id": "AKIAIOT3GCU5VGCCL44A"
},
"fs": {
"backend": "s3",
"bucket": "seafile-fs",
"key": "ZjoJ8RPNDqP1vcdD60U4wAHwUQf2oJYqxN27oR09",
"key_id": "AKIAIOT3GCU5VGCCL44A"
},
"blocks": {
"backend": "s3",
"bucket": "seafile-blocks",
"key": "ZjoJ8RPNDqP1vcdD60U4wAHwUQf2oJYqxN27oR09",
"key_id": "AKIAIOT3GCU5VGCCL44A"
}
},
{
"storage_id": "cold_storage",
"name": "Cold Storage",
"is_default": false,
"fs": {
"backend": "fs",
"dir": "/storage/seafile/seafile-data"
},
"commits": {
"backend": "fs",
"dir": "/storage/seafile/seafile-data"
},
"blocks": {
"backend": "fs",
"dir": "/storage/seafile/seaflle-data"
}
},
{
"storage_id": "swift_storage",
"name": "Swift Storage",
"fs": {
"backend": "swift",
"tenant": "adminTenant",
"user_name": "admin",
"password": "openstack",
"container": "seafile-commits",
"auth_host": "192.168.56.31:5000",
"auth_ver": "v2.0"
},
"commits": {
"backend": "swift",
"tenant": "adminTenant",
"user_name": "admin",
"password": "openstack",
"container": "seafile-fs",
"auth_host": "192.168.56.31:5000",
"auth_ver": "v2.0"
},
"blocks": {
"backend": "swift",
"tenant": "adminTenant",
"user_name": "admin",
"password": "openstack",
"container": "seafile-blocks",
"auth_host": "192.168.56.31:5000",
"auth_ver": "v2.0",
"region": "RegionTwo"
}
},
{
"storage_id": "ceph_storage",
"name": "ceph Storage",
"fs": {
"backend": "ceph",
"ceph_config": "/etc/ceph/ceph.conf",
"pool": "seafile-fs"
},
"commits": {
"backend": "ceph",
"ceph_config": "/etc/ceph/ceph.conf",
"pool": "seafile-commits"
},
"blocks": {
"backend": "ceph",
"ceph_config": "/etc/ceph/ceph.conf",
"pool": "seafile-blocks"
}
}
]
```
As you may have seen, the `commits`, `fs` and `blocks` information syntax is similar to what is used in `[commit_object_backend]`, `[fs_object_backend]` and `[block_backend]` section of seafile.conf.