seafile

Seafile-Selhosted fileserver(alternative to dropbox,google-drive)

  1. Seafile is a fileserver written in C and php and latest 9.0 version is written in go self-hosted alternative to google drive.

  2. It performs better than nextcloud and handles large file uploads well.

  3. Seafile supports multiorganization, multitenant and cluster deployment

docker-compose deployment

  1. docker-compose file to run seafile, memcache and mariadb
# Filename: /srv/seaile/docker-compose.yml
# Purpose: To start seafile along with memcache and mariadb
# Url: https://drive.smounesh.in

version: "2.4"
services:
  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: drive.smounesh.in
    restart: always

    mem_limit: 2G

    environment:
      - DB_HOST=mariadb
      - DB_ROOT_PASSWD=${MYSQL_ROOT_PASSWORD}
      - TIME_ZONE=Asia/Kolkata
      - SEAFILE_SERVER_LETSENCRYPT=false
      - SEAFILE_SERVER_HOSTNAME=${SEAFILE_SERVER_HOSTNAME}
      - SEAFILE_ADMIN_EMAIL=${SEAFILE_ADMIN_EMAIL}
      - SEAFILE_ADMIN_PASSWORD=${SEAFILE_ADMIN_PASSWORD}

    volumes:
      - ./conf:/shared/seafile
      - ./logs:/shared/logs
      - ./nginx:/shared/nginx

    labels:
      - com.centurylinklabs.watchtower.enable=true
      - traefik.enable=true
      - traefik.http.routers.seafile.rule=Host(`drive.smounesh.in`)
      - traefik.http.routers.seafile.tls=true
      - traefik.http.routers.seafile.tls.certresolver=lets-encrypt
      #- traefik.http.routers.seafile.service=seafile-svc
      #- traefik.http.services.seafile-svc.loadbalancer.server.port=80

    depends_on:
       - mariadb

  memcached:
    image: memcached:1.6
    container_name: memcache-drive.smounesh.in
    restart: always

    mem_limit: 2G
    entrypoint: memcached -m 256

    labels:
      - com.centurylinklabs.watchtower.enable=true

    depends_on:
       - mariadb

  mariadb:
    image: mariadb:10.5
    container_name: mariadb-drive.smounesh.in
    restart: always

    mem_limit: 2G

    environment:
      -  MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}

    volumes:
      - ./database:/var/lib/mysql

    labels:
      - com.centurylinklabs.watchtower.enable=true

    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 5s
      timeout: 180s
      retries: 3
  1. Envfile to store credentials
SEAFILE_SERVER_HOSTNAME=drive.smounesh.in
SEAFILE_ADMIN_EMAIL=alita@smounesh.in
SEAFILE_ADMIN_PASSWORD=alita@2019

MYSQL_ROOT_PASSWORD=root_pass

To enable OAuth for google

file name seahub_settings.py add below code
Update http://localhost:8000/oauth/callback/ to your domain http://mydrive.bitsathy.ac.in/oauth/callback/

# Enable OAuth
ENABLE_OAUTH = True

# Usually OAuth works through SSL layer. If your server is not parametrized to allow HTTPS, some method will raise an "oauthlib.oauth2.rfc6749.errors.InsecureTransportError". Set this to `True` to avoid this error.
OAUTH_ENABLE_INSECURE_TRANSPORT = False

# If create new user when he/she logs in Seafile for the first time, defalut `True`.
OAUTH_CREATE_UNKNOWN_USER = False

# Client id/secret generated by authorization server when you register your client application.
OAUTH_CLIENT_ID = ""
OAUTH_CLIENT_SECRET = ""

# Callback url when user authentication succeeded. Note, the redirect url you input when you register your client application MUST be exactly the same as this value.
OAUTH_REDIRECT_URL = 'http://localhost:8000/oauth/callback/'

# The following shoud NOT be changed if you are using Google as OAuth provider.

OAUTH_PROVIDER_DOMAIN = 'google.com'
OAUTH_AUTHORIZATION_URL = 'https://accounts.google.com/o/oauth2/v2/auth'
OAUTH_TOKEN_URL = 'https://www.googleapis.com/oauth2/v4/token'
OAUTH_USER_INFO_URL = 'https://www.googleapis.com/oauth2/v1/userinfo'
OAUTH_SCOPE = ["openid", "https://www.googleapis.com/auth/userinfo.email"]

OAUTH_ATTRIBUTE_MAP = {

    "id": (False, "email"),
    "email": (True, "email"),
    "name": (False, "name")
}

Reference:

Todo:

1 . Solve access denied for user 'root'@'localhost' (using password: no) error on mariadb