Rename bases to templates and add per property inheritance

Review changes for #1142:
- base becomes template everywhere (is_template, template_id,
  --template, --is-template, --templates, InstanceDetails.isTemplate).
- Object fields inherit per property. inherited_fields lists the
  overridden properties for object fields and the template object is
  merged with them.
- Linking a template also inherits fields that hold the default value.
  The server name stays per instance.
- Ports are never inherited.
- InstanceDetails carries templateId.

Web UI: inherited values are locked until unlocked, overridden values
can be inherited again, templates are listed separately, the create
modal can create templates and instances from templates, and the
instance page has "Create template" which can link the source.

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-02 11:54:37 +00:00
1 parent 01cf789f5d
commit b5c372f109
21 files changed
+865 -312

No files matched your search

+14 -12
View File
@@ -521,26 +521,28 @@ This allows you to prevent certain instances from being started when using the b
Defaults to false.
### instance.is_base
### instance.is_template
If enabled this instance is a base other instances can inherit config values from.
Base instances cannot be assigned to a host and therefore never start.
Hidden from `instance list` in clusterioctl unless `--bases` is passed.
An instance cannot stop being a base while other instances inherit from it.
If enabled this instance is a template other instances can inherit config values from.
Templates cannot be assigned to a host and therefore never start.
Hidden from `instance list` in clusterioctl unless `--templates` is passed, and listed separately in the web interface.
An instance cannot stop being a template while other instances inherit from it.
Defaults to false.
### instance.base_id
### instance.template_id
ID of the base instance to inherit config values from.
Inherited fields take their value from the base and follow it when it changes, setting a field on this instance stops inheriting it.
When set on an existing instance only fields with the same value as the base become inherited.
`instance.name`, `instance.is_base`, `instance.base_id` and hidden fields are never inherited.
A base may itself inherit from another base, but not from itself through a chain of bases.
ID of the template to inherit config values from.
Inherited fields take their value from the template and follow it when it changes, setting a field on this instance stops inheriting it.
Object fields like `factorio.settings` are inherited per property, properties set on this instance override the ones from the template.
When set on an existing instance fields with the same value as the template or the default value become inherited, except the server name in `factorio.settings`.
`instance.name`, `instance.is_template`, `instance.template_id`, the port fields and hidden fields are never inherited.
A template may itself inherit from another template, but not from itself through a chain of templates.
The fields currently inherited are stored in the hidden `instance.inherited_fields` field.
In the web interface inherited values are locked and must be unlocked before they can be changed.
Defaults to null meaning no base.
Defaults to null meaning no template.
### factorio.version
+7 -7
View File
@@ -79,16 +79,16 @@ Marks the host as requiring a restart, the same way a plugin update does. Use it
### List Instances
ctl> instance list [--bases]
ctl> instance list [--templates]
List instances.
Base instances are only listed if `--bases` is passed.
Templates are only listed if `--templates` is passed.
### Create instance
ctl> instance create <name> [--id <instance id>] [--from <instance id>] [--base <instance>] [--is-base]
ctl> instance create <name> [--id <instance id>] [--from <instance id>] [--template <instance>] [--is-template]
Create a new instance. `name` is the instance name. `--id` is the optional id. `--from` copies the config of an existing instance. `--base` makes the new instance inherit all config values from the given base instance. `--is-base` creates the instance as a base, see `instance.is_base` in the [configuration docs](configuration.md).
Create a new instance. `name` is the instance name. `--id` is the optional id. `--from` copies the config of an existing instance. `--template` makes the new instance inherit all config values from the given template. `--is-template` creates the instance as a template, see `instance.is_template` in the [configuration docs](configuration.md). Use `--is-template --from <instance>` to make a template out of an existing instance.
### Kill instance
@@ -121,7 +121,7 @@ Most notably Clusterio records wall clock time while the save time is recorded i
ctl> instance config list <instance>
List config values for an instance. `instance` is the instance whose config values to list. Values inherited from a base instance are marked with `(inherited)`.
List config values for an instance. `instance` is the instance whose config values to list. Values inherited from a template are marked with `(inherited)`, object fields also list the properties set on the instance.
#### Set config value
@@ -135,9 +135,9 @@ To be written.
#### Inherit config value
ctl> instance config inherit <instance> <field>
ctl> instance config inherit <instance> <field> [prop]
Make a field in the instance config take its value from the base instance again, undoing a previous `set`. `instance` is the instance to update, `field` is the field to inherit.
Make a field in the instance config take its value from the template again, undoing a previous `set`. `instance` is the instance to update, `field` is the field to inherit, `prop` limits it to one property of an object field.
#### Edit instance config