diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts index 7419fa5dc..e76104376 100644 --- a/src/lib/queues/builder.ts +++ b/src/lib/queues/builder.ts @@ -285,7 +285,15 @@ export default async function (job: Job): Promise; }; + deploy?: { + restart_policy?: { + condition?: string; + delay?: string; + max_attempts?: number; + window?: string; + }; + }; }; export type ComposerFileVersion = diff --git a/src/routes/databases/[id]/start.json.ts b/src/routes/databases/[id]/start.json.ts index 59fd7c1ea..7a7d8dedf 100644 --- a/src/routes/databases/[id]/start.json.ts +++ b/src/routes/databases/[id]/start.json.ts @@ -45,7 +45,15 @@ export const post: RequestHandler = async (event) => { volumes: [volume], ulimits, labels, - restart: 'always' + restart: 'always', + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/ghost/start.json.ts b/src/routes/services/[id]/ghost/start.json.ts index 41c5e95d4..4a3888958 100644 --- a/src/routes/services/[id]/ghost/start.json.ts +++ b/src/routes/services/[id]/ghost/start.json.ts @@ -90,7 +90,15 @@ export const post: RequestHandler = async (event) => { environment: config.ghost.environmentVariables, restart: 'always', labels: makeLabelForServices('ghost'), - depends_on: [`${id}-mariadb`] + depends_on: [`${id}-mariadb`], + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } }, [`${id}-mariadb`]: { container_name: `${id}-mariadb`, @@ -98,7 +106,15 @@ export const post: RequestHandler = async (event) => { networks: [network], volumes: [config.mariadb.volume], environment: config.mariadb.environmentVariables, - restart: 'always' + restart: 'always', + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/languagetool/start.json.ts b/src/routes/services/[id]/languagetool/start.json.ts index ac0f6a5bb..a390d0b5a 100644 --- a/src/routes/services/[id]/languagetool/start.json.ts +++ b/src/routes/services/[id]/languagetool/start.json.ts @@ -43,7 +43,15 @@ export const post: RequestHandler = async (event) => { environment: config.environmentVariables, restart: 'always', volumes: [config.volume], - labels: makeLabelForServices('languagetool') + labels: makeLabelForServices('languagetool'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/meilisearch/start.json.ts b/src/routes/services/[id]/meilisearch/start.json.ts index 5a5a9d5c0..04bea2f37 100644 --- a/src/routes/services/[id]/meilisearch/start.json.ts +++ b/src/routes/services/[id]/meilisearch/start.json.ts @@ -48,7 +48,15 @@ export const post: RequestHandler = async (event) => { environment: config.environmentVariables, restart: 'always', volumes: [config.volume], - labels: makeLabelForServices('meilisearch') + labels: makeLabelForServices('meilisearch'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/minio/start.json.ts b/src/routes/services/[id]/minio/start.json.ts index 6e14a42ca..7c3dc9e75 100644 --- a/src/routes/services/[id]/minio/start.json.ts +++ b/src/routes/services/[id]/minio/start.json.ts @@ -67,7 +67,15 @@ export const post: RequestHandler = async (event) => { networks: [network], volumes: [config.volume], restart: 'always', - labels: makeLabelForServices('minio') + labels: makeLabelForServices('minio'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/n8n/start.json.ts b/src/routes/services/[id]/n8n/start.json.ts index 3df1855d0..abf203680 100644 --- a/src/routes/services/[id]/n8n/start.json.ts +++ b/src/routes/services/[id]/n8n/start.json.ts @@ -44,7 +44,15 @@ export const post: RequestHandler = async (event) => { volumes: [config.volume], environment: config.environmentVariables, restart: 'always', - labels: makeLabelForServices('n8n') + labels: makeLabelForServices('n8n'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/nocodb/start.json.ts b/src/routes/services/[id]/nocodb/start.json.ts index 1642038b3..e51ceb6a1 100644 --- a/src/routes/services/[id]/nocodb/start.json.ts +++ b/src/routes/services/[id]/nocodb/start.json.ts @@ -40,7 +40,15 @@ export const post: RequestHandler = async (event) => { networks: [network], environment: config.environmentVariables, restart: 'always', - labels: makeLabelForServices('nocodb') + labels: makeLabelForServices('nocodb'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/plausibleanalytics/start.json.ts b/src/routes/services/[id]/plausibleanalytics/start.json.ts index 6ca37c5e8..0ac630dc5 100644 --- a/src/routes/services/[id]/plausibleanalytics/start.json.ts +++ b/src/routes/services/[id]/plausibleanalytics/start.json.ts @@ -133,7 +133,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`; environment: config.plausibleAnalytics.environmentVariables, restart: 'always', depends_on: [`${id}-postgresql`, `${id}-clickhouse`], - labels: makeLabelForServices('plausibleAnalytics') + labels: makeLabelForServices('plausibleAnalytics'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '10s', + max_attempts: 5, + window: '120s' + } + } }, [`${id}-postgresql`]: { container_name: `${id}-postgresql`, @@ -141,7 +149,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`; networks: [network], environment: config.postgresql.environmentVariables, volumes: [config.postgresql.volume], - restart: 'always' + restart: 'always', + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '10s', + max_attempts: 5, + window: '120s' + } + } }, [`${id}-clickhouse`]: { build: workdir, @@ -149,7 +165,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`; networks: [network], environment: config.clickhouse.environmentVariables, volumes: [config.clickhouse.volume], - restart: 'always' + restart: 'always', + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '10s', + max_attempts: 5, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/uptimekuma/start.json.ts b/src/routes/services/[id]/uptimekuma/start.json.ts index 7a72326e1..48af20f9e 100644 --- a/src/routes/services/[id]/uptimekuma/start.json.ts +++ b/src/routes/services/[id]/uptimekuma/start.json.ts @@ -42,7 +42,15 @@ export const post: RequestHandler = async (event) => { volumes: [config.volume], environment: config.environmentVariables, restart: 'always', - labels: makeLabelForServices('uptimekuma') + labels: makeLabelForServices('uptimekuma'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/vaultwarden/start.json.ts b/src/routes/services/[id]/vaultwarden/start.json.ts index ae13d9015..a95973525 100644 --- a/src/routes/services/[id]/vaultwarden/start.json.ts +++ b/src/routes/services/[id]/vaultwarden/start.json.ts @@ -43,7 +43,15 @@ export const post: RequestHandler = async (event) => { networks: [network], volumes: [config.volume], restart: 'always', - labels: makeLabelForServices('vaultWarden') + labels: makeLabelForServices('vaultWarden'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/vscodeserver/start.json.ts b/src/routes/services/[id]/vscodeserver/start.json.ts index dbe0c120c..d839ce5ff 100644 --- a/src/routes/services/[id]/vscodeserver/start.json.ts +++ b/src/routes/services/[id]/vscodeserver/start.json.ts @@ -52,7 +52,15 @@ export const post: RequestHandler = async (event) => { networks: [network], volumes: [config.volume], restart: 'always', - labels: makeLabelForServices('vscodeServer') + labels: makeLabelForServices('vscodeServer'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: { diff --git a/src/routes/services/[id]/wordpress/start.json.ts b/src/routes/services/[id]/wordpress/start.json.ts index c0a28e0bd..40209819f 100644 --- a/src/routes/services/[id]/wordpress/start.json.ts +++ b/src/routes/services/[id]/wordpress/start.json.ts @@ -77,7 +77,15 @@ export const post: RequestHandler = async (event) => { networks: [network], restart: 'always', depends_on: [`${id}-mysql`], - labels: makeLabelForServices('wordpress') + labels: makeLabelForServices('wordpress'), + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } }, [`${id}-mysql`]: { container_name: `${id}-mysql`, @@ -85,7 +93,15 @@ export const post: RequestHandler = async (event) => { volumes: [config.mysql.volume], environment: config.mysql.environmentVariables, networks: [network], - restart: 'always' + restart: 'always', + deploy: { + restart_policy: { + condition: 'on-failure', + delay: '5s', + max_attempts: 3, + window: '120s' + } + } } }, networks: {