cleanup logs

This commit is contained in:
Andras Bacsai 2022-09-06 08:01:04 +02:00
parent 867f06d813
commit 936baf676e
22 changed files with 15 additions and 69 deletions

View File

@ -177,9 +177,7 @@ import * as buildpacks from '../lib/buildPacks';
try {
await prisma.build.update({ where: { id: buildId }, data: { commit } });
} catch (err) {
console.log(err);
}
} catch (err) { }
if (!pullmergeRequestId) {
if (configHash !== currentHash) {

View File

@ -21,7 +21,6 @@ async function autoUpdater() {
const activeCount = 0
if (activeCount === 0) {
if (!isDev) {
console.log(`Updating Coolify to ${latestVersion}.`);
await asyncExecShell(`docker pull coollabsio/coolify:${latestVersion}`);
await asyncExecShell(`env | grep COOLIFY > .env`);
await asyncExecShell(
@ -35,9 +34,7 @@ async function autoUpdater() {
}
}
}
} catch (error) {
console.log(error);
}
} catch (error) { }
}
async function checkProxies() {
try {
@ -71,9 +68,7 @@ async function checkProxies() {
}
try {
await createRemoteEngineConfiguration(docker.id)
} catch (error) {
console.log({ error })
}
} catch (error) { }
}
}
// TCP Proxies
@ -132,9 +127,7 @@ async function cleanupPrismaEngines() {
if (stdout.trim() != null && stdout.trim() != '' && Number(stdout.trim()) > 1) {
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 1m`)
}
} catch (error) {
console.log(error);
}
} catch (error) { }
}
}
async function cleanupStorage() {
@ -185,9 +178,7 @@ async function cleanupStorage() {
lowDiskSpace = true;
}
}
} catch (error) {
console.log(error);
}
} catch (error) { }
await cleanupDockerStorage(destination.id, lowDiskSpace, false)
}
}

View File

@ -512,7 +512,6 @@ export async function copyBaseConfigurationFiles(
);
}
} catch (error) {
console.log(error);
throw new Error(error);
}
}

View File

@ -471,9 +471,7 @@ export async function createRemoteEngineConfiguration(id: string) {
if (numberOfSSHTunnelsRunning !== '' && Number(numberOfSSHTunnelsRunning.trim()) == 0) {
try {
await asyncExecShell(`SSH_AUTH_SOCK=/tmp/coolify-ssh-agent.pid ssh -F /dev/null -o "StrictHostKeyChecking no" -fNL ${localPort}:localhost:${remotePort} ${remoteUser}@${remoteIpAddress}`)
} catch (error) {
console.log(error)
}
} catch (error) { }
}
const config = sshConfig.parse('')
@ -1250,7 +1248,6 @@ export async function startTraefikTCPProxy(
})
}
} catch (error) {
console.log(error);
return error;
}
}
@ -1444,9 +1441,7 @@ export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) {
if (images) {
await executeDockerCmd({ dockerId, command: `docker rmi -f ${images}" -q | xargs -r` })
}
} catch (error) {
//console.log(error);
}
} catch (error) { }
if (lowDiskSpace || force) {
if (isDev) {
if (!force) console.log(`[DEV MODE] Low disk space: ${lowDiskSpace}`);
@ -1454,25 +1449,17 @@ export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) {
}
try {
await executeDockerCmd({ dockerId, command: `docker container prune -f --filter "label=coolify.managed=true"` })
} catch (error) {
//console.log(error);
}
} catch (error) { }
try {
await executeDockerCmd({ dockerId, command: `docker image prune -f` })
} catch (error) {
//console.log(error);
}
} catch (error) { }
try {
await executeDockerCmd({ dockerId, command: `docker image prune -a -f` })
} catch (error) {
//console.log(error);
}
} catch (error) { }
// Cleanup build caches
try {
await executeDockerCmd({ dockerId, command: `docker builder prune -a -f` })
} catch (error) {
//console.log(error);
}
} catch (error) { }
}
}

View File

@ -76,7 +76,6 @@ export async function removeContainer({
await executeDockerCmd({ dockerId, command: `docker rm ${id}` })
}
} catch (error) {
console.log(error);
throw error;
}
}

View File

@ -21,7 +21,6 @@ export default fp<FastifyJWTOptions>(async (fastify, opts) => {
try {
await request.jwtVerify()
} catch (err) {
console.log(err)
reply.send(err)
}
})

View File

@ -767,7 +767,6 @@ export async function saveConnectedDatabase(request, reply) {
try {
const { id } = request.params
const { databaseId, type } = request.body
console.log({ databaseId, type })
await prisma.application.update({ where: { id }, data: { connectedDatabase: { upsert: { create: { database: { connect: { id: databaseId } }, hostedDatabaseType: type }, update: { database: { connect: { id: databaseId } }, hostedDatabaseType: type } } } } })
return reply.code(201).send()
} catch ({ status, message }) {
@ -930,7 +929,6 @@ export async function getPreviews(request: FastifyRequest<OnlyId>) {
})
}
} catch ({ status, message }) {
console.log({ status, message })
return errorHandler({ status, message })
}
}

