Skip to content

Commit 489f06a

Browse files
committed
v11.0.1
1 parent e05ba6d commit 489f06a

6 files changed

Lines changed: 54 additions & 28 deletions

File tree

Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1-
FROM ubuntu:22.04 as mysqlclient-builder
1+
FROM ubuntu:22.04 as builder
22
RUN apt-get update
33

44
RUN apt-get install --no-install-recommends -y \
55
python3 python3-pip python3-setuptools python3-wheel \
6-
libmysqlclient-dev python3-dev build-essential
6+
libmysqlclient-dev libsasl2-dev libldap2-dev python3-dev build-essential pkg-config
77

8-
RUN pip3 wheel --no-cache-dir mysqlclient
8+
RUN pip3 wheel --no-cache-dir mysqlclient==2.1.*
9+
10+
RUN pip3 wheel --no-cache-dir python-ldap==3.4.3
911

1012
FROM ubuntu:22.04
1113

1214
ENV LANG=C.UTF-8 \
1315
DEBIAN_FRONTEND=noninteractive
1416

15-
COPY --from=mysqlclient-builder /mysqlclient-*.whl /tmp/
17+
COPY --from=builder /mysqlclient-*.whl /python_ldap-*.whl /tmp/
1618

1719
RUN \
1820
apt-get update && \
1921
apt-get install --no-install-recommends -y \
20-
wget mysql-client libmysqlclient21 nginx ffmpeg python3 python3-pip python3-setuptools \
22+
wget mysql-client libmysqlclient21 libldap-2.5-0 ldap-utils nginx ffmpeg python3 python3-pip python3-setuptools \
2123
python3-pil python3-jinja2 python3-sqlalchemy python3-future python3-markupsafe python3-pycryptodome \
2224
python3-ldap3 python3-pylibmc python3-urllib3 python3-lxml python3-cffi && \
2325
ln -s /usr/bin/python3 /usr/bin/python && \
2426
pip3 install --no-cache-dir supervisor iniparse \
25-
pillow moviepy captcha django-pylibmc django-simple-captcha \
26-
/tmp/mysqlclient-*.whl && \
27+
pillow==10.0.* moviepy captcha==0.4 django-pylibmc django-simple-captcha==0.5.* \
28+
djangosaml2==1.5.* pysaml2==7.2.* \
29+
/tmp/mysqlclient-*.whl /tmp/python_ldap-*.whl && \
2730
apt-get remove -y --purge --autoremove python3-pip && \
2831
rm -rf /var/lib/apt/lists/* && \
2932
rm -f /etc/nginx/sites-enabled/*
@@ -33,7 +36,7 @@ RUN \
3336
wget -qO /usr/local/bin/crudini https://raw.githubusercontent.com/pixelb/crudini/0.9.3/crudini && \
3437
chmod +x /usr/local/bin/crudini
3538

36-
ENV SEAFILE_VERSION 10.0.1
39+
ENV SEAFILE_VERSION 11.0.1
3740
ENV SEAFILE_PATH "/opt/seafile/$SEAFILE_VERSION"
3841

3942
RUN \

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ version: '2'
1313
1414
services:
1515
seafile:
16-
image: foxel/seafile:10.0.1
16+
image: foxel/seafile:11.0.1
1717
ports:
1818
- "9080:80"
1919
environment:
@@ -27,7 +27,7 @@ services:
2727
MYSQL_RANDOM_ROOT_PASSWORD: 1
2828
volumes:
2929
- mysql:/var/lib/mysql
30-
image: mysql:5.7
30+
image: mysql:8.0
3131
3232
volumes:
3333
mysql:
@@ -40,6 +40,15 @@ volumes:
4040

4141
Upgrading is possible in step-by-step manner:
4242

43+
### 10.0.x => 11.0.x
44+
```
45+
docker-compose exec seafile /scripts/upgrade.sh 11.0.0
46+
```
47+
48+
Notes:
49+
* version 11 requires MySQL 8. Note the updated version in compose file example above. The container will do the upgrade on first start.
50+
* django 4 uses new CSRF token security policy. Make sure the SSL termination is set up to correctly set `X-Forwarded-Proto` and `Host` headers.
51+
4352
### 9.0.x => 10.0.x
4453
```
4554
docker-compose exec seafile /scripts/upgrade.sh 10.0.0

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
MYSQL_RANDOM_ROOT_PASSWORD: 1
1313
volumes:
1414
- mysql:/var/lib/mysql
15-
image: mysql:5.7
15+
image: mysql:8.0
1616

1717
volumes:
1818
mysql:

etc/nginx/nginx.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ http {
3232
set_real_ip_from 192.168.0.0/16;
3333
real_ip_header X-Real-IP;
3434

35+
# forwarding X-Forwarded-Proto from trusted proxies matching X-Real-IP config above
36+
map $realip_remote_addr $trusted_proxy {
37+
~^10\. 1; # 10.0.0.0/8;
38+
~^172\.(1[6-9]|2\d|3[01])\. 1; # 172.16.0.0/12;
39+
~^192\.168\. 1; # 192.168.0.0/16;
40+
default 0;
41+
}
42+
43+
map $trusted_proxy $forwarded_proto {
44+
1 $http_x_forwarded_proto;
45+
default $scheme;
46+
}
47+
3548
##
3649
# Logging Settings
3750
##

etc/nginx/sites-available/seafile.conf

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ server {
33
server_name "";
44

55
location / {
6-
proxy_pass http://127.0.0.1:8000;
7-
proxy_set_header Host $host;
8-
proxy_set_header X-Real-IP $remote_addr;
9-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10-
proxy_set_header X-Forwarded-Host $server_name;
6+
proxy_pass http://127.0.0.1:8000;
7+
proxy_set_header Host $http_host;
8+
proxy_set_header Forwarded "for=$remote_addr;proto=$forwarded_proto";
9+
proxy_set_header X-Real-IP $remote_addr;
10+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
11+
proxy_set_header X-Forwarded-Proto $forwarded_proto;
1112
proxy_read_timeout 1200s;
1213

1314
# used for view/edit office file via Office Online Server
@@ -18,24 +19,23 @@ server {
1819
}
1920
location /seafhttp/ {
2021
rewrite ^/seafhttp(.*)$ $1 break;
21-
proxy_pass http://127.0.0.1:8082;
22-
client_max_body_size 0;
23-
proxy_connect_timeout 36000s;
24-
proxy_read_timeout 36000s;
22+
proxy_pass http://127.0.0.1:8082;
23+
client_max_body_size 0;
24+
proxy_connect_timeout 36000s;
25+
proxy_read_timeout 36000s;
2526
}
2627
location /media/ {
2728
root /opt/seafile/latest/seahub;
2829
}
2930
location /seafdav {
30-
proxy_pass http://127.0.0.1:8080/seafdav;
31-
proxy_set_header Host $host;
32-
proxy_set_header X-Real-IP $remote_addr;
33-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
34-
proxy_set_header X-Forwarded-Host $server_name;
35-
proxy_set_header X-Forwarded-Proto $scheme;
31+
proxy_pass http://127.0.0.1:8080/seafdav;
32+
proxy_set_header Host $http_host;
33+
proxy_set_header X-Real-IP $remote_addr;
34+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
35+
proxy_set_header X-Forwarded-Proto $forwarded_proto;
3636

3737
proxy_read_timeout 1200s;
38-
client_max_body_size 0;
38+
client_max_body_size 0;
3939
access_log /var/log/nginx/seafdav.access.log;
4040
error_log /var/log/nginx/seafdav.error.log;
4141
}

scripts/upgrade.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ SQL_BASE_PATH="/opt/seafile/latest/upgrade/sql/${UPGRADE_VERSION}/mysql"
1313
for db in ccnet seafile seahub; do
1414
SQL_FILE="${SQL_BASE_PATH}/${db}.sql"
1515
if [[ -f "${SQL_FILE}" ]]; then
16-
mysql -hmysql -useafile -pseafile -f "${db}_db" < "${SQL_FILE}"
16+
# replaces `ADD INDEX IF NOT EXISTS` with `ADD INDEX` because it's not supported by MySQL 8
17+
sed -e 's/ADD\s*INDEX\s*IF\s*NOT\s*EXISTS/ADD INDEX/g' "${SQL_FILE}" | mysql -hmysql -useafile -pseafile -f "${db}_db"
1718
fi
1819
done
1920

0 commit comments

Comments
 (0)