mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-17 20:49:32 +00:00
fix: cleanup plausible
This commit is contained in:
@@ -985,11 +985,22 @@ export async function cleanupPlausibleLogs(request: FastifyRequest<OnlyId>, repl
|
||||
const teamId = request.user.teamId;
|
||||
const { destinationDockerId, destinationDocker } = await getServiceFromDB({ id, teamId });
|
||||
if (destinationDockerId) {
|
||||
const logTables = await executeCommand({
|
||||
dockerId: destinationDocker.id,
|
||||
command: `docker exec ${id}-clickhouse clickhouse-client -q "SELECT name FROM system.tables;"`,
|
||||
shell: false
|
||||
});
|
||||
if (logTables.stdout !== '') {
|
||||
const tables = logTables.stdout.split('\n').filter((t) => t.includes('_log'));
|
||||
for (const table of tables) {
|
||||
console.log(`Truncating table ${table}`)
|
||||
await executeCommand({
|
||||
dockerId: destinationDocker.id,
|
||||
command: `docker exec ${id}-clickhouse /usr/bin/clickhouse-client -q \\"SELECT name FROM system.tables WHERE name LIKE '%log%';\\"| xargs -I{} /usr/bin/clickhouse-client -q \"TRUNCATE TABLE system.{};\"`,
|
||||
shell: true
|
||||
command: `docker exec ${id}-clickhouse clickhouse-client -q "TRUNCATE TABLE system.${table};"`,
|
||||
shell: false
|
||||
});
|
||||
}
|
||||
}
|
||||
return await reply.code(201).send();
|
||||
}
|
||||
throw { status: 500, message: 'Could cleanup logs.' };
|
||||
@@ -1108,14 +1119,11 @@ export async function activateWordpressFtp(
|
||||
} catch (error) { }
|
||||
const volumes = [
|
||||
`${id}-wordpress-data:/home/${ftpUser}/wordpress`,
|
||||
`${
|
||||
isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
|
||||
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
|
||||
}/${id}.ed25519:/etc/ssh/ssh_host_ed25519_key`,
|
||||
`${
|
||||
isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
|
||||
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
|
||||
}/${id}.rsa:/etc/ssh/ssh_host_rsa_key`,
|
||||
`${
|
||||
isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
|
||||
`${isDev ? hostkeyDir : '/var/lib/docker/volumes/coolify-ssl-certs/_data/hostkeys'
|
||||
}/${id}.sh:/etc/sftp.d/chmod.sh`
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user