OS Apps: Dokemon and Firefly III

Published: Jan 25, 2024 by Isaac Johnson

Dokemon is a very similar tool to Portainer. It can both monitor and launch containerized services. It has a few other nifty features as well we can explore like variables, secrets and managed docker compose.

Firefly III is an Open-Source financial app that is somewhat similar to Quicken. We’ll actually use Dokemon to launch Firefly into our Docker host.

Dokemon

Dokemon is more than a simple Doker monitor. It can deploy compose files, delete images, view logs and start/stop containers.

Let’s start by firing it up in our Dockerhost.

I’ll first create a volume for it’s data

builder@builder-T100:~$ docker volume create dokemondata
dokemondata

Then fire it up on port 9090

builder@builder-T100:~$ sudo docker run -p 9090:9090 -v dokemondata:/data -v /var/run/docker.sock:/var/run/docker.sock --restart unless-stopped --name dokemon -d productiveops/dokemon:latest
Unable to find image 'productiveops/dokemon:latest' locally
latest: Pulling from productiveops/dokemon
07a64a71e011: Pull complete
fe5ca62666f0: Pull complete
280126c0e181: Pull complete
fcb6f6d2c998: Pull complete
e8c73c638ae9: Pull complete
1e3d9b7d1452: Pull complete
4aa0ea1413d3: Pull complete
7c881f9ab25e: Pull complete
5627a970d25e: Pull complete
19cf2287de7f: Pull complete
ebba9ccde3ef: Pull complete
1933f300df8c: Pull complete
f963c7828c33: Pull complete
3ad3db87a08a: Pull complete
0cea5799cc0f: Pull complete
934601d3ba5c: Pull complete
Digest: sha256:355d6cec1acc7fc07b9b16acc395a9945054d2f1c26cadffab828a515370da78
Status: Downloaded newer image for productiveops/dokemon:latest
b1ca143ab3500f9862777cec28cf88fe433877aaa7647de1f150d356f63f1374

The first step is to create a user

/content/images/2024/01/dokemon-01.png

and I’m now greeted by my Server Dashboard

/content/images/2024/01/dokemon-02.png

At first, the UI for containers threw me - as it shows “red” for “new image available”. I usually associate red with stopped

/content/images/2024/01/dokemon-03.png

The Terminal section provides a nice lightweight terminal to your container

/content/images/2024/01/dokemon-04.png

And the logs let you view and download logs to a file

/content/images/2024/01/dokemon-05.png

It’s pretty easy to identify unused containers and remove them:

We can also identify unused volumes for cleanup

/content/images/2024/01/dokemon-07.png

Images will show us images and if they are in use, but sadly it doesn’t let us sort the columns. That would be my first feature request - let me find the largest images that are unused to remove

/content/images/2024/01/dokemon-08.png

Lastly, Networks show us Networks and their status

/content/images/2024/01/dokemon-09.png

Docker Compose

The other big feature of Dokemon is the ability to launch things with Docker compose

Saw we wnted to fire up Portainer. We could use this repo in Github

/content/images/2024/01/dokemon-11.png

We can add it to compose by clicking save

/content/images/2024/01/dokemon-12.png

Then Deploy it (Pull+Up) it

/content/images/2024/01/dokemon-13.png

Here you can see it come up, us use it, then tear it down

Externalizing with K8s

Let’s create a quick A Record

$ cat ./r53-dokemon.json
{
    "Comment": "CREATE dokemon fb.s A record ",
    "Changes": [
      {
        "Action": "CREATE",
        "ResourceRecordSet": {
          "Name": "dokemon.freshbrewed.science",
          "Type": "A",
          "TTL": 300,
          "ResourceRecords": [
            {
              "Value": "75.73.224.240"
            }
          ]
        }
      }
    ]
  }

$ aws route53 change-resource-record-sets --hosted-zone-id Z39E8QFU0F9PZP --change-batch file://r53-dokemon.json
{
    "ChangeInfo": {
        "Id": "/change/C0287216174YONGUZJUIL",
        "Status": "PENDING",
        "SubmittedAt": "2024-01-04T00:10:55.239Z",
        "Comment": "CREATE dokemon fb.s A record "
    }
}

I can now use a quick YAML to create an external endpoint, service and ingress to forward traffic

$ cat ingress.dokemon.yaml
---
apiVersion: v1
kind: Endpoints
metadata:
  name: dokemon-external-ip
subsets:
- addresses:
  - ip: 192.168.1.100
  ports:
  - name: dokemon
    port: 9090
    protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: dokemon-external-ip
