fix: do not run cleanup and build parallel
fix: UI error toasts
This commit is contained in:
@@ -106,23 +106,30 @@ fastify.listen({ port, host }, async (err: any, address: any) => {
|
|||||||
await scheduler.start('cleanupStorage');
|
await scheduler.start('cleanupStorage');
|
||||||
await scheduler.start('checkProxies')
|
await scheduler.start('checkProxies')
|
||||||
|
|
||||||
// Check if no build is running, try to autoupdate.
|
// Check if no build is running
|
||||||
|
|
||||||
|
// Check for update
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
|
const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
|
||||||
if (isAutoUpdateEnabled) {
|
if (isAutoUpdateEnabled) {
|
||||||
if (scheduler.workers.has('deployApplication')) {
|
if (scheduler.workers.has('deployApplication')) {
|
||||||
scheduler.workers.get('deployApplication').postMessage("status");
|
scheduler.workers.get('deployApplication').postMessage("status:autoUpdater");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 30000 * 10)
|
}, 60000 * 15)
|
||||||
|
|
||||||
|
// Cleanup storage
|
||||||
|
setInterval(async () => {
|
||||||
|
if (scheduler.workers.has('deployApplication')) {
|
||||||
|
scheduler.workers.get('deployApplication').postMessage("status:cleanupStorage");
|
||||||
|
}
|
||||||
|
}, 60000 * 10)
|
||||||
|
|
||||||
scheduler.on('worker deleted', async (name) => {
|
scheduler.on('worker deleted', async (name) => {
|
||||||
if (name === 'autoUpdater') {
|
if (name === 'autoUpdater' || name === 'cleanupStorage') {
|
||||||
await scheduler.start('deployApplication');
|
if (!scheduler.workers.has('deployApplication')) await scheduler.start('deployApplication');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function initServer() {
|
async function initServer() {
|
||||||
|
@@ -4,7 +4,7 @@ import fs from 'fs/promises';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
|
|
||||||
import { copyBaseConfigurationFiles, makeLabelForStandaloneApplication, saveBuildLog, setDefaultConfiguration } from '../lib/buildPacks/common';
|
import { copyBaseConfigurationFiles, makeLabelForStandaloneApplication, saveBuildLog, setDefaultConfiguration } from '../lib/buildPacks/common';
|
||||||
import { asyncExecShell, createDirectories, decrypt, getDomain, prisma } from '../lib/common';
|
import { asyncExecShell, createDirectories, decrypt, getDomain, prisma } from '../lib/common';
|
||||||
import { dockerInstance, getEngine } from '../lib/docker';
|
import { dockerInstance, getEngine } from '../lib/docker';
|
||||||
import * as importers from '../lib/importers';
|
import * as importers from '../lib/importers';
|
||||||
import * as buildpacks from '../lib/buildPacks';
|
import * as buildpacks from '../lib/buildPacks';
|
||||||
@@ -21,8 +21,12 @@ import * as buildpacks from '../lib/buildPacks';
|
|||||||
parentPort.postMessage('cancelled');
|
parentPort.postMessage('cancelled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (message === 'status') {
|
if (message === 'status:autoUpdater') {
|
||||||
parentPort.postMessage({ size: queue.size, pending: queue.pending });
|
parentPort.postMessage({ size: queue.size, pending: queue.pending, caller: 'autoUpdater' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (message === 'status:cleanupStorage') {
|
||||||
|
parentPort.postMessage({ size: queue.size, pending: queue.pending, caller: 'cleanupStorage' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,11 +11,20 @@ const options: any = {
|
|||||||
logger: false,
|
logger: false,
|
||||||
workerMessageHandler: async ({ name, message }) => {
|
workerMessageHandler: async ({ name, message }) => {
|
||||||
if (name === 'deployApplication') {
|
if (name === 'deployApplication') {
|
||||||
if (message.pending === 0) {
|
if (message.pending === 0 && message.size === 0) {
|
||||||
if (!scheduler.workers.has('autoUpdater')) {
|
if (message.caller === 'autoUpdater') {
|
||||||
await scheduler.stop('deployApplication');
|
if (!scheduler.workers.has('autoUpdater')) {
|
||||||
await scheduler.run('autoUpdater')
|
await scheduler.stop('deployApplication');
|
||||||
|
await scheduler.run('autoUpdater')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (message.caller === 'cleanupStorage') {
|
||||||
|
if (!scheduler.workers.has('cleanupStorage')) {
|
||||||
|
await scheduler.stop('deployApplication');
|
||||||
|
await scheduler.run('cleanupStorage')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -25,7 +34,6 @@ const options: any = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cleanupStorage',
|
name: 'cleanupStorage',
|
||||||
interval: '10m'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'checkProxies',
|
name: 'checkProxies',
|
||||||
|
@@ -4,6 +4,10 @@ export const asyncSleep = (delay: number) =>
|
|||||||
|
|
||||||
export function errorNotification(error: any): void {
|
export function errorNotification(error: any): void {
|
||||||
if (error.message) {
|
if (error.message) {
|
||||||
|
if (error.message === 'Cannot read properties of undefined (reading \'postMessage\')') {
|
||||||
|
toast.push('Currently there is background process in progress. Please try again later.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
toast.push(error.message);
|
toast.push(error.message);
|
||||||
} else {
|
} else {
|
||||||
toast.push('Ooops, something is not okay, are you okay?');
|
toast.push('Ooops, something is not okay, are you okay?');
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
if (newStorage) toast.push($t('application.storage.storage_saved'));
|
if (newStorage) toast.push($t('application.storage.storage_saved'));
|
||||||
else toast.push($t('application.storage.storage_updated'));
|
else toast.push($t('application.storage.storage_updated'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
await del(`/applications/${id}/storages`, { path: storage.path });
|
await del(`/applications/${id}/storages`, { path: storage.path });
|
||||||
dispatch('refresh');
|
dispatch('refresh');
|
||||||
toast.push($t('application.storage.storage_deleted'));
|
toast.push($t('application.storage.storage_deleted'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -110,7 +110,7 @@
|
|||||||
loading = true;
|
loading = true;
|
||||||
await post(`/applications/${id}/stop`, {});
|
await post(`/applications/${id}/stop`, {});
|
||||||
return window.location.reload();
|
return window.location.reload();
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,6 +118,7 @@
|
|||||||
if ($status.application.loading) return;
|
if ($status.application.loading) return;
|
||||||
$status.application.loading = true;
|
$status.application.loading = true;
|
||||||
const data = await get(`/applications/${id}`);
|
const data = await get(`/applications/${id}`);
|
||||||
|
isQueueActive = data.isQueueActive;
|
||||||
$status.application.isRunning = data.isRunning;
|
$status.application.isRunning = data.isRunning;
|
||||||
$status.application.isExited = data.isExited;
|
$status.application.isExited = data.isExited;
|
||||||
$status.application.loading = false;
|
$status.application.loading = false;
|
||||||
|
@@ -109,7 +109,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
showSave = true;
|
showSave = true;
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
showSave = false;
|
showSave = false;
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
return await goto(`${to}?from=${from}`);
|
return await goto(`${to}?from=${from}`);
|
||||||
}
|
}
|
||||||
return await goto(from || `/applications/${id}/configuration/destination`);
|
return await goto(from || `/applications/${id}/configuration/destination`);
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -203,7 +203,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
showSave = true;
|
showSave = true;
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -51,7 +51,7 @@
|
|||||||
try {
|
try {
|
||||||
await post(`/applications/${id}/configuration/destination`, { destinationId });
|
await post(`/applications/${id}/configuration/destination`, { destinationId });
|
||||||
return await goto(from || `/applications/${id}/configuration/buildpack`);
|
return await goto(from || `/applications/${id}/configuration/buildpack`);
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -199,7 +199,7 @@
|
|||||||
toast.push('DNS configuration is valid.');
|
toast.push('DNS configuration is valid.');
|
||||||
isWWW ? (isWWWDomainOK = true) : (isNonWWWDomainOK = true);
|
isWWW ? (isWWWDomainOK = true) : (isNonWWWDomainOK = true);
|
||||||
return true;
|
return true;
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
errorNotification(error);
|
errorNotification(error);
|
||||||
isWWW ? (isWWWDomainOK = false) : (isNonWWWDomainOK = false);
|
isWWW ? (isWWWDomainOK = false) : (isNonWWWDomainOK = false);
|
||||||
return false;
|
return false;
|
||||||
|
@@ -68,7 +68,7 @@
|
|||||||
const data = await get(`/applications/${id}/logs/build?skip=${skip}`);
|
const data = await get(`/applications/${id}/logs/build?skip=${skip}`);
|
||||||
builds = builds.concat(data.builds);
|
builds = builds.concat(data.builds);
|
||||||
return;
|
return;
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -73,7 +73,7 @@
|
|||||||
try {
|
try {
|
||||||
await del(`/databases/${database.id}`, { id: database.id });
|
await del(`/databases/${database.id}`, { id: database.id });
|
||||||
return await goto('/databases');
|
return await goto('/databases');
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
try {
|
try {
|
||||||
await post(`/databases/${database.id}/stop`, {});
|
await post(`/databases/${database.id}/stop`, {});
|
||||||
return window.location.reload();
|
return window.location.reload();
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
try {
|
try {
|
||||||
await post(`/databases/${database.id}/start`, {});
|
await post(`/databases/${database.id}/start`, {});
|
||||||
return window.location.reload();
|
return window.location.reload();
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -77,7 +77,7 @@
|
|||||||
} else {
|
} else {
|
||||||
await startProxy();
|
await startProxy();
|
||||||
}
|
}
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
loadingProxy = false;
|
loadingProxy = false;
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
try {
|
try {
|
||||||
await post(`/destinations/${id}/stop`, { engine: destination.engine });
|
await post(`/destinations/${id}/stop`, { engine: destination.engine });
|
||||||
return toast.push($t('destination.coolify_proxy_stopped'));
|
return toast.push($t('destination.coolify_proxy_stopped'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
try {
|
try {
|
||||||
await post(`/destinations/${id}/start`, { engine: destination.engine });
|
await post(`/destinations/${id}/start`, { engine: destination.engine });
|
||||||
return toast.push($t('destination.coolify_proxy_started'));
|
return toast.push($t('destination.coolify_proxy_started'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
engine: destination.engine,
|
engine: destination.engine,
|
||||||
fqdn: settings.fqdn
|
fqdn: settings.fqdn
|
||||||
});
|
});
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
@@ -82,7 +82,7 @@ import { appSession } from '$lib/store';
|
|||||||
} else {
|
} else {
|
||||||
await startProxy();
|
await startProxy();
|
||||||
}
|
}
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ import { appSession } from '$lib/store';
|
|||||||
const engine = generateRemoteEngine(destination);
|
const engine = generateRemoteEngine(destination);
|
||||||
await post(`/destinations/${id}/stop.json`, { engine });
|
await post(`/destinations/${id}/stop.json`, { engine });
|
||||||
return toast.push($t('destination.coolify_proxy_stopped'));
|
return toast.push($t('destination.coolify_proxy_stopped'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ import { appSession } from '$lib/store';
|
|||||||
const engine = generateRemoteEngine(destination);
|
const engine = generateRemoteEngine(destination);
|
||||||
await post(`/destinations/${id}/start.json`, { engine });
|
await post(`/destinations/${id}/start.json`, { engine });
|
||||||
return toast.push($t('destination.coolify_proxy_started'));
|
return toast.push($t('destination.coolify_proxy_started'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ import { appSession } from '$lib/store';
|
|||||||
engine: destination.engine,
|
engine: destination.engine,
|
||||||
fqdn: settings.fqdn
|
fqdn: settings.fqdn
|
||||||
});
|
});
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
ownMysql
|
ownMysql
|
||||||
});
|
});
|
||||||
service.wordpress.ownMysql = ownMysql;
|
service.wordpress.ownMysql = ownMysql;
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
if (newStorage) toast.push('Storage saved.');
|
if (newStorage) toast.push('Storage saved.');
|
||||||
else toast.push('Storage updated.');
|
else toast.push('Storage updated.');
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
await del(`/services/${id}/storages`, { path: storage.path });
|
await del(`/services/${id}/storages`, { path: storage.path });
|
||||||
dispatch('refresh');
|
dispatch('refresh');
|
||||||
toast.push('Storage deleted.');
|
toast.push('Storage deleted.');
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@
|
|||||||
isDNSCheckEnabled
|
isDNSCheckEnabled
|
||||||
});
|
});
|
||||||
return toast.push(t.get('application.settings_saved'));
|
return toast.push(t.get('application.settings_saved'));
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
toast.push('DNS configuration is valid.');
|
toast.push('DNS configuration is valid.');
|
||||||
isWWW ? (isWWWDomainOK = true) : (isNonWWWDomainOK = true);
|
isWWW ? (isWWWDomainOK = true) : (isNonWWWDomainOK = true);
|
||||||
return true;
|
return true;
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
errorNotification(error);
|
errorNotification(error);
|
||||||
isWWW ? (isWWWDomainOK = false) : (isNonWWWDomainOK = false);
|
isWWW ? (isWWWDomainOK = false) : (isNonWWWDomainOK = false);
|
||||||
return false;
|
return false;
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
const data = await get(`/settings`);
|
const data = await get(`/settings`);
|
||||||
$isTraefikUsed = data.settings.isTraefikUsed;
|
$isTraefikUsed = data.settings.isTraefikUsed;
|
||||||
return toast.push('Proxy migration started, it takes a few seconds.');
|
return toast.push('Proxy migration started, it takes a few seconds.');
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
loading.proxyMigration = false;
|
loading.proxyMigration = false;
|
||||||
|
@@ -106,7 +106,7 @@
|
|||||||
await post(`/sources/${id}/check`, {
|
await post(`/sources/${id}/check`, {
|
||||||
oauthId: source.gitlabApp?.oauthId
|
oauthId: source.gitlabApp?.oauthId
|
||||||
});
|
});
|
||||||
} catch ({ error }) {
|
} catch (error) {
|
||||||
source.gitlabApp.oauthId = null;
|
source.gitlabApp.oauthId = null;
|
||||||
oauthIdEl.focus();
|
oauthIdEl.focus();
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
|
Reference in New Issue
Block a user