diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index ed862a59e..18864dd6e 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -5,8 +5,10 @@ import env from '@fastify/env'; import cookie from '@fastify/cookie'; import path, { join } from 'path'; 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 axios from 'axios'; +import compareVersions from 'compare-versions'; declare module 'fastify' { interface FastifyInstance { @@ -113,8 +115,22 @@ fastify.listen({ port, host }, async (err: any, address: any) => { setInterval(async () => { const { isAutoUpdateEnabled } = await prisma.setting.findFirst(); if (isAutoUpdateEnabled) { - if (scheduler.workers.has('deployApplication')) { - scheduler.workers.get('deployApplication').postMessage("status:autoUpdater"); + 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')) { + scheduler.workers.get('deployApplication').postMessage("status:autoUpdater"); + } } } }, isDev ? 5000 : 60000 * 15) diff --git a/apps/api/src/lib/scheduler.ts b/apps/api/src/lib/scheduler.ts index 148764351..b120dcea1 100644 --- a/apps/api/src/lib/scheduler.ts +++ b/apps/api/src/lib/scheduler.ts @@ -20,7 +20,6 @@ const options: any = { } if (message.caller === 'cleanupStorage') { if (!scheduler.workers.has('cleanupStorage')) { - await scheduler.stop('deployApplication'); await scheduler.run('cleanupStorage') } } diff --git a/apps/ui/src/lib/locales/en.json b/apps/ui/src/lib/locales/en.json index 4060dcc8a..6e93ff4a3 100644 --- a/apps/ui/src/lib/locales/en.json +++ b/apps/ui/src/lib/locales/en.json @@ -163,9 +163,9 @@ }, "deployment_queued": "Deployment queued.", "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.", - "rebuild_application": "Rebuild application", + "rebuild_application": "Rebuild Application", "permission_denied_rebuild_application": "You do not have permission to rebuild application.", "build_and_start_application": "Deploy", "permission_denied_build_and_start_application": "You do not have permission to deploy application.", diff --git a/apps/ui/src/routes/applications/[id]/__layout.svelte b/apps/ui/src/routes/applications/[id]/__layout.svelte index 3ec7107b7..e930df1ed 100644 --- a/apps/ui/src/routes/applications/[id]/__layout.svelte +++ b/apps/ui/src/routes/applications/[id]/__layout.svelte @@ -264,7 +264,7 @@ class="icons bg-transparent tooltip tooltip-primary tooltip-bottom text-sm flex items-center space-x-2" data-tip={$appSession.isAdmin ? isQueueActive - ? 'Rebuild application' + ? 'Rebuild Application' : 'Autoupdate inprogress. Cannot rebuild application.' : 'You do not have permission to rebuild application.'} > diff --git a/apps/ui/src/routes/applications/index.svelte b/apps/ui/src/routes/applications/index.svelte index 216adf6b5..6dbb09ee4 100644 --- a/apps/ui/src/routes/applications/index.svelte +++ b/apps/ui/src/routes/applications/index.svelte @@ -87,6 +87,9 @@ {#if application.fqdn}
{getDomain(application.fqdn) || ''}
{/if} + {#if application.settings.isBot} +
BOT
+ {/if} {#if application.destinationDocker?.name}
{application.destinationDocker.name}
{/if}