Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: autoUpdater & cleanupStorage jobs

Andras Bacsai028f883499a5
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index ed862a59e3..18864dd6eb 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 148764351e..b120dcea13 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 4060dcc8a4..6e93ff4a32 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 3ec7107b77..e930df1ed8 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 216adf6b54..6dbb09ee4f 100644
--- a/apps/ui/src/routes/applications/index.svelte
+++ b/apps/ui/src/routes/applications/index.svelte
@@ -87,6 +87,9 @@
{#if application.fqdn}
<div class="truncate text-center">{getDomain(application.fqdn) || ''}</div>
{/if}
+ {#if application.settings.isBot}
+ <div class="truncate text-center">BOT</div>
+ {/if}
{#if application.destinationDocker?.name}
<div class="truncate text-center">{application.destinationDocker.name}</div>
{/if}