diff --git a/examples/swarm-app.yml b/examples/swarm-app.yml index 6cf2684..7074744 100644 --- a/examples/swarm-app.yml +++ b/examples/swarm-app.yml @@ -46,6 +46,8 @@ service_specs: replicas: 2 stop_signal: SIGQUIT stop_grace_period: 10 + user: '0' + dir: /etc/nginx placement: preferences: - { spread: node.hostname } diff --git a/schema.json b/schema.json index 3f0d922..440b291 100644 --- a/schema.json +++ b/schema.json @@ -156,6 +156,9 @@ } } }, + "dir": { + "type": "string" + }, "mounts": { "values": { "properties": { diff --git a/src/service-spec.ts b/src/service-spec.ts index aafed40..2741089 100644 --- a/src/service-spec.ts +++ b/src/service-spec.ts @@ -79,6 +79,7 @@ export function initServiceSpec ({appName, serviceName, config, hashedConfigs, c User: serviceConfig.user, Configs: configs, Isolation: "default", + Dir: serviceConfig.dir, HealthCheck: { Test: serviceConfig.health_check?.test, Interval: serviceConfig.health_check?.interval, @@ -87,6 +88,14 @@ export function initServiceSpec ({appName, serviceName, config, hashedConfigs, c StartInterval: serviceConfig.health_check?.start_interval, Retries: serviceConfig.health_check?.retries, }, + Mounts: Object.entries(serviceConfig.mounts ?? {}).map(([t, m]) => { + return { + Target: t, + Source: m.source, + Type: m.type, + ReadOnly: m.readonly, + }; + }), }, Placement: { Constraints: serviceConfig.placement?.constraints, diff --git a/src/swarm-app-config.ts b/src/swarm-app-config.ts index c11194c..beadb5a 100644 --- a/src/swarm-app-config.ts +++ b/src/swarm-app-config.ts @@ -53,6 +53,7 @@ export interface SwarmAppServiceConfig { start_period?: number; start_interval?: number; }; + dir?: string; mounts?: Record = { start_interval: {type: "int32"}, }, }, + dir: {type: "string"}, mounts: { values: { properties: {