Docker image for ETESync based on the server-skeleton repository by Tom Hacohen.
This build follows some tags of the Python official docker images:
edge
(master:tags/latest/Dockerfile)slim
(master:tags/slim/Dockerfile)alpine
(master:tags/alpine/Dockerfile)
docker run -d -e SUPER_USER=admin -e [email protected] -e SUPER_PASS=changeme -p 80:3735 -v /path/on/host:/data grburst/etesync:alpine
Create a container running ETESync usiong http protocol.
You can use docker-compose file, here is an example:
version: '3'
services:
etesync:
container_name: etesync
image: grburst/etesync:alpine
restart: always
ports:
- "80:3735"
volumes:
- data-etesync:/data
environment:
SERVER: ${SERVER:-uwsgi}
SUPER_USER: ${SUPER_USER:-admin}
SUPER_EMAIL: ${SUPER_EMAIL:[email protected]}
SUPER_PASS: ${SUPER_PASS:-admin}
volumes:
data-etesync:
/data
: database file location
This image exposes the 3735 TCP Port
- SERVER: Defines how the container will serve the application, the options are:
http
Runs using HTTP protocol, this is the default mode.https
same as above but with TLS/SSL support, see below how to use with your own certificates.uwsgi
start using uWSGI native protocol, for reverse-proxies/load balances, such as nginx, that support this protocolhttp-socket
Similar to the first option, but without uWSGI HTTP router/proxy/load-balancer, this recommended for any reverse-proxies/load balances, that support HTTP protocol, like traefikdjango-server
this mode uses the embedded django http server,./manage.py runserver :3735
, this is not recommeded but can be useful for debugging
- SUPER_USER and SUPER_PASS: Username and password of the django superuser (only used if no previous database is found, both must be used together);
- SUPER_EMAIL: Email of the django superuser (optional, only used if no database is found);
- PUID and PGID: set user and group when running using uwsgi, default:
1000
; - ETESYNC_DB_PATH: Location of the ETESync SQLite database. default:
/data
volume; - DEBUG: Show debug information in the web interface. default: "False"
- SECRET_KEY: Provide the value for django's
SECRET_KEY
. When provided, it will be written toSECRET_FILE
on first startup, otherwise etesync will generate a random key for you.
Custom settings can be added to /etesync/etesync_site_settings.py
, this file overrides the default settings.py
, mostly for Django: The Web framework options, this image uses the variables below to set some of these options.
- ALLOWED_HOSTS: the ALLOWED_HOSTS settings, must be valid domains separated by
,
. default:*
(not recommended for production); - DEBUG: enables Django Debug mode, not recommended for production defaults to False;
- LANGUAGE_CODE: Django language code, default:
en-us
; - SECRET_FILE: Defines file that contains the value for django's
SECRET_KEY
if not found a new one is generated. default:/etesync/secret.txt
. - USE_TZ: Force Django to use time-zone-aware datetime objects internally, defaults to
false
; - TIME_ZONE: time zone, defaults to
UTC
;
If you want to run ETESync Server HTTPS using uWSGI you need to pass certificates or the image will generate a self-sign certificate for localhost
.
By default ETESync will look for the files /certs/crt.pem
and /certs/key.pem
, if for some reason you change this location change the X509_CRT and X509_KEY environment variables
When behind a reverse-proxy/http server compatible uwsgi
protocol the static files are located at /var/www/etesync/static
, files will be copied if missing on start.
Customize your build. Either when building directly with docker build
:
# Build default image
docker build -t [myetesync] -f ./tags/[alpine|latest|slim]/Dockerfile .
# Build with args
docker build --build-arg VAR_NAME=value (...)
or adding the following in a docker-compose
file:
services:
etesync:
build:
context: ./build
args:
VAR_NAME: value
In many cases, you run it several docker images behind a reverse proxy. Here is how I use it:
Create a docker network
to let services from different compose files communicate
docker network create my-reverse-proxy
build: build
Nginx docker-compose
file:
version: '3.7'
services:
nginx:
container_name: nginx
build: build
restart: on-failure
networks:
- my-reverse-proxy
- default
ports:
- 80:80
- 443:443
volumes:
- ${TLS_CERTS_DIR:-./.test_certs}:/tls_certs/:ro
- auth-nginx:/auth/
volumes:
auth-nginx:
networks:
reverse-proxy:
name: my-reverse-proxy
... and the etesync docker-compose
file:
version: '3'
services:
etesync:
container_name: etesync
image: grburst/etesync:alpine
restart: always
networks:
- my-reverse-proxy
expose:
- "3735"
volumes:
- data-etesync:/data
environment:
SERVER: ${SERVER:-uwsgi}
SUPER_USER: ${SUPER_USER:-admin}
SUPER_EMAIL: ${SUPER_EMAIL:[email protected]}
SUPER_PASS: ${SUPER_PASS:-admin}
volumes:
data-etesync:
networks:
my-reverse-proxy:
external: true
In the nginx configuration, you need to an appropriate *_pass
to your etesync instance, e.g. a uwsgi_pass
.
Notes:
- You can use the hostname
etesync
in theuwsgi_pass
since they are sharing a network - In the example,
https_server.include
is a file providing my default https settings for nginx
It will look similar like the following:
server {
server_name etesync.example.com;
include conf.d/common/https_server.include;
client_max_body_size 10m;
client_body_buffer_size 128k;
location / {
include uwsgi_params;
uwsgi_pass etesync:3735;
}
}