Dawarich installation with Portainer und SWAG

In this post I describe the installation and configuration of Dawarich, an open source Google Timeline alternative. The installation is done as a docker stack via Portainer and the Linux server SWAG reverse proxy.

First, create a new stack with the name “Darwarich” in Portainer via “Stack – Add Stack”, as described in the installation instructions. The content of the docker-compose file can be taken from the Dawarich repository with adaption described below.

Optional deactivation of auto-update with watchtower

As the software is not stable yet and incompatible changes may occur with each update, it may be necessary to carry out updates manually. When using Watchtower, you may want to switch off the automatic updates for the dawarich images in order to carry out updates manually. This can be done with a corresponding label on the images:

services:
  dawarich_redis:
    image: redis:7.0-alpine
    container_name: dawarich_redis
    labels:
      - "com.centurylinklabs.watchtower.enable=false"
    # ...
  dawarich_db:
    image: postgis/postgis:17-3.5-alpine
    container_name: dawarich_db
    labels:
      - "com.centurylinklabs.watchtower.enable=false"
    # ...
   dawarich_app:
     image: freikin/dawarich:latest
     container_name: dawarich_app
     labels:
      - "com.centurylinklabs.watchtower.enable=false"
    # ...
  dawarich_sidekiq:
    image: freikin/dawarich:latest
    container_name: dawarich_sidekiq
    labels:
      - "com.centurylinklabs.watchtower.enable=false"
    # ...

Prepare for reverse proxy setup

For the setup to work via the reverse proxy, the variable APPLICATION_HOSTS must be set accordingly. It is important to note that even if you use https with the reverse proxy the variable APPLICATION_PROTOCOL must be “http”(not “https”), otherwise the container healthcheck will not work and the stack remains in a failed state:

services:
  # ...
  darwarich_app:
    # ...
    environment:
      # ...
      APPLICATION_HOSTS: localhost,dawarich.example.com
      APPLICATION_PROTOCOL: http

In my setup the SWAG container is part of the docker network proxynet . The application / frontend containers must be part of this network too, so that they can be reached. As we have a proxy setup the mapping of port 3000 can be removed:

networks:
  dawarich:
  proxynet:
    external: true
  # ...
services:
  # ...
  dawarich_app:
  # Remove the ports  
  # ports:
    #  - 3000:3000
  # ...
  networks:
    - dawarich
    - proxynet
    

SWAG configuration

In the following I assume that the SWAG configuration is based on ONLY_SUBDOMAINS=true. In that case the new subdomain for dawarich needs to be added to the environment variable SUBDOMAINS of the SWAG docker container, e.g.

 URL=example.com
 SUBDOMAINS=www,dawarich

On the docker host the proxy configuration for SWAG is created under /portainer/Files/AppData/Config/swag/nginx/proxy-confs/dawarich.subdomain.conf according to the Nginx configuration in the dawarich documentation. Take care that server_name matches the dawarich host, e.g. dawarich.example.com, and proxy_pass matches the name of the app docker container:

server {
  # ...
  server_name dawarich.example.com;
  # ...
    location / {
      # ...
      proxy_pass http://dawarich_app:3000/;
    }
}

Change login and password

After successfull startup of containers the service should be available under your choosen URL. It is important to login and change the email / password from the default values to your own – otherwise someone else will do this.

Backup

The host is already backed up with borgmatic running in a docker container. According to the dawarich documentation dumping the postgres database is sufficient. This can be done by configuring the relevant section in the borgmatic yaml configuration file, e.g.

postgresql_databases:
  - name: all
    hostname: dawarich_db
    username: postgres
    password: password

The borgmatic container needs to connect to dawarich_db, so add it to the dawarchich_dawarich docker network.