搭建Seafile共享云盘

在企业内部,文件的共享,交换是十分重要的需求。

本节,我们将搭建基于Seafile的共享云盘。

安装

首先,确保你的机器上已经安装了docker-compose。

接着,下载最新docker-compose,见地址)

我们需要略做修改:

  1. version: '2.0'
  2. services:
  3. db:
  4. image: mariadb:10.5
  5. container_name: seafile-mysql
  6. environment:
  7. - MYSQL_ROOT_PASSWORD=seafile123 # Requested, set the root's password of MySQL service.
  8. - MYSQL_LOG_CONSOLE=true
  9. volumes:
  10. - /Users/coder4/docker_data/seafile-mysql/db:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
  11. networks:
  12. - seafile-net
  13. memcached:
  14. image: memcached:1.5.6
  15. container_name: seafile-memcached
  16. entrypoint: memcached -m 256
  17. networks:
  18. - seafile-net
  19. seafile:
  20. image: seafileltd/seafile-mc:latest
  21. container_name: seafile
  22. ports:
  23. - "80:80"
  24. - "443:443" # If https is enabled, cancel the comment.
  25. volumes:
  26. - /Users/coder4/docker_data/seafile-data:/shared # Requested, specifies the path to Seafile data persistent store.
  27. environment:
  28. - DB_HOST=db
  29. - DB_ROOT_PASSWD=seafile123 # Requested, the value shuold be root's password of MySQL service.
  30. - TIME_ZONE=Etc/UTC # Optional, default is UTC. Should be uncomment and set to your local time zone.
  31. - SEAFILE_ADMIN_EMAIL=me@example.com # Specifies Seafile admin user, default is 'me@example.com'.
  32. - SEAFILE_ADMIN_PASSWORD=123456 # Specifies Seafile admin password, default is 'asecret'.
  33. - SEAFILE_SERVER_LETSENCRYPT=true # Whether to use https or not.
  34. - SEAFILE_SERVER_HOSTNAME=seafile.coder4.com # Specifies your host name if https is enabled.
  35. depends_on:
  36. - db
  37. - memcached
  38. networks:
  39. - seafile-net
  40. networks:
  41. seafile-net:

如上:

  • 修改了数据库的默认密码

  • 修改了volume的路径到本地~/docker_data下

  • 修改seafile的管理员密码

  • 并开启https和域名,要求域名必须公网可见

最后,我们创建所需的本地volume目录,并重启:

  1. mkdir /Users/coder4/docker_data/seafile-mysql/
  2. mkdir /Users/coder4/docker_data/seafile-data
  1. docker-compose up -d

浏览器 打开 地址 https://seafile.coder4.com 应该能出现如下登录界面了:

f

配置ldap

接下来,我们配置ldap

打开文件~/docker_data/seafile-data/seafile/conf/ccnet.conf,添加如下内容:

  1. [LDAP]
  2. HOST = ldap://10.1.172.136:389/
  3. BASE = dc=coder4,dc=com
  4. USER_DN = cn=readonly,dc=coder4,dc=com
  5. PASSWORD = readonly123
  6. LOGIN_ATTR = cn

重启服务

  1. docker-compose

使用zhangsan / 123546登录,成功!

下面,你可以尝试上传文件、共享群组了,这里不再赘述。