Warning: This document is for the development version of Mailu. The main version is 1.5.

Development environment

Docker containers

The development environment is quite similar to the production one. You should always use the master version when developing. Simply add a build directive to the images you are working on in the docker-compose.yml:

  build: ./optional/radicale
  image: mailu/$WEBDAV:$VERSION
  restart: always
  env_file: .env
    - "$ROOT/dav:/data"

  build: ./core/admin
  image: mailu/admin:$VERSION
  restart: always
  env_file: .env
    - "$ROOT/data:/data"
    - "$ROOT/dkim:/dkim"
    - /var/run/docker.sock:/var/run/docker.sock:ro
    - redis

The build these containers.

docker-compose build admin webdav

Then you can simply start the stack as normal, newly-built images will be used.

docker-compose up -d

If you wish to run commands inside a container, simply run (example):

docker-compose exec admin ls -lah /

Or if you wish to start a shell for debugging:

docker-compose exec admin sh

Finally, if you need to install packages inside the containers for debugging:

docker-compose exec admin apk add --no-cache package-name

Web administration

The administration Web interface requires a proper dev environment that can easily be setup using virtualenv (make sure you are using Python 3) :

cd core/admin
virtualenv .
source bin/activate
pip install -r requirements.txt

You can then export the path to the development database (use four slashes for absolute path):

export SQLALCHEMY_DATABASE_URI=sqlite:///path/to/dev.db

And finally run the server with debug enabled:

python run.py

Any change to the files will automatically restart the Web server and reload the files.

When using the development environment, a debugging toolbar is displayed on the right side of the screen, that you can open to access query details, internal variables, etc.