spec:
  clusterIP: None
  clusterIPs:
  - None
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  - IPv6
  ipFamilyPolicy: RequireDualStack
  ports:
  - name: dokemon
    port: 80
    protocol: TCP
    targetPort: 9090
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
    nginx.org/websocket-services: dokemon-external-ip
  generation: 1
  labels:
    app.kubernetes.io/instance: dokemoningress
  name: dokemoningress
spec:
  rules:
  - host: dokemon.freshbrewed.science
    http:
      paths:
      - backend:
          service:
            name: dokemon-external-ip
            port:
              number: 80
        path: /
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - dokemon.freshbrewed.science
    secretName: dokemon-tls

$ kubectl apply -f ingress.dokemon.yaml
endpoints/dokemon-external-ip created
service/dokemon-external-ip created
ingress.networking.k8s.io/dokemoningress created

Since this app has a password, I feel a bit more safe with it.

I can now login remotely and view/manage the containers on my Docker host

/content/images/2024/01/dokemon-14.png

Firefly 3

Let’s pivot to a Financial OS app, Firefly

Two things I need to setup first; a database and a docker volume

I can actually use my VS Code remote web’s terminal to shell over to the Dockerhost to make the volume

/content/images/2024/01/dokemon-15.png

I’ll also create a database and user in a local psql host

postgres@isaac-MacBookAir:~$ createuser --pwprompt firefly
Enter password for new role: 
Enter it again: 
postgres@isaac-MacBookAir:~$ createdb firefly
postgres@isaac-MacBookAir:~$ psql
psql (12.17 (Ubuntu 12.17-0ubuntu0.20.04.1))
Type "help" for help.

postgres=# grant all privileges on database firefly to firefly;
GRANT
postgres=# GRANT ALL ON ALL TABLES IN SCHEMA public TO firefly;
GRANT

Back in Dokemon, I need to create an env (neccessary to create secrets and configs)

/content/images/2024/01/dokemon-16.png

version: '3'
services:
  firefly:
    image: fireflyiii/core:latest
    ports:
      - 9098:8080
    volumes:
      - firefly_iii_upload:/var/www/html/storage/upload
    environment:
      - APP_KEY=Yjg4ZmMwMzEtZjYxZS00ZjQwLWE3YjAtZjU0MjQyYzEwYjQ2
      - DB_HOST=$fireflydb
      - DB_PORT=5432
      - DB_CONNECTION=pgsql
      - DB_DATABASE=firefly
      - DB_USERNAME=$fireflyuser
      - DB_PASSWORD=$fireflypass
volumes:
  firefly_iii_upload:

I’ll now add to my library

/content/images/2024/01/dokemon-17.png

Then “Add from Library” to create an instantiation in the host

/content/images/2024/01/dokemon-18.png

Once added, I can do a docker up

/content/images/2024/01/dokemon-19.png

This fired it up

/content/images/2024/01/dokemon-20.png

According to the page now, it’s running

/content/images/2024/01/dokemon-21.png

The logs would suggest my key length is wrong

/content/images/2024/01/dokemon-22.png

I tore it down down “Down”

/content/images/2024/01/dokemon-23.png

Then fixed the issue and launched it again

/content/images/2024/01/dokemon-24.png

I realized I needed to set my main node to an “environment”

/content/images/2024/01/dokemon-26.png

Once set, when I did the “up”, i could see it pulled in the vars

/content/images/2024/01/dokemon-25.png

Once I figured out the API Key format and length, it came up

/content/images/2024/01/dokemon-27.png

Let’s create some fake numbers

/content/images/2024/01/dokemon-28.png

It then will take us through a tour of features

/content/images/2024/01/dokemon-29.png

We can add Transactions manually

/content/images/2024/01/dokemon-30.png

If you want to import your transactions from a bank, you can use the Firefly 3 Data Importer. It’s kept seperate for security reasons and uses gocardless and SaltEdge.

SaltEdge can also connect to things like PayPal

/content/images/2024/01/dokemon-31.png

We can export our transactions as a CSV file

/content/images/2024/01/dokemon-32.png

We can add bills as well as regular recurring experiences

/content/images/2024/01/dokemon-33.png

OpenSource Dokemon Firefly Docker

Have something to add? Feedback? Try our new forums

Isaac Johnson

Isaac Johnson

Cloud Solutions Architect

Isaac is a CSA and DevOps engineer who focuses on cloud migrations and devops processes. He also is a dad to three wonderful daughters (hence the references to Princess King sprinkled throughout the blog).

Theme built by C.S. Rhymes