Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Restart policy for resources

Andras Bacsai383831c7b8ee
diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts
index 7419fa5dcf..e761043768 100644
--- a/src/lib/queues/builder.ts
+++ b/src/lib/queues/builder.ts
@@ -285,7 +285,15 @@ export default async function (job: Job<BuilderJob, void, string>): Promise<void
networks: [docker.network],
labels,
depends_on: [],
- restart: 'always'
+ restart: 'always',
+ deploy: {
+ restart_policy: {
+ condition: 'on-failure',
+ delay: '5s',
+ max_attempts: 3,
+ window: '120s'
+ }
+ }
}
},
networks: {
diff --git a/src/lib/types/composeFile.ts b/src/lib/types/composeFile.ts
index 1e2a0723c3..33dfbdd43c 100644
--- a/src/lib/types/composeFile.ts
+++ b/src/lib/types/composeFile.ts
@@ -23,6 +23,14 @@ export type ComposeFileService = {
dockerfile: string;
args?: Record<string, unknown>;
};
+ 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 59fd7c1ea3..7a7d8dedfd 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 41c5e95d4c..4a38889586 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 ac0f6a5bb6..a390d0b5a0 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 5a5a9d5c09..04bea2f370 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 6e14a42ca3..7c3dc9e750 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 3df1855d06..abf203680d 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 1642038b3b..e51ceb6a10 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 6ca37c5e87..0ac630dc50 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 7a72326e15..48af20f9ed 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 ae13d90154..a959735256 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 dbe0c120ce..d839ce5ff6 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 c0a28e0bd4..40209819f7 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: {