Skip to content

Commit c8ca9ea

Browse files
authored
Merge pull request #427 from haiwen/update_12.0_cluster
Update 12.0 cluster
2 parents a0b7f78 + feb8c23 commit c8ca9ea

File tree

3 files changed

+213
-25
lines changed

3 files changed

+213
-25
lines changed

manual/docker/cluster/env

-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,4 @@ INIT_S3_AWS_REGION=us-east-1
3434
INIT_S3_HOST=s3.us-east-1.amazonaws.com
3535
INIT_S3_USE_HTTPS=true
3636

37-
3837
JWT_PRIVATE_KEY=<your jwt private key>

manual/setup/cluster_deploy_with_docker.md

+91-14
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ Seafile Docker cluster deployment requires "sticky session" settings in the load
44

55
## Environment
66

7+
!!! note "Prerequisites"
8+
9+
- We assume you have already deployed ***memcache***, ***MariaDB***, ***ElasticSearch*** in separate machines and use ***S3*** like object storage.
10+
11+
- Usually, each node of Seafile Cluster should have at least **2 cores** and **2G memory**. If the above services are deployed together with a node in the Seafile cluster, we recommend that you prepare **4 cores** and **4G memory** for the node (especially if ElasticSearch is also deployed on the node)
12+
713
System: Ubuntu 24.04
814

915
Seafile Server: 2 frontend nodes, 1 backend node
1016

11-
We assume you have already deployed memcache, MariaDB, ElasticSearch in separate machines and use S3 like object storage.
12-
1317
## Deploy Seafile service
1418

1519
### Deploy the first Seafile frontend node
@@ -22,13 +26,13 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
2226

2327
2. Pulling Seafile image
2428

29+
!!! tip
30+
Since v12.0, Seafile PE versions are hosted on DockerHub and does not require username and password to download.
31+
2532
```bash
2633
docker pull seafileltd/seafile-pro-mc:12.0-latest
2734
```
2835

29-
!!! note
30-
Since v12.0, Seafile PE versions are hosted on DockerHub and does not require username and password to download.
31-
3236
3. Download the `seafile-server.yml` and `.env`
3337

3438
```sh
@@ -45,8 +49,7 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
4549
5. Start the Seafile docker
4650

4751
```sh
48-
$ cd /opt/seafile
49-
$ docker compose up -d
52+
docker compose up -d
5053
```
5154

5255
!!! success "Cluster init mode"
@@ -155,12 +158,22 @@ We assume you have already deployed memcache, MariaDB, ElasticSearch in separate
155158

156159
### Deploy the others Seafile frontend nodes
157160

158-
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:
161+
1. Create the mount directory
159162

160-
```sh
161-
docker compose down
162-
docker compose up -d
163-
```
163+
```
164+
$ mkdir -p /opt/seafile/shared
165+
166+
```
167+
168+
2. Pull Seafile image
169+
170+
3. Copy `seafile-server.yml`, `.env `and configuration files from the first frontend node
171+
172+
4. Start the service
173+
174+
```sh
175+
docker compose up -d
176+
```
164177

165178
### Deploy seafile backend node
166179

@@ -171,7 +184,7 @@ docker compose up -d
171184
172185
```
173186

174-
2. Pulling Seafile image
187+
2. Pull Seafile image
175188

176189
3. Copy `seafile-server.yml`, `.env` and configuration files from frontend node
177190

@@ -217,7 +230,67 @@ docker compose up -d
217230

218231
## Deploy load balance (Optional)
219232

