Skip to content

Instantly share code, notes, and snippets.

@andyklimczak
Created December 18, 2023 00:26
Show Gist options
  • Save andyklimczak/5db1b38bda40e27bc0ead17fa43b825b to your computer and use it in GitHub Desktop.
Save andyklimczak/5db1b38bda40e27bc0ead17fa43b825b to your computer and use it in GitHub Desktop.
Seafile docker setup

Don't want to run seafile on port 80, so changing the port to 8000 requires changing some other settings.

Using this docker-compose.yml

services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=db_dev  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /opt/seafile-mysql/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net

  memcached:
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "8000: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 should be root's password of MySQL service.
      - TIME_ZONE=Etc/UTC  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - [email protected] # Specifies Seafile admin user, default is '[email protected]'.
      - SEAFILE_ADMIN_PASSWORD=asecret     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=127.0.0.1  # Specifies your host name if https is enabled.
      - DEBUG=True
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

Run the docker compose to create the files locally to edit in next step.

Some error about csrf: haiwen/seafile#2707 (comment) Add this line that matches the ip of the server to seahub_settings at /opt/seafile-data/seafile/conf/seahub_settings.py

CSRF_TRUSTED_ORIGINS = ["192.168.1.171:8000"]

also update FILE_ROOT_SERVER and SERVICE_URL (doesn't seem to matter?)

http://192.168.1.171:8000/
http://192.168.1.171:8000/seafhttp

Should be able to log in now with credentials from docker compose.

Then navigate to System Settings: http://192.168.1.171:8000/sys/web-settings/ And update SERVICE_URL and FILE_SERVER_ROOT

Then try uploading file, should work

@fieri
Copy link

fieri commented Aug 14, 2024

seafile | *** Running /etc/my_init.d/01_create_data_links.sh...
seafile | *** Booting runit daemon...
seafile | *** Runit started as PID 17
seafile | *** Running /scripts/enterpoint.sh...
seafile | 2024-08-14 09:05:54 Nginx ready
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: Opened 3 undo tablespaces
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
seafile | 2024-08-14 09:05:54 This is an idle script (infinite loop) to keep container running.
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: log sequence number 41011615; transaction id 173614
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
seafile-mysql | 2024-08-14 1:05:54 0 [Note] Plugin 'FEEDBACK' is disabled.
seafile-mysql | 2024-08-14 1:05:54 0 [Note] Plugin 'wsrep-provider' is disabled.
seafile-mysql | 2024-08-14 1:05:54 0 [Note] InnoDB: Buffer pool(s) load completed at 240814 1:05:54
seafile-mysql | 2024-08-14 1:05:55 0 [Note] Server socket created on IP: '0.0.0.0'.
seafile-mysql | 2024-08-14 1:05:55 0 [Note] Server socket created on IP: '::'.
seafile-mysql | 2024-08-14 1:05:55 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
seafile-mysql | 2024-08-14 1:05:55 0 [Note] mariadbd: ready for connections.
seafile-mysql | Version: '11.4.3-MariaDB-ubu2404' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
seafile-mysql | 2024-08-14 1:05:56 3 [Warning] Aborted connection 3 to db: 'unconnected' user: 'root' host: '172.19.0.4' (Got an error reading communication packets)
seafile | [2024-08-14 09:05:56] Now running setup-seafile-mysql.py in auto mode.
seafile | Checking python on this machine ...
seafile |
seafile-mysql | 2024-08-14 1:05:57 5 [Warning] Access denied for user 'seafile'@'172.19.0.4' (using password: YES)
seafile |
seafile | verifying password of user root ... done
seafile |
seafile | verifying password of user seafile ...
seafile | Failed to connect to mysql server using user "seafile" and password "***": Access denied for user 'seafile'@'172.19.0.4' (using password: YES)
seafile |
seafile-mysql | 2024-08-14 1:05:57 4 [Warning] Aborted connection 4 to db: 'unconnected' user: 'root' host: '172.19.0.4' (Got an error reading communication packets)
seafile | Traceback (most recent call last):
seafile | File "/scripts/start.py", line 95, in
seafile | waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
seafile | main()
seafile | File "/scripts/start.py", line 59, in main
seafile | init_seafile_server()
seafile | File "/scripts/bootstrap.py", line 166, in init_seafile_server
seafile | call('{} auto -n seafile'.format(setup_script), env=env)
seafile | File "/scripts/utils.py", line 70, in call
seafile | return subprocess.check_call(*a, **kw)
seafile | File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
seafile | raise CalledProcessError(retcode, cmd)
seafile | subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-11.0.5/setup-seafile-mysql.sh auto -n seafile' returned non-zero exit status 255.

how to solve the problem? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment