fix: Restart policy for resources

This commit is contained in:
Andras Bacsai 2022-04-12 23:12:09 +02:00
parent 41329facf7
commit 383831c7b8
14 changed files with 161 additions and 17 deletions

View File

@ -285,7 +285,15 @@ export default async function (job: Job<BuilderJob, void, string>): Promise<void
networks: [docker.network], networks: [docker.network],
labels, labels,
depends_on: [], depends_on: [],
restart: 'always' restart: 'always',
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -23,6 +23,14 @@ export type ComposeFileService = {
dockerfile: string; dockerfile: string;
args?: Record<string, unknown>; args?: Record<string, unknown>;
}; };
deploy?: {
restart_policy?: {
condition?: string;
delay?: string;
max_attempts?: number;
window?: string;
};
};
}; };
export type ComposerFileVersion = export type ComposerFileVersion =

View File

@ -45,7 +45,15 @@ export const post: RequestHandler = async (event) => {
volumes: [volume], volumes: [volume],
ulimits, ulimits,
labels, labels,
restart: 'always' restart: 'always',
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -90,7 +90,15 @@ export const post: RequestHandler = async (event) => {
environment: config.ghost.environmentVariables, environment: config.ghost.environmentVariables,
restart: 'always', restart: 'always',
labels: makeLabelForServices('ghost'), 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`]: { [`${id}-mariadb`]: {
container_name: `${id}-mariadb`, container_name: `${id}-mariadb`,
@ -98,7 +106,15 @@ export const post: RequestHandler = async (event) => {
networks: [network], networks: [network],
volumes: [config.mariadb.volume], volumes: [config.mariadb.volume],
environment: config.mariadb.environmentVariables, environment: config.mariadb.environmentVariables,
restart: 'always' restart: 'always',
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -43,7 +43,15 @@ export const post: RequestHandler = async (event) => {
environment: config.environmentVariables, environment: config.environmentVariables,
restart: 'always', restart: 'always',
volumes: [config.volume], volumes: [config.volume],
labels: makeLabelForServices('languagetool') labels: makeLabelForServices('languagetool'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -48,7 +48,15 @@ export const post: RequestHandler = async (event) => {
environment: config.environmentVariables, environment: config.environmentVariables,
restart: 'always', restart: 'always',
volumes: [config.volume], volumes: [config.volume],
labels: makeLabelForServices('meilisearch') labels: makeLabelForServices('meilisearch'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -67,7 +67,15 @@ export const post: RequestHandler = async (event) => {
networks: [network], networks: [network],
volumes: [config.volume], volumes: [config.volume],
restart: 'always', restart: 'always',
labels: makeLabelForServices('minio') labels: makeLabelForServices('minio'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -44,7 +44,15 @@ export const post: RequestHandler = async (event) => {
volumes: [config.volume], volumes: [config.volume],
environment: config.environmentVariables, environment: config.environmentVariables,
restart: 'always', restart: 'always',
labels: makeLabelForServices('n8n') labels: makeLabelForServices('n8n'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -40,7 +40,15 @@ export const post: RequestHandler = async (event) => {
networks: [network], networks: [network],
environment: config.environmentVariables, environment: config.environmentVariables,
restart: 'always', restart: 'always',
labels: makeLabelForServices('nocodb') labels: makeLabelForServices('nocodb'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -133,7 +133,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`;
environment: config.plausibleAnalytics.environmentVariables, environment: config.plausibleAnalytics.environmentVariables,
restart: 'always', restart: 'always',
depends_on: [`${id}-postgresql`, `${id}-clickhouse`], 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`]: { [`${id}-postgresql`]: {
container_name: `${id}-postgresql`, container_name: `${id}-postgresql`,
@ -141,7 +149,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`;
networks: [network], networks: [network],
environment: config.postgresql.environmentVariables, environment: config.postgresql.environmentVariables,
volumes: [config.postgresql.volume], volumes: [config.postgresql.volume],
restart: 'always' restart: 'always',
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '10s',
max_attempts: 5,
window: '120s'
}
}
}, },
[`${id}-clickhouse`]: { [`${id}-clickhouse`]: {
build: workdir, build: workdir,
@ -149,7 +165,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`;
networks: [network], networks: [network],
environment: config.clickhouse.environmentVariables, environment: config.clickhouse.environmentVariables,
volumes: [config.clickhouse.volume], volumes: [config.clickhouse.volume],
restart: 'always' restart: 'always',
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '10s',
max_attempts: 5,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -42,7 +42,15 @@ export const post: RequestHandler = async (event) => {
volumes: [config.volume], volumes: [config.volume],
environment: config.environmentVariables, environment: config.environmentVariables,
restart: 'always', restart: 'always',
labels: makeLabelForServices('uptimekuma') labels: makeLabelForServices('uptimekuma'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -43,7 +43,15 @@ export const post: RequestHandler = async (event) => {
networks: [network], networks: [network],
volumes: [config.volume], volumes: [config.volume],
restart: 'always', restart: 'always',
labels: makeLabelForServices('vaultWarden') labels: makeLabelForServices('vaultWarden'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -52,7 +52,15 @@ export const post: RequestHandler = async (event) => {
networks: [network], networks: [network],
volumes: [config.volume], volumes: [config.volume],
restart: 'always', restart: 'always',
labels: makeLabelForServices('vscodeServer') labels: makeLabelForServices('vscodeServer'),
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {

View File

@ -77,7 +77,15 @@ export const post: RequestHandler = async (event) => {
networks: [network], networks: [network],
restart: 'always', restart: 'always',
depends_on: [`${id}-mysql`], 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`]: { [`${id}-mysql`]: {
container_name: `${id}-mysql`, container_name: `${id}-mysql`,
@ -85,7 +93,15 @@ export const post: RequestHandler = async (event) => {
volumes: [config.mysql.volume], volumes: [config.mysql.volume],
environment: config.mysql.environmentVariables, environment: config.mysql.environmentVariables,
networks: [network], networks: [network],
restart: 'always' restart: 'always',
deploy: {
restart_policy: {
condition: 'on-failure',
delay: '5s',
max_attempts: 3,
window: '120s'
}
}
} }
}, },
networks: { networks: {