220-
### Install HAproxy and Keepalived services
233+
Generally speaking, in order to better access the Seafile service, we recommend that you use a load balancing service to access the Seafile cluster and bind your domain name (such as `seafile.cluster.com`) to the load balancing service. Usually, you can use:
234+
235+
- Cloud service provider's load balancing service
236+
- Deploy your own load balancing service, our document will give two of common load balance services:
237+
238+
- Nginx
239+
- HAproxy
240+
241+
### Nginx
242+
243+
1. Install Nginx in the host if you would like to deploy load balance service
244+
245+
```sh
246+
sudo apt update
247+
sudo apt install nginx
248+
```
249+
250+
2. Create the configurations file for Seafile cluster
251+
252+
```sh
253+
sudo nano /etc/nginx/sites-available/seafile-cluster
254+
```
255+
256+
and, add the following contents into this file:
257+
258+
```nginx
259+
upstream seafile_cluster {
260+
server <IP: your frontend node 1>:80;
261+
server <IP: your frontend node 2>:80;
262+
...
263+
}
264+
265+
server {
266+
listen 80;
267+
server_name <your domain>;
268+
269+
location / {
270+
proxy_pass http://seafile_cluster;
271+
proxy_set_header Host $host;
272+
proxy_set_header X-Real-IP $remote_addr;
273+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
274+
proxy_set_header X-Forwarded-Proto $scheme;
275+
http_502 http_503 http_504;
276+
}
277+
}
278+
```
279+
280+
3. Link the configurations file to `sites-enabled` directory:
281+
282+
```sh
283+
sudo ln -s /etc/nginx/sites-available/seafile-cluster /etc/nginx/sites-enabled/
284+
```
285+
286+
4. Test and enable configuration
287+
288+
```sh
289+
sudo nginx -t
290+
sudo nginx -s reload
291+
```
292+
293+
### HAproxy and Keepalived services
221294
222295
Execute the following commands on the two Seafile frontend servers:
223296
@@ -341,6 +414,10 @@ $ systemctl enable --now keepalived
341414
342415
So far, Seafile cluster has been deployed.
343416
417+
## HTTPS
418+
419+
You can engaged HTTPS in your load balance service, as you can use certificates manager (e.g., [Certbot](https://certbot.eff.org)) to acquire and enable HTTPS to your Seafile cluster. You have to modify the relative URLs from the prefix `http://` to `https://` in `seahub_settings.py` and `.env`, after enabling HTTPS.
420+
344421
## (Optional) Deploy SeaDoc server
345422
346423
You can follow [here](../extension/setup_seadoc.md) to deploy SeaDoc server. And then modify `SEADOC_SERVER_URL` in your `.env` file

manual/upgrade/upgrade_a_cluster_docker.md

+122-10
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,136 @@ Seafile adds new features in major and minor versions. It is likely that some da
1616
In general, to upgrade a cluster, you need:
1717

1818
1. Download the new image, stop the old docker container, modify the Seafile image version in docker-compose.yml to the new version. Start with docker compose up.
19-
2. Run the upgrade script in container (for example, /opt/seafile/seafile-server-latest/upgrade/upgrade_10_0_11_0.sh) in one frontend node
19+
2. Run the upgrade script in container (for example, `/opt/seafile/seafile-server-latest/upgrade/upgrade_x_x_x_x.sh`) in one frontend node
2020
3. Update configuration files at each node according to the documentation for each version
2121
4. Delete old search index in the backend node if needed
2222

23-
## Maintanence upgrade
23+
## Upgrade a cluster from Seafile 11 to 12
2424

25-
Maintanence upgrade only needs to download the new image, stop the old docker container, modify the Seafile image version in docker-compose.yml to the new version. Start with docker compose up.
25+
1. Stop the seafile service in all nodes
2626

27-
## Upgrade from 10.0 to 11.0
27+
```sh
28+
docker compose down
29+
```
2830

29-
Migrate your configuration for LDAP and OAuth according to [here](upgrade_notes_for_11.0.x.md)
31+
2. Download the docker-compose files for *Seafile 12*
3032

31-
## Upgrade from 9.0 to 10.0
33+
```sh
34+
wget -O .env https://manual.seafile.com/12.0/docker/cluster/env
35+
wget https://manual.seafile.com/12.0/docker/cluster/seafile-server.yml
36+
```
3237

33-
If you are using with ElasticSearch, SAML SSO and storage backend features, follow the upgrading manual on how to update the configuration for [these features](upgrade_notes_for_10.0.x.md).
38+
3. Modify `.env`:
3439

35-
If you want to use the new notification server and rate control (pro edition only), please refer to the [upgrading manual](upgrade_notes_for_10.0.x.md).
40+
- Generate a JWT key
3641

37-
## Upgrade from 8.0 to 9.0
42+
```sh
43+
pwgen -s 40 1
3844
39-
If you are using with ElasticSearch, follow the upgrading manual on how to [update the configuration](upgrade_notes_for_9.0.x.md).
45+
# e.g., EkosWcXonPCrpPE9CFsnyQLLPqoPhSJZaqA3JMFw
46+
```
47+
48+
- Fill up the following field according to your configurations using in *Seafile 11*:
49+
50+
```sh
51+
SEAFILE_SERVER_HOSTNAME=<your loadbalance's host>
52+
SEAFILE_SERVER_PROTOCOL=https # or http
53+
SEAFILE_MYSQL_DB_HOST=<your mysql host>
54+
SEAFILE_MYSQL_DB_USER=seafile # if you don't use `seafile` as your Seafile server's account, please correct it
55+
SEAFILE_MYSQL_DB_PASSWORD=<your mysql password for user `seafile`>
56+
JWT_PRIVATE_KEY=<your JWT key generated in Sec. 3.1>
57+
```
58+
59+
!!! tip "Remove the variables using in Cluster initialization"
60+
Since Seafile has been initialized in Seafile 11, the variables related to Seafile cluster initialization can be removed from `.env`:
61+
62+
- INIT_SEAFILE_MYSQL_ROOT_PASSWORD
63+
- CLUSTER_INIT_MODE
64+
- CLUSTER_INIT_MEMCACHED_HOST
65+
- CLUSTER_INIT_ES_HOST
66+
- CLUSTER_INIT_ES_PORT
67+
- INIT_S3_STORAGE_BACKEND_CONFIG
68+
- INIT_S3_COMMIT_BUCKET
69+
- INIT_S3_FS_BUCKET
70+
- INIT_S3_BLOCK_BUCKET
71+
- INIT_S3_KEY_ID
72+
- INIT_S3_USE_V4_SIGNATURE
73+
- INIT_S3_SECRET_KEY
74+
- INIT_S3_AWS_REGION
75+
- INIT_S3_HOST
76+
- INIT_S3_USE_HTTPS
77+
78+
4. Start the Seafile in a node
79+
80+
!!! note
81+
According to this upgrade document, a **frontend** service will be started here. If you plan to use this node as a backend node, you need to modify this item in `.env` and set it to `backend`:
82+
83+
```sh
84+
CLUSTER_MODE=backend
85+
```
86+
87+
```sh
88+
docker compose up -d
89+
```
90+
91+
5. Upgrade Seafile
92+
93+
```sh
94+
docker exec -it seafile bash
95+
# enter the container `seafile`
96+
97+
# stop servers
98+
cd /opt/seafile/seafile-server-latest
99+
./seafile.sh stop
100+
./seahub.sh stop
101+
102+
# upgrade seafile
103+
cd upgrade
104+
./upgrade_11.0_12.0.sh
105+
```
106+
107+
!!! success
108+
After upgrading the Seafile, you can see the following messages in your console:
109+
110+
```
111+
Updating seafile/seahub database ...
112+
113+
[INFO] You are using MySQL
114+
[INFO] updating seafile database...
115+
[INFO] updating seahub database...
116+
[INFO] updating seafevents database...
117+
Done
118+
119+
migrating avatars ...
120+
121+
Done
122+
123+
updating /opt/seafile/seafile-server-latest symbolic link to /opt/seafile/seafile-pro-server-12.0.6 ...
124+
125+
126+
127+
-----------------------------------------------------------------
128+
Upgraded your seafile server successfully.
129+
-----------------------------------------------------------------
130+
```
131+
132+
Then you can exit the container by `exit`
133+
134+
6. Restart current node
135+
136+
```sh
137+
docker compose down
138+
docker compose up -d
139+
```
140+
141+
!!! tip
142+
- You can use `docker logs -f seafile` to check whether the current node service is running normally
143+
144+
7. Operations for other nodes
145+
146+
- Download and modify `.env` similar to the first node (for backend node, you should set `CLUSTER_MODE=backend`)
147+
148+
- Start the Seafile server:
149+
```sh
150+
docker compose up -d
151+
```

0 commit comments

Comments
 (0)