Help with Federation breaking LocalAI

So, I have localai running as a custom app. it has its own hard drive dedicated to it, my yml (not sure what else to call it… the custom app settings) are below.
LocalAI runs fine on TrueNAS, accessable from outside, slowly, but beautifully, it can run some absolutely gargantuan models (75B models :slight_smile: )
Anyway, i have other machines throughout the house (and some of my offices have servers in them with hardware i can leverage). Problem is, as soon as i add a P2P token, it breaks the app. I can enable Federated, assign a network, but as soon as i try to generate a key and save, edit the config to contain the token, or paste the token into the ui. Every path leads to breaking localai (it wont boot). And, its hard to catch the logs before it crashes, so its difficult to see what the container is reporting back.

manually editing the config file for localai and removing the key fixes the issue and localai comes up correctly, but with the same issues. Ive tried editing the permissions on the localai folder, the sub directories of its data, the specific config file. Ive got 3 other machines inked together ready and waiting for this guy to come up… but that token breaks it every time. Any help would be appreciated. (Below is my custom config for the truenas app and my localai config.

```

services:
  localai:
    cap_drop:
      - ALL
    deploy:
      resources:
        limits:
          cpus: '10'
          memory: 65536M
    environment:
      GID: '1000'
      GROUP_ID: '1000'
      LOCALAI_ADDRESS: ':1234'
      LOCALAI_BACKENDS_PATH: /backends
      LOCALAI_CONFIG_DIR: /configuration
      LOCALAI_DISABLE_WEBUI: 'false'
      LOCALAI_MODELS_PATH: /models
      NVIDIA_VISIBLE_DEVICES: void
      PGID: '1000'
      PUID: '1000'
      TZ: Etc/UTC
      UID: '1000'
      UMASK: '002'
      UMASK_SET: '002'
      USER_ID: '1000'
    group_add:
      - 1000
    healthcheck:
      interval: 30s
      retries: 5
      start_interval: 2s
      start_period: 15s
      test:
        - CMD
        - curl
        - '--request'
        - GET
        - '--silent'
        - '--output'
        - /dev/null
        - '--show-error'
        - '--fail'
        - http://127.0.0.1:1234/readyz
      timeout: 5s
    image: quay.io/go-skynet/local-ai:v4.2.4
    network_mode: host
    platform: linux/amd64
    privileged: False
    restart: unless-stopped
    security_opt:
      - no-new-privileges=true
    stdin_open: False
    tty: False
    user: '1000:1000'
    volumes:
      - bind:
          create_host_path: False
          propagation: rprivate
        read_only: False
        source: /mnt/apps/docker/localai/backends
        target: /backends
        type: bind
      - bind:
          create_host_path: False
          propagation: rprivate
        read_only: False
        source: /mnt/apps/docker/localai/config
        target: /configuration
        type: bind
      - bind:
          create_host_path: False
          propagation: rprivate
        read_only: False
        source: /mnt/apps/docker/localai/models
        target: /models
        type: bind
      - bind:
          create_host_path: False
          propagation: rprivate
        read_only: False
        source: /mnt/apps/docker/localai/data
        target: /data
        type: bind
volumes: {}
x-action-required: False
x-notes: >
  # LocalAI


  ## Security


  **Read the following security precautions to ensure that you wish to continue
  using this application.**


  ---


  ### Container: [localai]


  #### Running user/group(s)


  - User: 1000

  - Group: 1000

  - Supplementary Groups: apps


  ---


  ## Bug Reports and Feature Requests


  If you find a bug in this app or have an idea for a new feature, please file
  an issue at

  https://github.com/truenas/apps
x-portals:
  - host: 0.0.0.0
    name: Web UI
    path: /
    port: 1234
    scheme: http



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##################!!runtime_settings.json!!(CONFIG)#####################
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

{
  "watchdog_enabled": true,
  "watchdog_idle_enabled": true,
  "watchdog_busy_enabled": true,
  "watchdog_idle_timeout": "15m0s",
  "watchdog_busy_timeout": "5m0s",
  "watchdog_interval": "500ms",
  "single_backend": false,
  "max_active_backends": 2,
  "auto_upgrade_backends": false,
  "prefer_development_backends": false,
  "memory_reclaimer_enabled": true,
  "memory_reclaimer_threshold": 0.9,
  "force_eviction_when_busy": false,
  "lru_eviction_max_retries": 30,
  "lru_eviction_retry_interval": "1s",
  "threads": 0,
  "context_size": 1024,
  "f16": false,
  "debug": false,
  "enable_tracing": false,
  "tracing_max_items": 1024,
  "enable_backend_logging": false,
  "cors": false,
  "csrf": false,
  "cors_allow_origins": "",
  "p2p_token": "ThisIsTheOffendingKeyThatIfHereCausesMeNotToBoot",
  "p2p_network_id": "MyCoolAI",
  "federated": true,
  "galleries": [
    {
      "url": "github:mudler/LocalAI/gallery/index.yaml@master",
      "name": "localai"
    }
  ],
  "backend_galleries": [
    {
      "url": "github:mudler/LocalAI/backend/index.yaml@master",
      "name": "localai"
    }
  ],
  "autoload_galleries": true,
  "autoload_backend_galleries": true,
  "api_keys": null,
  "agent_job_retention_days": 30,
  "open_responses_store_ttl": "0",
  "agent_pool_enabled": true,
  "agent_pool_default_model": "qwen3.6-40b-claude-4.6-opus-deckard-heretic-uncensored-thinking-neo-code-di-imatrix-max",
  "agent_pool_embedding_model": "granite-embedding-107m-multilingual",
  "agent_pool_max_chunking_size": 400,
  "agent_pool_chunk_overlap": 0,
  "agent_pool_enable_logs": false,
  "agent_pool_collection_db_path": "",
  "agent_pool_vector_engine": "chromem",
  "agent_pool_database_url": "",
  "agent_pool_agent_hub_url": "https://agenthub.localai.io",
  "localai_assistant_enabled": true,
  "instance_name": "MyCoolAI",
  "instance_tagline": ""
}


The localai docs on federation seem to indicate this leverages docker swarm behind the scenes. I believe TrueNAS intentionally disables swarm mode in the CE.

is there a way to override that and enable it? It seems a silly setting to disable, what with federation, p2p, etc all kind of being the truenas thing, isnt it? Scalable i think is your word for it?

No officially supported way, you’d have to hack something together yourself

Remember there are features paywalled behind TrueNAS Enterprise (e.g., RDMA). P2P and federation seems more suited to an enterprise installation than a homelab.

Fair enough….

I will poke my eyeballs at that.

before i go down that path (and i did start looking).

Is there an ability to purchase only the software and install it on bare metal?

CE and Enterprise are the same software. The difference is just license keys entered in the UI and support contract purchases.

It’s been asked for a lot and maybe there will be an option in the future, but right now Enterprise is tied to hardware purchased by iX and a service contract

OK… maybe im slow here, but…
Doesnt TrueNAS now offer GPU pass-through to a VM?
and i can run a “swarm” version of localai on a Debian Server VM (or, whatever the hangup is with non-enterprise versions)…
Which would allow me to launch localai in federated mode, generate a key, and not break my app?

Not for nothing, but… WHY?
I get what, MAYBE 1ms extra lag because of a VM vs app’s direct access…
I already dedicate an absolutely massive amount of ram to the app, with the majority of my CPU cores dedicated to it, and its own drive already…
Accomplishing my goal, but, with what is essentially extra work to make a workaround plausible?

I’d also like to point out: IM HAPPY TO PAY FOR IT!

But, not at the pricetag an additional suite of hardware comes with… Ive already got 20k-30k in this rig already, i just need a setting available…

/rant

AFAIK docker swarm is not part of Truenas Enterprise… according to iX almost none of their enterprise users use the apps system…

ok, then what IS the stop here?

isnt this kind of contradictory to what you said just prior to this response?

edit:
Clarification:

You state “The localai docs on federation seem to indicate this leverages docker swarm behind the scenes. I believe TrueNAS intentionally disables swarm mode in the CE.”

(This makes me think: it’s not disabled in the other version…)

Then: “Remember there are features paywalled behind TrueNAS Enterprise (e.g., RDMA). P2P and federation seems more suited to an enterprise installation than a homelab.”

(Which makes one believe that you can access this by buying the Enterprise version….)

and, just to screw with us, you threw this in there: “CE and Enterprise are the same software. The difference is just license keys entered in the UI and support contract purchases.”

not for nothing man, but you made this more confusing, not less… And yeah, i see you “stupid people” tag… have you ever wondered if you’re just not explaining it correctly to people rather than assume theyre stupid?

Nah, im probably just stupid.

that docker swarm is deactivated on truenas and afaik there’s no way to enable it.

Since I’ve never run Enterprise, my conjecture that swarm might be paywalled was just an educated guess. And my signature isn’t meant to suggest any stupidity on your part, but on mine.

The only way around this I’m aware of is to run Docker inside a VM, where you’re free to use swarm, and any orchestration (e.g., DockGE) you like.

The existing apps/VM features in CE are a convenience feature for homelabs and small businesses. Enterprise customers don’t use it because of its limitations, and only use TrueNAS as a storage layer. They run VMs on dedicated hypervisors and container loads on dedicated container infrastructure.

why, i absolutely love it when some asshole mansplains to me shit i already know…

Then why are you venting at me for trying to do something TrueNAS isn’t built for?

Neither I nor any of the moderators here can remedy your gripe. Granted, I speculated in ignorance, and I apologize for that.

If you’re disillusioned with TrueNAS, nothing’s stopping you from installing something else that may fit your situation better.

Im not disillusioned.
Im not venting at you becasue TrueNAS cant do what i want.
Im telling you youre an idiot and a bit of an asshole for pretending like you know things you dont.

You spoke from a point of ignorance like you were the authority on this.. So, yeah… it’s you. the problem was you. I was fine, understood where i existed… then you came along and spoke with authority about something you were apparently wholly ignorant about.

And yes, im also aware that i can install something else. Thank you for giving me permission to do with the things i own as i please. I wasnt sure i was allowed to use my things for whatever purposes i wanted, running whatever software i wanted. Thank you for clearing that up.

And, just so you dont come back with more stupid:
Yeah, i know openmediavault exists…
i know ubuntu exists and can do the same thing truenas does (honestly, pretty much any modern OS can accomplish the same thing TrueNAS does with enough work put in…)

I know that Rockstor is a thing and that XigmaNAS exists.

OH OH, lets not forget UNRAID… and MOS (new up and comer)…

I am locking this thread.