Skip to content

Commit

Permalink
updated readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rohwerj committed Aug 7, 2018
1 parent f32c8fc commit 7b6a505
Showing 1 changed file with 53 additions and 38 deletions.
91 changes: 53 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Seafile Server Docker image
[Seafile](http://seafile.com/) server Docker image based on [Alpine Linux](https://hub.docker.com/_/alpine/).
Based on the image from sunx/seafile-docker(https://github.com/VGoshev/seafile-docker).
Uses tini as PID 1 and supervisord as process manager.

## Supported tags and respective `Dockerfile` links

Expand All @@ -11,76 +12,90 @@ Based on the image from sunx/seafile-docker(https://github.com/VGoshev/seafile-d
To run container you can use following command:
```bash
docker run \
-v seafile_data:/seafile/datat \
-p 127.0.0.1:8000:8000 \
-p 127.0.0.1:8082:8082 \
-v seafile_data:/seafile/data \
-p 8000:8000 \
-p 8082:8082 \
rohwerj/seafile`
```
Containers, based on this image, will automatically configure
a Seafile enviroment if it doesn't already exist. If the existing Seafile enviroment is from a previous version of Seafile, container will automatically upgrade it to latest version (by calling the Seafile database upgrade scripts).
A backup of the databases and data volume should be made before an upgrade to a newer version.
After update to version 6.3.x the following commands have to be executed in the running container:
`source /etc/profile.d/seafile.sh`
`python manage.py migrate_file_comment`
[see changelog](https://manual.seafile.com/changelog/server-changelog.html)
## Detailed description of image and containers
### Used ports
This image uses 2 tcp ports:
This image uses 3 tcp ports:
* 8000 - seafile port
* 8082 - seahub port
If you want to run seafdav (WebDAV for Seafile), then port 8080 will be used also (not currently supported by this image).
* 8080 - seafdav port (if enabled)
### Volume
This image uses one volume with internal path `/seafile/data`
I would recommend you use host directory mapping of named volume to run containers, so you will not lose your valuable data after image update and starting a new container
### Web server configuration
This image doesnt contain any web-servers, because you, usually, already have some http server running on your server and don't want to run any extra http-servers (because it will cost you some CPU time and Memory). But if you know some really tiny web-server with proxying support, tell me and I would be glad to integrate it to the image.


For Web-server configuration, as media directory location you should enter
`/seafile/seafile-server/seahub/media`

In [httpd-conf](https://github.com/rohwerj/seafile-docker/blob/master/httpd-conf/) directory you can find
[lighttpd](https://www.lighttpd.net/) [config example](https://github.com/rohwerj/seafile-docker/blob/master/httpd-conf/lighttpd.conf.example) and
[haaproxy](https://www.haproxy.com/) [config example](https://github.com/rohwerj/seafile-docker/blob/master/httpd-conf/haproxy.cfg).

You can find
[Nginx](https://manual.seafile.com/deploy/deploy_with_nginx.html) and
[Apache](https://manual.seafile.com/deploy/deploy_with_apache.html)
configurations in official Seafile Server [Manual](https://manual.seafile.com/).
The directory structure is the following:
/seafile -> main directory for the application
/data -> data directory with configuration and sqlite databases (if not using mysql)
/seafile-server -> current version of the seafile-server
/seahub -> seahub application
/logs -> directory for all the log files
/pids -> directory containing the pid files
### Supported ENV variables
When you running container, you can pass several enviroment variables (with **--env** option of **docker run** command):
* **`SERVER_NAME`**=\<...> - Name of Seafile server (3 - 15 letters or digits), used only for first run. Default: Seafile
* **`SERVER_DOMAIN`**=\<...> - Domain or ip of seafile server, used only for first run. Default: seafile.domain.com
* **`MYSQL_HOST`**=\<...> - Host name of mysql/mariadb server. Used for waiting on the database server on startup (not used if empty). Default: <empty>
You can pass several enviroment variables to the image:
* **`SERVER_NAME`**=\<...> - Name of Seafile server (3 - 15 letters or digits), used only for the initialization. Default: Seafile
* **`SERVER_DOMAIN`**=\<...> - Domain or ip of seafile server, used only for the initialization. Default: seafile.domain.com
* **`MYSQL_HOST`**=\<...> - Host name of mysql/mariadb server. Used for waiting on the database server on startup (not used if empty) and initialization. Default: <empty>
* **`MYSQL_USER`**=\<...> - User name for the mysql/mariadb server. Only used when MYSQL_HOST is set. Default: seafile
* **`MYSQL_PASS`**=\<...> - Password for the mysql/mariadb server. Only used when MYSQL_HOST is set. Default: seafile
* **`ENABLE_SEAFDAV`**=\<...> - Can the true or false to indicate whether seafdav should be started. Default: false
## Initialization
On the first start with an empty volume mounted on /seafile/data, the image will initialize the seafile environment for you.
It uses the environment variable MYSQL_HOST to determine whether a sqlite or mysql setup is performed (variable ist empty -> sqlite, otherwise -> mysql).
To create a superuser you have to execute the following commands in the directory /seafile/seafile-server/seahub as user seafile:
`source /etc/profile.d/seafile.sh`
`python manage.py createsuperuser`
## Useful commands in container
With `docker exec -it seafile ash` the following commands can be executed:
With `docker exec --user=2016 -it seafile ash` the following commands can be executed:
* `seaf-fsck -F /seafile/data/conf -c /seafile/data/ccnet -d /seafile/data/seafile-data` check your libraries for errors
* `seafserv-gc -F /seafile/data/conf -c /seafile/data/ccnet -d /seafile/data/seafile-data ` - remove ald unused data from storage of your seafile libraries
## Tips&amp;Tricks and Known issues
### Web server configuration
* Make sure, that mounted data volume and files are radable and writable by container's seafile user(2016:2016).
This image does not contain any web-servers, but can be used behind one.
* If you want to run seafdav, which is disabled by default, you can read it's [manual](https://manual.seafile.com/extension/webdav.html). Do not forget to publish port 8080 after it.
(not yet supported by this image).
The media directory is located under
`/seafile/seafile-server/seahub/media`
* If you do not want container to automatically upgrade your Seafile enviroment on image (and Seafile-server) update,
you can add empty file named `.no-update` to directory `/seafile/data` in your container. You can use **`docker exec <container_name> touch /seafile/data/.no-update`** for it.
In the directory [httpd-conf](https://github.com/rohwerj/seafile-docker/blob/master/httpd-conf/) are example configurations for the following servers
[lighttpd](https://www.lighttpd.net/) [config example](https://github.com/rohwerj/seafile-docker/blob/master/httpd-conf/lighttpd.conf.example) and
[haaproxy](https://www.haproxy.com/) [config example](https://github.com/rohwerj/seafile-docker/blob/master/httpd-conf/haproxy.cfg).
Configuration examples are also available for
[Nginx](https://manual.seafile.com/deploy/deploy_with_nginx.html) and
[Apache](https://manual.seafile.com/deploy/deploy_with_apache.html)
in the official Seafile Server [Manual](https://manual.seafile.com/).
## Tips&amp;Tricks and Known issues
* Make sure, that mounted data volume and files are radable and writable by container's seafile user(2016:2016).

* Container uses seafile user to run seafile, so if you need to do something with root access in container, you can use **`docker exec -ti --user=0 <container_name> /bin/sh`** for it.
* If you do not want to automatically upgrade your Seafile enviroment,
you can add an empty file named `.no-update` to the directory `/seafile/data` in your container. You can use **`docker exec <container_name> touch /seafile/data/.no-update`** for it.

* This image configures a sqlite-based Seafile server installation. The plan is to support the mysql installation in a later version.
* The container uses the root user to start the entrypoint (and therefore supervisor). To execute scripts you need to use the seafile user **`docker exec -ti --user=2016 <container_name> /bin/sh`**.

## License

Expand Down

0 comments on commit 7b6a505

Please sign in to comment.