intro.adoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. [#entities]
  2. = Entities
  3. An entity is something that exists - a "thing", like a VM, or a Container is an entity. OliveTin allows you to then dynamically generate actions based around these entities.
  4. This is really useful if you want to generate wake on lan or poweroff actions for `server` entities, for example.
  5. A very popular use case that entities were designed for was for `container` entities - in a similar way you could generate `start`, `stop`, and `restart` container actions.
  6. Entities are just loaded from files on disk. OliveTin watches these files for updates while it is running and refreshes dashboards, actions, and the Entities page when data changes.
  7. [#display-names]
  8. === Display names
  9. Each entity instance needs a human-readable name in the UI. OliveTin picks the first matching string field from this list (case-insensitive field names):
  10. `title`, `name`, `id`, `hostname`, `host`, `label`
  11. If none of those fields contain a string value, the instance appears as **Untitled Entity**. Add one of those fields to every row in your entity file — for example `title: My Vehicle` or `name: server1`.
  12. The chosen field is shown as the instance name in lists and dashboards. On the entity details page, it appears in the page heading; see xref:entities/properties.adoc#entity-details-page[Entity details page] for which other fields are listed.
  13. [#entity-live-reload]
  14. === Live reload
  15. * **Entity file content** — when a watched data file is updated on disk, OliveTin reloads instances and notifies the web UI. No restart is required.
  16. * **New entity types in `config.yaml`** — when you add a new entry under `entities:` and reload config, OliveTin starts watching that file without a full restart.
  17. * **Entity file path changes** — when you change an entity's file path in config and reload, OliveTin switches to the new file without a restart.
  18. * **Removing or renaming entity types** — restart OliveTin if you remove an entity definition or rename its type; otherwise stale entity data may remain in memory until restart.
  19. [NOTE]
  20. ====
  21. On **Docker Desktop for Windows**, bind-mounted entity files may not trigger file-watch events when updated from the host (for example by a cron job writing through a volume). If live reload does not pick up changes, restart the container after updating the file, run OliveTin on Linux, or write the file in place on the same filesystem OliveTin watches.
  22. ====
  23. Entity data files can contain any fields you need. Those values are available in action templates as `{{ .CurrentEntity.field }}` — for example, `{{ .CurrentEntity.status }}` or `{{ .CurrentEntity.hostname }}`.
  24. Entity field values are **not** sanitized for shell safety. If you substitute them into `shell` or `shellAfterCompleted`, OliveTin assumes the entity files are server-controlled and that you accept responsibility for that data. See xref:action_execution/shellvsexec.adoc#shell-entity-env-trust[Entity and .Env values are not shell-sanitized].
  25. To control which fields appear in the Entities page table and entity details view, configure `properties` on the entity definition in `config.yaml`. See xref:entities/properties.adoc[Entity properties] for details.
  26. To restrict which users may see an entity type (list, details, search, and related UI), list `acls` on the entity definition. See xref:security/acl.adoc#acls[Access Control Lists] (Entities section). Entity types with no `acls` stay unrestricted.
  27. [source,yaml]
  28. ----
  29. entities:
  30. - file: /etc/OliveTin/containers.json
  31. name: container
  32. - file: /etc/OliveTin/servers.yaml
  33. name: server
  34. icon: ssh
  35. acls:
  36. - ops
  37. properties:
  38. - name: hostname
  39. title: Hostname
  40. - name: ip
  41. title: IP
  42. ----
  43. Entity Actions can only be used on xref:dashboards/intro.adoc[Dashboards].
  44. == What's Next?
  45. Now that you understand entities, here's how to use them effectively:
  46. * xref:entities/properties.adoc[Configure entity properties] - Choose which fields appear in the UI and API
  47. * xref:entities/icons.adoc[Configure entity icons] - Set an icon for each entity type
  48. * xref:entities/yaml.adoc[Create YAML entity files] - Learn the YAML format for entity files
  49. * xref:entities/json.adoc[Create JSON entity files] - Learn the JSON format for entity files
  50. * xref:entities/examples.adoc[View entity examples] - See complete examples of entity configurations
  51. * xref:dashboards/intro.adoc[Use entities in dashboards] - Combine entities with dashboards for dynamic action generation
  52. * xref:solutions/container-control-panel/index.adoc[Container control panel solution] - See a complete example using container entities
  53. * xref:solutions/systemd-control-panel/index.adoc[Systemd control panel solution] - See a complete example using systemd entities