From bcb84b8126ca705bad892185fcac6dd445403b61 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 6 Apr 2022 22:10:48 +0200 Subject: [PATCH] Revert "fix: Do not pull latest image" This reverts commit dd83e86bc3e4c89d220dbf496bc45d75e2f9590b. --- src/routes/services/[id]/ghost/start.json.ts | 6 ++++++ .../services/[id]/languagetool/start.json.ts | 6 ++++++ .../services/[id]/meilisearch/start.json.ts | 6 ++++++ src/routes/services/[id]/n8n/start.json.ts | 6 ++++++ src/routes/services/[id]/nocodb/start.json.ts | 6 ++++++ .../[id]/plausibleanalytics/start.json.ts | 15 ++++++++------- src/routes/services/[id]/uptimekuma/start.json.ts | 6 ++++++ .../services/[id]/vaultwarden/start.json.ts | 5 +++++ .../services/[id]/vscodeserver/start.json.ts | 14 +++++++------- src/routes/services/[id]/wordpress/start.json.ts | 5 +++++ 10 files changed, 61 insertions(+), 14 deletions(-) diff --git a/src/routes/services/[id]/ghost/start.json.ts b/src/routes/services/[id]/ghost/start.json.ts index 2f9861fe4..9e0b4ba11 100644 --- a/src/routes/services/[id]/ghost/start.json.ts +++ b/src/routes/services/[id]/ghost/start.json.ts @@ -114,7 +114,13 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); + try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/languagetool/start.json.ts b/src/routes/services/[id]/languagetool/start.json.ts index a7331d951..ac0f6a5bb 100644 --- a/src/routes/services/[id]/languagetool/start.json.ts +++ b/src/routes/services/[id]/languagetool/start.json.ts @@ -59,7 +59,13 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); + try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/meilisearch/start.json.ts b/src/routes/services/[id]/meilisearch/start.json.ts index deeac7e96..5a5a9d5c0 100644 --- a/src/routes/services/[id]/meilisearch/start.json.ts +++ b/src/routes/services/[id]/meilisearch/start.json.ts @@ -64,7 +64,13 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); + try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/n8n/start.json.ts b/src/routes/services/[id]/n8n/start.json.ts index 2455e1d50..3df1855d0 100644 --- a/src/routes/services/[id]/n8n/start.json.ts +++ b/src/routes/services/[id]/n8n/start.json.ts @@ -60,7 +60,13 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); + try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/nocodb/start.json.ts b/src/routes/services/[id]/nocodb/start.json.ts index bc139de21..1642038b3 100644 --- a/src/routes/services/[id]/nocodb/start.json.ts +++ b/src/routes/services/[id]/nocodb/start.json.ts @@ -51,7 +51,13 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); + try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/plausibleanalytics/start.json.ts b/src/routes/services/[id]/plausibleanalytics/start.json.ts index 2ed569f51..6ca37c5e8 100644 --- a/src/routes/services/[id]/plausibleanalytics/start.json.ts +++ b/src/routes/services/[id]/plausibleanalytics/start.json.ts @@ -168,14 +168,15 @@ COPY ./init-db.sh /docker-entrypoint-initdb.d/init-db.sh`; }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); - try { - await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); - return { - status: 200 - }; - } catch (error) { - return ErrorHandler(error); + if (version === 'latest') { + await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull`); } + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up --build -d` + ); + return { + status: 200 + }; } catch (error) { return ErrorHandler(error); } diff --git a/src/routes/services/[id]/uptimekuma/start.json.ts b/src/routes/services/[id]/uptimekuma/start.json.ts index 207bbd60a..7a72326e1 100644 --- a/src/routes/services/[id]/uptimekuma/start.json.ts +++ b/src/routes/services/[id]/uptimekuma/start.json.ts @@ -58,7 +58,13 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); + try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/vaultwarden/start.json.ts b/src/routes/services/[id]/vaultwarden/start.json.ts index 2aff0e570..ae13d9015 100644 --- a/src/routes/services/[id]/vaultwarden/start.json.ts +++ b/src/routes/services/[id]/vaultwarden/start.json.ts @@ -60,6 +60,11 @@ export const post: RequestHandler = async (event) => { const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200 diff --git a/src/routes/services/[id]/vscodeserver/start.json.ts b/src/routes/services/[id]/vscodeserver/start.json.ts index 553bed54c..dbe0c120c 100644 --- a/src/routes/services/[id]/vscodeserver/start.json.ts +++ b/src/routes/services/[id]/vscodeserver/start.json.ts @@ -68,14 +68,14 @@ export const post: RequestHandler = async (event) => { }; const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); - try { - await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); - return { - status: 200 - }; - } catch (error) { - return ErrorHandler(error); + + if (version === 'latest') { + await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull`); } + await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); + return { + status: 200 + }; } catch (error) { return ErrorHandler(error); } diff --git a/src/routes/services/[id]/wordpress/start.json.ts b/src/routes/services/[id]/wordpress/start.json.ts index aea5adab3..c0a28e0bd 100644 --- a/src/routes/services/[id]/wordpress/start.json.ts +++ b/src/routes/services/[id]/wordpress/start.json.ts @@ -105,6 +105,11 @@ export const post: RequestHandler = async (event) => { const composeFileDestination = `${workdir}/docker-compose.yaml`; await fs.writeFile(composeFileDestination, yaml.dump(composeFile)); try { + if (version === 'latest') { + await asyncExecShell( + `DOCKER_HOST=${host} docker compose -f ${composeFileDestination} pull` + ); + } await asyncExecShell(`DOCKER_HOST=${host} docker compose -f ${composeFileDestination} up -d`); return { status: 200