Installing Listmonk on Unraid

I wanted to play about with Listmonk and it’s available as a Docker image, so I figured I’d just install it on my Unraid box. It doesn’t have a recipe in Community Apps but it’s not usually hard to reverse-engineer an official installation guide into something that “just works” on Unraid. After a first attempt failed, I looked around for a quick how-to guide online and mostly found… a mixture of people similarly failing to get it working or else having a kindly stranger offer to help… but not on the open Web where the rest of us can benefit from their knowledge. Sigh.

So I resolved that when I figured it out, I’d document the steps so that the next person after me can have an easier job of it.

Installing Listmonk on Unraid

  1. Install Postgres if you don’t have it already. I used the postgresql15 image from Community Apps.
  2. Set up a role and database. To do this, log in to your Postgres database using your favourite Postgres client and run, for example:
    CREATE USER listmonk WITH LOGIN PASSWORD 'my-listmonk-db-password';
    CREATE DATABASE listmonk OWNER listmonk;
  3. Create a Listmonk configuration file. I created a listmonk share and put it in there, calling it /listmonk/config.toml, but anywhere on your Unraid server will do. There’s a sample configuration in the repository. You’ll probably want to change:
    • [app] address: change to 0.0.0.0:9000 to listen on all interfaces so you can access it from elsewhere on your network (might not be needed if you intend to proxy with a host-networked reverse proxy server)
    • [app] admin_username / admin_password: obviously change these – this is how you’ll log in to your Listmonk system
    • [db] host: if your Postgres container and/or Listmonk container is running in bridged networking mode rather than host networking mode, you’ll need to change this to the name or IP address of your Postgres server
    • [db] password: set to the password you chose for the listmonk user on your Postgres server
  4. Add a Listmonk container. In Unraid, on the Docker tab, click the Add Container button. A minimal configuration might look like this:
    • Name: Listmonk
    • Repository: listmonk/listmonk:latest
    • Network Type: consider using Host to simplify your [db] setup, above.
    • Add a Port with Name: HTTP and Host Port: 9000. Then fill in 9000 as the value (or whatever port you want to run Listmonk on)
    • Add a Path with Name: Config and Container Path: /listmonk/config.toml. Set the Host Path to wherever you put the Listmonk configuration file, e.g. /mnt/user/listmonk/config.toml.
  5. Start the Listmonk container and watch it stop. When you click “Apply” the container will start, run for a few seconds, and then stop. If you want, look at the logs and you’ll see what the problem is: it needs to be started in a different way in order to set up the database. Instead, what we’ll do is spin up a new Listmonk container just for that purpose (and then throw it away).
  6. Start Listmonk in “install” mode. SSH into your Unraid server itself and run, e.g.
    docker run --rm -ti --net='host' -e TZ="UTC" -v '/mnt/user/listmonk/config.toml':'/listmonk/config.toml':'rw' listmonk/listmonk:latest ./listmonk -- --install
    Substitute /mnt/user/listmonk/config.toml for whatever path your configuration file is at, if applicable. You’ll be prompted with the messages “** first time installation **”, “** IMPORTANT: This will wipe existing listmonk tables and types in the DB ‘listmonk’ **”, and then asked “continue (y/N)?”. Press “y” and the installation will complete.
  7. Start the Listmonk container again. This time it’ll stay running and you’ll be able to access the Web interface via e.g. https://your-unraid-server:9000/

Hope that helps somebody!

