Docker container for Seafile server with linked MySQL Container
867
First, you need to run mariadb or mysql image:
docker run \
--name seafile-mariadb \
-v /$SOME_ABS_PATH/maria-seafile:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=thisisabsolutlyinsecure \
-e MYSQL_USER=seafile \
-e MYSQL_PASSWORD=everybodyknowsthat \
-d mariadb:latest
docker run \
--name seafile \
-v /$SOME_ABS_PATH/seafile-data:/seafile-data/ \
-p 80:8000 -p 8082:8082 -p 8080:8080 -p 10001:10001 -p 12001:12001 \
--link seafile-mariadb:db \
-e SITE_BASE=http://127.0.0.1 \
-d podshumok/seafile
Run this image with -e SEAFILE_FASTCGI_HOST=0.0.0.0:
docker run \
--name seafile \
-v /$SOME_ABS_PATH/seafile-data:/seafile-data/ \
-p 10001:10001 -p 12001:12001 \
--link seafile-mariadb:db \
-e SITE_BASE=http://127.0.0.1 \
-e SEAFILE_FASTCGI_HOST=0.0.0.0 \
-d podshumok/seafile
Create /$SOME_ABS_PATH/conf.d/default.conf (nginx configuration file):
mkdir -p /$SOME_ABS_PATH/conf.d
wget https://github.com/podshumok/docker-seafile/raw/master/conf.d/default.conf \
-O /$SOME_ABS_PATH/conf.d/default.conf
Run nginx image:
docker run \
--name seafile-nginx \
-p 80:80 \
--link seafile:seafile \
-v /$SOME_ABS_PATH/conf.d:/etc/nginx/conf.d \
-v /$SOME_ABS_PATH/nginxlog:/var/log/nginx \
-v /$SOME_EMPTY_DIR:/etc/nginx/sites-enabled \
-v /$SOME_EMPTY_DIR:/etc/nginx/certs \
-v /$SOME_EMPTY_DIR:/var/www/html \
-d nginx
Create project tree:
seafile/
|--- conf.d/
|----|--- default.conf # nginx configuration file
|----ssl/ # (optional)
|----|--- seafile.crt # your cacert.pem
|----|--- seafile.key # your privkey.pem
|--- data/
|--- docker-compose.yml
Template for conf.d/default.conf is here.
If you need HTTPS replace listen 80; with listen 443 ssl; and add ssl_certificate and ssl_certificate_key e.g.:
server {
listen 443 ssl;
ssl_certificate certs/seafile.crt;
ssl_certificate_key certs/seafile.key;
...
docker-compose.yml sketch:
mariadb:
image: mariadb:latest
volumes:
- ./data/maria:/var/lib/mysql
- ./data/log/maria:/var/log/mysql
environment:
- MYSQL_ROOT_PASSWORD=pleasechangeitorelse
- MYSQL_USER=seafile
- MYSQL_PASSWORD=thisoneshouldbechangedtoo
main:
image: podshumok/seafile
volumes:
- ./data/seafile:/seafile-data/
- ./data/log/seafile:/var/log/seafile
links:
- mariadb:db
environment:
# replace http:// with https:// for SSL configuration
- SITE_BASE=http://127.0.0.1
- SEAFILE_FASTCGI_HOST=0.0.0.0
nginx:
image: nginx
ports:
- "443:443"
links:
- seafile
volumes:
- ./conf.d:/etc/nginx/conf.d:ro
- ./ssl:/etc/nginx/certs:ro
- ./data/log/nginx:/var/log/nginx
- /tmp/empty:/etc/nginx/sites-enabled:ro
- /tmp/empty:/var/www/html:ro
Now just run docker-compose up in the project root.
MYSQL_HOST - default: db comes from --link some-mysql:dbMYSQL_USER - default comes from corresponding variable from linked machineMYSQL_PASSWORD - default comes from corresponding variable from linked machineMYSQL_ROOT - default comes from corresponding variable from linked machine, if it is not set no databases or roles will be createdMYSQL_ROOT_PASSWORD - default comes from corresponding variable from linked machineADMIN_EMAIL - Admin email (login) for all services (the default is [email protected] - change it!)ADMIN_PASSWORD - Admin password (the default is youcannotguessit - change it!)QUOTA - default: 2 - user quota in GB, integer onlyKEEP_DAYS - days to keep historyMAX_UPLOAD - maximum upload file sizeMAX_DOWNLOAD_DIR - maximum download directory sizeMEMCACHE_HOST - enable memcache at this host for cache (just --link some-memcached:memcache)MEMCACHE_PORT - default: 11211EMAIL_HOST - default: smtp.gmail.com, SMPT server for email sendingEMAIL_PORT - default: 587EMAIL_USE_TLS - default: True - use TLS for SMPTEMAIL_HOST_USER - login to $EMAIL_HOST with this userEMAIL_HOST_PASSWORD - enable email sending, use this password to login to $EMAIL_HOSTCLOUD_MODE - default: False - enable cloud mode and hide Organization tabENABLE_SIGNUP - deafult: False - enable registration on webTIME_ZONE - default: UTCSITE_BASE - default: http://www.example.com - set this to seahub website's URL. This URL is contained in email notificationsSITE_NAME - default: example.com - set this to your website's name. This is contained in email notificationsSITE_TITLE - default: Seafile - set seahub website's titleSITE_ROOT - default: / - if you don't want to run seahub website on your site's root path, set this option to your preferred path, e.g. setting it to /seahub/ would run seahub on http://example.com/seahub/SERVICE_BASE - default: $SITE_BASESERVICE_URL - default: $SITE_BASE/ if $SEAFILE_FASTCGI_HOST is not set, $SITE_BASE/seafhttp otherwiseACTIVATE_AFTER_REGISTRATION - default: True - activate user when registration complete. Default is True, if set to False, new users need to be activated by admin in admin panel.SEAFILE_FASTCGI_HOST - default: not set - serve FastCGI for Seahub on $SEAFILE_FASTCGI_HOST:8000 for reverse proxyWEBDAV_FASTCGI - default: false if $SEAFILE_FASTCGI_HOST is not set, true otherwise - serve FastCGI for webdav on port 8080 for reverse proxyWEBDAV_SHARE_NAME - default: / if $WEBDAV_FASTCGI equals false or is not set, /seafdav otherwiseContent type
Image
Digest
Size
85.7 MB
Last updated
over 9 years ago
docker pull dschoen/docker-seafile