View File

@ -280,15 +280,12 @@ export async function startDatabase(request: FastifyRequest<OnlyId>) {
await fs.writeFile(composeFileDestination, yaml.dump(composeFile));
try {
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker volume create ${volumeName}` })
} catch (error) {
console.log(error);
}
} catch (error) { }
try {
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose -f ${composeFileDestination} up -d` })
if (isPublic) await startTraefikTCPProxy(destinationDocker, id, publicPort, privatePort);
return {};
} catch (error) {
console.log(error)
throw {
error
};

View File

@ -30,7 +30,6 @@ export async function listDestinations(request: FastifyRequest<ListDestinations>
destinations
}
} catch ({ status, message }) {
console.log({ status, message })
return errorHandler({ status, message })
}
}
@ -114,7 +113,6 @@ export async function newDestination(request: FastifyRequest<NewDestination>, re
}
} catch ({ status, message }) {
console.log({ status, message })
return errorHandler({ status, message })
}
}
@ -162,7 +160,6 @@ export async function startProxy(request: FastifyRequest<Proxy>) {
await startTraefikProxy(id);
return {}
} catch ({ status, message }) {
console.log({ status, message })
await stopTraefikProxy(id);
return errorHandler({ status, message })
}

View File

@ -65,7 +65,6 @@ export async function update(request: FastifyRequest<Update>) {
);
return {};
} else {
console.log(latestVersion);
await asyncSleep(2000);
return {};
}
@ -81,7 +80,6 @@ export async function restartCoolify(request: FastifyRequest<any>) {
asyncExecShell(`docker restart coolify`);
return {};
} else {
console.log('Restarting Coolify')
return {};
}
}

View File

@ -560,10 +560,7 @@ export async function activateWordpressFtp(request: FastifyRequest<ActivateWordp
command: `docker stop -t 0 ${id}-ftp && docker rm ${id}-ftp`
})
}
} catch (error) {
console.log(error);
//
}
} catch (error) { }
const volumes = [
`${id}-wordpress-data:/home/${ftpUser}/wordpress`,
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
@ -642,9 +639,7 @@ export async function activateWordpressFtp(request: FastifyRequest<ActivateWordp
await asyncExecShell(
`rm -fr ${hostkeyDir}/${id}-docker-compose.yml ${hostkeyDir}/${id}.ed25519 ${hostkeyDir}/${id}.ed25519.pub ${hostkeyDir}/${id}.rsa ${hostkeyDir}/${id}.rsa.pub ${hostkeyDir}/${id}.sh`
);
} catch (error) {
console.log(error)
}
} catch (error) { }
}

View File

@ -100,8 +100,7 @@ export async function gitHubEvents(request: FastifyRequest<GitHubEvents>): Promi
const checksum = Buffer.from(githubSignature, 'utf8');
//@ts-ignore
if (checksum.length !== digest.length || !crypto.timingSafeEqual(digest, checksum)) {
console.log('SHA256 checksum failed. Are you doing something fishy?')
// throw { status: 500, message: 'SHA256 checksum failed. Are you doing something fishy?'
throw { status: 500, message: 'SHA256 checksum failed. Are you doing something fishy?' }
};
}

View File

@ -16,7 +16,6 @@
updateStatus.loading = true;
try {
if (dev) {
console.log(`updating to ${latestVersion}`);
await asyncSleep(4000);
return window.location.reload();
} else {

View File

@ -65,7 +65,6 @@
}
dispatch('refresh');
} catch (error) {
console.log(error);
return errorNotification(error);
}
}

View File

@ -239,7 +239,6 @@
type: 'success'
});
} catch (error) {
console.log(error);
//@ts-ignore
if (error?.message.startsWith($t('application.dns_not_set_partial_error'))) {
forceSave = true;

View File

@ -67,7 +67,6 @@
}
}, 1000);
} catch (error) {
console.log(error);
return errorNotification(error);
}
}
@ -80,7 +79,6 @@
applicationId: id
});
} catch (error) {
console.log(error);
return errorNotification(error);
}
}

View File

@ -39,7 +39,6 @@
logs = data.logs;
}
} catch (error) {
console.log(error);
return errorNotification(error);
} finally {
logsLoading = false;

View File

@ -45,7 +45,6 @@
logs = data.logs;
}
} catch (error) {
console.log(error);
return errorNotification(error);
} finally {
loadingLogs = false;

View File

@ -40,7 +40,6 @@
}
};
} catch (error) {
console.log(error);
return handlerNotFoundLoad(error, url);
}
};

View File

@ -47,7 +47,6 @@
}
};
} catch (error) {
console.log(error);
return handlerNotFoundLoad(error, url);
}
};

View File

@ -41,7 +41,6 @@
logs = data.logs;
}
} catch (error) {
console.log(error);
return errorNotification(error);
} finally {
logsLoading = false;

View File

@ -129,7 +129,6 @@
}
}
}
console.log(error);
return errorNotification(error);
} finally {
loading.save = false;