fix: autoUpdater & cleanupStorage jobs
This commit is contained in:
parent
727133e28b
commit
028f883499
@ -5,8 +5,10 @@ import env from '@fastify/env';
|
|||||||
import cookie from '@fastify/cookie';
|
import cookie from '@fastify/cookie';
|
||||||
import path, { join } from 'path';
|
import path, { join } from 'path';
|
||||||
import autoLoad from '@fastify/autoload';
|
import autoLoad from '@fastify/autoload';
|
||||||
import { asyncExecShell, isDev, listSettings, prisma } from './lib/common';
|
import { asyncExecShell, isDev, listSettings, prisma, version } from './lib/common';
|
||||||
import { scheduler } from './lib/scheduler';
|
import { scheduler } from './lib/scheduler';
|
||||||
|
import axios from 'axios';
|
||||||
|
import compareVersions from 'compare-versions';
|
||||||
|
|
||||||
declare module 'fastify' {
|
declare module 'fastify' {
|
||||||
interface FastifyInstance {
|
interface FastifyInstance {
|
||||||
@ -113,10 +115,24 @@ fastify.listen({ port, host }, async (err: any, address: any) => {
|
|||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
|
const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
|
||||||
if (isAutoUpdateEnabled) {
|
if (isAutoUpdateEnabled) {
|
||||||
|
const currentVersion = version;
|
||||||
|
const { data: versions } = await axios
|
||||||
|
.get(
|
||||||
|
`https://get.coollabs.io/versions.json`
|
||||||
|
, {
|
||||||
|
params: {
|
||||||
|
appId: process.env['COOLIFY_APP_ID'] || undefined,
|
||||||
|
version: currentVersion
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const latestVersion = versions['coolify'].main.version;
|
||||||
|
const isUpdateAvailable = compareVersions(latestVersion, currentVersion);
|
||||||
|
if (isUpdateAvailable === 1) {
|
||||||
if (scheduler.workers.has('deployApplication')) {
|
if (scheduler.workers.has('deployApplication')) {
|
||||||
scheduler.workers.get('deployApplication').postMessage("status:autoUpdater");
|
scheduler.workers.get('deployApplication').postMessage("status:autoUpdater");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, isDev ? 5000 : 60000 * 15)
|
}, isDev ? 5000 : 60000 * 15)
|
||||||
|
|
||||||
// Cleanup storage
|
// Cleanup storage
|
||||||
|
@ -20,7 +20,6 @@ const options: any = {
|
|||||||
}
|
}
|
||||||
if (message.caller === 'cleanupStorage') {
|
if (message.caller === 'cleanupStorage') {
|
||||||
if (!scheduler.workers.has('cleanupStorage')) {
|
if (!scheduler.workers.has('cleanupStorage')) {
|
||||||
await scheduler.stop('deployApplication');
|
|
||||||
await scheduler.run('cleanupStorage')
|
await scheduler.run('cleanupStorage')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,9 +163,9 @@
|
|||||||
},
|
},
|
||||||
"deployment_queued": "Deployment queued.",
|
"deployment_queued": "Deployment queued.",
|
||||||
"confirm_to_delete": "Are you sure you would like to delete '{{name}}'?",
|
"confirm_to_delete": "Are you sure you would like to delete '{{name}}'?",
|
||||||
"stop_application": "Stop application",
|
"stop_application": "Stop Application",
|
||||||
"permission_denied_stop_application": "You do not have permission to stop the application.",
|
"permission_denied_stop_application": "You do not have permission to stop the application.",
|
||||||
"rebuild_application": "Rebuild application",
|
"rebuild_application": "Rebuild Application",
|
||||||
"permission_denied_rebuild_application": "You do not have permission to rebuild application.",
|
"permission_denied_rebuild_application": "You do not have permission to rebuild application.",
|
||||||
"build_and_start_application": "Deploy",
|
"build_and_start_application": "Deploy",
|
||||||
"permission_denied_build_and_start_application": "You do not have permission to deploy application.",
|
"permission_denied_build_and_start_application": "You do not have permission to deploy application.",
|
||||||
|
@ -264,7 +264,7 @@
|
|||||||
class="icons bg-transparent tooltip tooltip-primary tooltip-bottom text-sm flex items-center space-x-2"
|
class="icons bg-transparent tooltip tooltip-primary tooltip-bottom text-sm flex items-center space-x-2"
|
||||||
data-tip={$appSession.isAdmin
|
data-tip={$appSession.isAdmin
|
||||||
? isQueueActive
|
? isQueueActive
|
||||||
? 'Rebuild application'
|
? 'Rebuild Application'
|
||||||
: 'Autoupdate inprogress. Cannot rebuild application.'
|
: 'Autoupdate inprogress. Cannot rebuild application.'
|
||||||
: 'You do not have permission to rebuild application.'}
|
: 'You do not have permission to rebuild application.'}
|
||||||
>
|
>
|
||||||
|
@ -87,6 +87,9 @@
|
|||||||
{#if application.fqdn}
|
{#if application.fqdn}
|
||||||
<div class="truncate text-center">{getDomain(application.fqdn) || ''}</div>
|
<div class="truncate text-center">{getDomain(application.fqdn) || ''}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if application.settings.isBot}
|
||||||
|
<div class="truncate text-center">BOT</div>
|
||||||
|
{/if}
|
||||||
{#if application.destinationDocker?.name}
|
{#if application.destinationDocker?.name}
|
||||||
<div class="truncate text-center">{application.destinationDocker.name}</div>
|
<div class="truncate text-center">{application.destinationDocker.name}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user