diff --git a/prisma/seed.cjs b/prisma/seed.cjs index 1e6b160c6..30c4896c6 100644 --- a/prisma/seed.cjs +++ b/prisma/seed.cjs @@ -5,6 +5,12 @@ const prisma = new PrismaClient(); const crypto = require('crypto'); const generator = require('generate-password'); const cuid = require('cuid'); +const compare = require('compare-versions'); +const { version } = require('../package.json'); +const child = require('child_process'); +const util = require('util'); + +const algorithm = 'aes-256-ctr'; function generatePassword(length = 24) { return generator.generate({ @@ -13,7 +19,7 @@ function generatePassword(length = 24) { strict: true }); } -const algorithm = 'aes-256-ctr'; +const asyncExecShell = util.promisify(child.exec); async function main() { // Enable registration for the first user @@ -64,6 +70,14 @@ async function main() { } }); } + if (compare('2.9.2', version) >= 0) { + // Force stop Coolify Proxy, as it had a bug in < 2.9.2. TrustProxy + api.insecure + try { + await asyncExecShell(`docker stop -t 0 coolify-proxy && docker rm coolify-proxy`); + } catch (error) { + console.log(error); + } + } } main() .catch((e) => { diff --git a/src/routes/update.json.ts b/src/routes/update.json.ts index 333de784e..a7c3e5c57 100644 --- a/src/routes/update.json.ts +++ b/src/routes/update.json.ts @@ -6,7 +6,6 @@ import * as db from '$lib/database'; import type { RequestHandler } from '@sveltejs/kit'; import compare from 'compare-versions'; import got from 'got'; -import { checkContainer, startCoolifyProxy, startTraefikProxy } from '$lib/haproxy'; export const get: RequestHandler = async (request) => { try { @@ -44,12 +43,6 @@ export const post: RequestHandler = async (event) => { await asyncExecShell( `sed -i '/COOLIFY_AUTO_UPDATE=/c\COOLIFY_AUTO_UPDATE=${settings.isAutoUpdateEnabled}' .env` ); - // TODO: Remove this after release - try { - await asyncExecShell( - `docker run --rm -tid --env-file .env -v /var/run/docker.sock:/var/run/docker.sock -v coolify-db coollabsio/coolify:${latestVersion} /bin/sh -c "docker stop -t 0 coolify-proxy && docker rm coolify-proxy"` - ); - } catch (error) {} await asyncExecShell( `docker run --rm -tid --env-file .env -v /var/run/docker.sock:/var/run/docker.sock -v coolify-db coollabsio/coolify:${latestVersion} /bin/sh -c "env | grep COOLIFY > .env && echo 'TAG=${latestVersion}' >> .env && docker stop -t 0 coolify coolify-redis && docker rm coolify coolify-redis && docker compose up -d --force-recreate"` );