Skip to content

Setting up ntfy and Loggifly

We need to first set up our docker-compose.yml file which can be found here: https://docs.ntfy.sh/install/?h=docker#docker. Change the volume paths to be in the same folder as the docker compose file. Go ahead and create the config folder bind mount. Inside the config folder, create a server.yml file. Paste the contents from here https://github.com/binwiederhier/ntfy/blob/main/server/server.yml

We want this to be as private as possible so in the server.yml file, find auth-file. Set these parameters

auth-file: "/var/lib/ntfy/user.db"
auth-default-access: "deny-all"

This means that no one but authenticated users can subscribe to a topic on your server.

Let's go ahead and create an admin user for ourselves that has access to all topics.

Create a shell in the container

docker exec -it ntfy sh

Create the user account

ntfy user add --role=admin <username>

it will prompt you for a password. This should be strong.

Let's go ahead and create an access token too which can be used to push notifications (https://docs.ntfy.sh/config/?h=token#access-tokens)

We can create a token that doesn't expire with

ntfy token add <username>

Copy this token, we'll use this with loggifly.

Go ahead and create a test topic and subscribe from your devices.

Better practice

What we probably should do is create a separate user with write-only access and generate a token for this user for pushing notifications (https://docs.ntfy.sh/config/?h=auth+file#access-control-list-acl)

loggifly setup

We'll follow the instructions here: https://clemcer.github.io/loggifly/guide/getting-started.html#option-2-mount-a-config-yaml-recommended-for-most-setups

In the config.yaml file, comment out the username and password and just use the token that we generated previously.

!!! info title="dns config"

Because we are communicating between docker containers (likely in separate networks), if we are hosting a dns server, like adguardhome or pi-hole, that has a rewrite for our domain, we can include that in our docker compose file

```yml
services:
  loggifly:
    image: ghcr.io/clemcer/loggifly:latest
    container_name: loggifly
    dns:
      - 192.168.4.142
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./config:/config    # Place your config.yaml in this directory
    restart: unless-stopped
```

Comments