This commit is contained in:
Andras Bacsai 2022-08-26 09:01:48 +02:00
parent ee4360de3a
commit 224604f2e7
5 changed files with 16 additions and 31 deletions

View File

@ -21,7 +21,7 @@ ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma-engines/query-engine \
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
PRISMA_CLIENT_ENGINE_TYPE=binary
COPY --from=coollabsio/prisma-engine:3.15 /prisma-engines/query-engine /prisma-engines/migration-engine /prisma-engines/introspection-engine /prisma-engines/prisma-fmt /app/prisma-engines/
COPY --from=coollabsio/prisma-engine:3.15 /prisma-engines/query-engine /app/prisma-engines/
RUN apk add --no-cache git git-lfs openssh-client curl jq cmake sqlite openssl psmisc
RUN curl -sL https://unpkg.com/@pnpm/self-installer | node

View File

@ -103,8 +103,7 @@ fastify.listen({ port, host }, async (err: any, address: any) => {
}
console.log(`Coolify's API is listening on ${host}:${port}`);
await initServer();
// await scheduler.start('cleanupPrismaEngines');
// await scheduler.start('checkProxies');
const graceful = new Graceful({ brees: [scheduler] });
graceful.listen();
@ -133,9 +132,9 @@ fastify.listen({ port, host }, async (err: any, address: any) => {
}, 10000)
// cleanupPrismaEngines
setInterval(async () => {
scheduler.workers.has('infrastructure') && scheduler.workers.get('infrastructure').postMessage("action:cleanupPrismaEngines")
}, 60000)
// setInterval(async () => {
// scheduler.workers.has('infrastructure') && scheduler.workers.get('infrastructure').postMessage("action:cleanupPrismaEngines")
// }, 60000)
await getArch();
await getIPAddress();

View File

@ -39,7 +39,7 @@ async function autoUpdater() {
console.log(error);
}
}
async function checkProxies(){
async function checkProxies() {
try {
const { default: isReachable } = await import('is-port-reachable');
let portReachable;
@ -106,16 +106,16 @@ async function checkProxies(){
}
}
}
} catch(error) {
} catch (error) {
}
}
async function cleanupPrismaEngines(){
async function cleanupPrismaEngines() {
if (!isDev) {
try {
const { stdout } = await asyncExecShell(`ps -ef | grep /app/prisma-engines/query-engine | grep -v grep | wc -l | xargs`)
if (stdout.trim() != null && stdout.trim() != '' && Number(stdout.trim()) > 1) {
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 10m`)
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 1m`)
}
} catch (error) {
console.log(error);
@ -178,7 +178,7 @@ async function cleanupStorage() {
}
(async () => {
let status ={
let status = {
cleanupStorage: false,
autoUpdater: false
}

View File

@ -155,11 +155,11 @@ export const prisma = new PrismaClient({
],
});
// prisma.$on('query', (e) => {
// console.log('Query: ' + e.query)
// console.log('Params: ' + e.params)
// console.log('Duration: ' + e.duration + 'ms')
// })
prisma.$on('query', (e) => {
console.log('Query: ' + e.query)
console.log('Params: ' + e.params)
console.log('Duration: ' + e.duration + 'ms')
})
export const base64Encode = (text: string): string => {
return Buffer.from(text).toString('base64');
};

View File

@ -20,20 +20,6 @@ const options: any = {
jobs: [
{ name: 'infrastructure' },
{ name: 'deployApplication' },
// {
// name: 'cleanupStorage',
// },
// {
// name: 'cleanupPrismaEngines',
// interval: '1m'
// },
// {
// name: 'checkProxies',
// interval: '10s'
// },
// {
// name: 'autoUpdater',
// }
],
};
if (isDev) options.root = path.join(__dirname, '../jobs');