fix: Only restart coolify proxy in case of version prior to 2.9.2
This commit is contained in:
parent
67bb5d973b
commit
a7aca0ce8b
@ -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) => {
|
||||
|
@ -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"`
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user