5 comments

  1. Jeff Gregory Jeff Gregory says:

    Hello,
    I’m suck at trying to run the container manually to install listmonk. I get the folloiwing:

    root@TechDeckArray:/mnt/user/listmonk# docker run –rm -ti –net=’host’ -e TZ=”UTC” -v ‘/mnt/user/listmonk/config.toml’:’/listmonk/config.toml’:’rw’ listmonk/listmonk:latest ./listmonk — –install
    2023/04/12 22:28:26 main.go:99: v2.4.0 (c668523 2023-03-20T13:50:31Z)
    2023/04/12 22:28:26 init.go:138: reading config: config.toml
    2023/04/12 22:28:26 init.go:266: connecting to db: localhost:5432/listmonk
    2023/04/12 22:28:26 main.go:139: the database does not appear to be setup. Run –install.

    I followed the directions and used the same settings stated:

    Config.toml:
    [app]
    # Interface and port where the app will run its webserver. The default value
    # of localhost will only listen to connections from the current machine. To
    # listen on all interfaces use ‘0.0.0.0’. To listen on the default web address
    # port, use port 80 (this will require running with elevated permissions).
    address = “0.0.0.0:9000”

    # BasicAuth authentication for the admin dashboard. This will eventually
    # be replaced with a better multi-user, role-based authentication system.
    # IMPORTANT: Leave both values empty to disable authentication on admin
    # only where an external authentication is already setup.
    admin_username = “admin”
    admin_password = “**********”

    # Database.
    [db]
    host = “localhost”
    port = 5432
    user = “listmonk”
    password = “**********”

    # Ensure that this database has been created in Postgres.
    database = “listmonk”

    ssl_mode = “disable”
    max_open = 25
    max_idle = 25
    max_lifetime = “300s”

    # Optional space separated Postgres DSN params. eg: “application_name=listmonk gssencmode=disable”
    params = “”

    Database:
    List of databases
    Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
    ———–+———-+———-+————+————+————+—————–+——————-
    admin | admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
    listmonk | listmonk | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
    postgres | admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
    template0 | admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/admin +
    | | | | | | | admin=CTc/admin
    template1 | admin | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/admin +
    | | | | | | | admin=CTc/admin
    (5 rows)

    listmonk=>

    I’m at a lose as to why the database isn’t working. It’s clearly there.

    Thanks for your help!

    1. Dan Q Dan Q says:

      How odd. Does the database contain tables? If not, might you be able to load the schema into it manually? (it’s presumable defined by listmonk somewhere…) Are you able to get into your listmonk container using a terminal and connect to the DB server from it? (help rule out connection/permission issues) Apologies for brevity; on mobile!

      1. Jeff Gregory Jeff Gregory says:

        I’m not sure if the listmonk database contains any tables. I can however, using the terminal for the Unraid container, log into the database. I was also able to log into the listmonk database using the credentials that I set up. So it doesn’t seem to be a connection issue.

        I guess I need to figure out how to run the following install that is mentioned here:

        2023/04/12 22:28:26 main.go:139: the database does not appear to be setup. Run –install.

  2. Jeff Gregory Jeff Gregory says:

    Figured it out. There’s an extra set of “–” before the “–install” in your command to run the setup:

    docker run –rm -ti –net=’host’ -e TZ=”UTC” -v ‘/mnt/user/listmonk/config.toml’:’/listmonk/config.toml’:’rw’ listmonk/listmonk:latest ./listmonk — –install

    I changed “./listmonk — –install” to “./listmonk –install”.

  3. Minic Minic says:

    I am currently trying to build this out and having a issue where listmonk container will not use the config.toml file i created. I run the container and it keeps giving me :

    2023/12/06 11:05:45 init.go:145: reading config: config.toml
    2023/12/06 11:05:45 init.go:273: connecting to db: localhost:5432/listmonk
    2023/12/06 11:05:45 init.go:277: error connecting to DB: dial tcp 127.0.0.1:5432: connect: connection refused

    The connection is refused because the correct location for db is not localhost. Its hosted on a seperate Vlan. Which is all outlined in the config.toml file that it refuses to see or read.
    Running the ssh command in the unraid terminal i get connected and the program runs perfectly with no issues.
    Running : docker run –rm -ti –net=’host’ -e TZ=”UTC” -v ‘/mnt/user/appdata/listmonk/config.toml’:’/listmonk/config.toml’:’rw’ listmonk/listmonk:latest ./listmonk – –install
    Runs fine and i am able to complete the creation. Which leads me to believe that the issue lies with the container?

Reply here

Your email address will not be published. Required fields are marked *

Reply on your own site

Reply elsewhere

You can reply to this post on Mastodon (@blog@danq.me).

Reply by email

I'd love to hear what you think. Send an email to b21173@danq.me; be sure to let me know if you're happy for your comment to appear on the Web!