Convert docker compose or k8s manifest to custom app

I am trying to convert a docker compose ,or kubernetes manifest to a custom app in truenas 25.04.

Is there an easy way to do this? The syntax of the custom apps yaml is not really making sense, and normal compose seems to puke.

Thanks!

“The syntax of the custom apps yaml” is docker compose. Paste in your (appropriately modified, of course) Compose file and go. If it “pukes,” it’s likely there’s an error in the YAML.

If you’re going to be doing much with straight Compose YAML, you might want to use an app like Dockge or Portainer for that purpose, but the “custom app via YAML” is literally a Compose file.

Got ya, guess I am use to k8s so this syntax seem wrong.

Is there not a way with docker compose to create a configuration file? Seems like the configs thing works, however need to pass a file where key value pairs are not going to work.

Many pieces of software will have config files, and you can tell Docker (via the compose file) where to store that data in your filesystem. But a config file for the system as a whole? I don’t think so–what kind of configuration would be there?

Now, one common way of specifying configuration options for an application is via a .env file, and it isn’t directly possible to do that with the “custom app via YAML” method (though it is possible to include files, which is discussed somewhere else on this forum). A more direct way to use them would be to install the Dockge app, and then use that to handle your Compose workload. Among its advantages is that it does handle a .env file.

1 Like

Basically I want to pass the following to a specific path. /etc/config/alloy.conf

In k8s i can do this in helm, or create a config map … In this setup not sure how.

End of the day would like a single file that can be deployed to enable monitoring on truenas.

prometheus.remote_write "local" {
  endpoint {
    url = "http://mimir:9009/api/v1/push"
  }
}

loki.write "local" {
  endpoint {
    url = "http://loki:3100/loki/api/v1/push"
  }
}

prometheus.scrape "linux_node" {
  targets = prometheus.exporter.unix.node.targets
  forward_to = [
    prometheus.remote_write.local.receiver,
  ]
}

prometheus.exporter.unix "node" {
}

loki.relabel "journal" {
  forward_to = []

  rule {
    source_labels = ["__journal__systemd_unit"]
    target_label  = "unit"
  }
  rule {
    source_labels = ["__journal__boot_id"]
    target_label  = "boot_id"
  }
  rule {
    source_labels = ["__journal__transport"]
    target_label  = "transport"
  }
  rule {
    source_labels = ["__journal_priority_keyword"]
    target_label  = "level"
  }
  rule {
    source_labels = ["__journal__hostname"]
    target_label  = "instance"
  }
}

loki.source.journal "read" {
  forward_to = [
    loki.write.local.receiver,
  ]
  relabel_rules = loki.relabel.journal.rules
  labels = {
    "job" = "integrations/node_exporter",
  }
}
discovery.docker "linux" {
  host = "unix:///var/run/docker.sock"
}
discovery.relabel "logs_integrations_docker" {
    targets = []

    rule {
        target_label = "job"
        replacement  = "integrations/docker"
    }

    rule {
        target_label = "instance"
        replacement  = constants.hostname
    }

    rule {
        source_labels = ["__meta_docker_container_name"]
        regex         = "/(.*)"
        target_label  = "container"
    }

    rule {
        source_labels = ["__meta_docker_container_log_stream"]
        target_label  = "stream"
    }
}
loki.source.docker "default" {
  host = "unix:///var/run/docker.sock"
  targets = discovery.docker.linux.targets
  relabel_rules = discovery.relabel.logs_integrations_docker.rules
  labels = {
  }
  forward_to = [
    loki.write.local.receiver,
  ]
}

Use dockge (its an app)

You place your config file into your “alloy” compose directory and then bind ./alloy.conf:/etc/config/alloy.conf into the container

I spend some time demonstrating setting up and using Dockge in this video: