Seafile部署
开发版官网部署文档:
Docker-compose.yml 内容
version: '2.0'services:db:image: mariadb:10.5container_name: seafile-mysqlenvironment:- MYSQL_ROOT_PASSWORD=db_dev # Requested, set the root's password of MySQL service.- MYSQL_LOG_CONSOLE=truevolumes:- /opt/seafile-mysql/db:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.networks:- seafile-netmemcached:image: memcached:1.6container_name: seafile-memcachedentrypoint: memcached -m 256networks:- seafile-netseafile:image: seafileltd/seafile-mc:latestcontainer_name: seafileports:- "10080:80"# - "443:443" # If https is enabled, cancel the comment.volumes:- /opt/seafile-data:/shared # Requested, specifies the path to Seafile data persistent store.environment:- DB_HOST=db- DB_ROOT_PASSWD=db_dev # Requested, the value shuold be root's password of MySQL service.# - TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone.- SEAFILE_ADMIN_EMAIL=me@example.com # Specifies Seafile admin user, default is 'me@example.com'.- SEAFILE_ADMIN_PASSWORD=asecret # Specifies Seafile admin password, default is 'asecret'.- SEAFILE_SERVER_LETSENCRYPT=false # Whether use letsencrypt to generate cert.- SEAFILE_SERVER_HOSTNAME=seafile.example.com # Specifies your host name.depends_on:- db- memcachednetworks:- seafile-netnetworks:seafile-net:
启动停止
如同正常的 docker-compose 一样管理就可以
# 启动docker-compose up -d# 停止docker-compose down
线上版本配置部署
线上版本如果需要绑定域名配 ssl,而且要使用宿主机的 nginx 来代理,需要修改 docker-compose.yml 和配置文件。
docker-compose.yml 文件修改,可以参考:
version: '2.0'services:db:image: mariadb:10.5container_name: seafile-mysqlenvironment:- MYSQL_ROOT_PASSWORD=db_dev # Requested, set the root's password of MySQL service.- MYSQL_LOG_CONSOLE=truevolumes:- /opt/seafile-mysql/db:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.networks:- seafile-netmemcached:image: memcached:1.6container_name: seafile-memcachedentrypoint: memcached -m 256networks:- seafile-netseafile:image: seafileltd/seafile-mc:latestcontainer_name: seafileports:- "10080:80" # 映射到 10080# - "443:443" # If https is enabled, cancel the comment.volumes:- /opt/seafile-data:/shared # Requested, specifies the path to Seafile data persistent store.environment:- DB_HOST=db- DB_ROOT_PASSWD=db_dev # Requested, the value shuold be root's password of MySQL service.# - TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone.- SEAFILE_ADMIN_EMAIL=me@example.com # Specifies Seafile admin user, default is 'me@example.com'.- SEAFILE_ADMIN_PASSWORD=asecret # Specifies Seafile admin password, default is 'asecret'.- SEAFILE_SERVER_LETSENCRYPT=false # Whether use letsencrypt to generate cert. # 不需要开启容器内的 ssl 证书申请- SEAFILE_SERVER_HOSTNAME=seafile.example.com # Specifies your host name. # 这边配置为公开域名depends_on:- db- memcachednetworks:- seafile-netnetworks:seafile-net:
在 nginx 中配置域名,并 proxy_pass 到应用的 10080 端口后,在 nginx 上配置自己的 ssl。
现在网站可以打开并登录了,但上传的文件则是 http 协议的,因为 docker-compose 中没有打开 ssl 开关,我们自己在 nginx 管理了 ssl,所以这边要另外改一下 seafile 的配置:
cat /opt/seafile-data/conf/seahub.conf修改里面的两处域名,改为 https 的域名,然后测试一下文件上传下载功能。
备份与恢复
只要备份 /opt/seafile-data 及 /opt/seafile-mysql 即可。