commit
3421de06d5
@ -28,6 +28,10 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
parentPort.postMessage({ size: queue.size, pending: queue.pending, caller: 'cleanupStorage' });
|
||||
return;
|
||||
}
|
||||
if (message === 'action:flushQueue') {
|
||||
queue.clear()
|
||||
return;
|
||||
}
|
||||
|
||||
await queue.add(async () => {
|
||||
const {
|
||||
@ -330,8 +334,8 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
await saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });
|
||||
} catch (error) {
|
||||
await saveBuildLog({ line: error, buildId, applicationId });
|
||||
await prisma.build.update({
|
||||
where: { id: message.build_id },
|
||||
await prisma.build.updateMany({
|
||||
where: { id: message.build_id, status: { in: ['queued', 'running'] } },
|
||||
data: { status: 'failed' }
|
||||
});
|
||||
throw new Error(error);
|
||||
@ -346,8 +350,8 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
await prisma.build.update({
|
||||
where: { id: message.build_id },
|
||||
await prisma.build.updateMany({
|
||||
where: { id: message.build_id, status: { in: ['queued', 'running'] } },
|
||||
data: { status: 'failed' }
|
||||
});
|
||||
await saveBuildLog({ line: error, buildId, applicationId });
|
||||
|
@ -551,6 +551,10 @@ export async function buildImage({
|
||||
const dockerFile = isCache ? `${dockerFileLocation}-cache` : `${dockerFileLocation}`
|
||||
const cache = `${applicationId}:${tag}${isCache ? '-cache' : ''}`
|
||||
await executeDockerCmd({ debug, buildId, applicationId, dockerId, command: `docker build --progress plain -f ${workdir}/${dockerFile} -t ${cache} ${workdir}` })
|
||||
const { status } = await prisma.build.findUnique({ where: { id: buildId } })
|
||||
if (status === 'canceled') {
|
||||
throw new Error('Build canceled.')
|
||||
}
|
||||
if (isCache) {
|
||||
await saveBuildLog({ line: `Building cache image successful.`, buildId, applicationId });
|
||||
} else {
|
||||
|
@ -17,8 +17,9 @@ import { checkContainer, removeContainer } from './docker';
|
||||
import { day } from './dayjs';
|
||||
import * as serviceFields from './serviceFields'
|
||||
import { saveBuildLog } from './buildPacks/common';
|
||||
import { scheduler } from './scheduler';
|
||||
|
||||
export const version = '3.8.0';
|
||||
export const version = '3.8.1';
|
||||
export const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const algorithm = 'aes-256-ctr';
|
||||
@ -1873,12 +1874,16 @@ export async function stopBuild(buildId, applicationId) {
|
||||
const { engine, id: dockerId } = await prisma.destinationDocker.findFirst({ where: { id: destinationDockerId } });
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
if (status === 'failed') {
|
||||
if (status === 'failed' || status === 'canceled') {
|
||||
clearInterval(interval);
|
||||
return resolve();
|
||||
}
|
||||
if (count > 50) {
|
||||
if (count > 15) {
|
||||
clearInterval(interval);
|
||||
if (scheduler.workers.has('deployApplication')) {
|
||||
scheduler.workers.get('deployApplication').postMessage("action:flushQueue")
|
||||
}
|
||||
await cleanupDB(buildId);
|
||||
return reject(new Error('Build canceled'));
|
||||
}
|
||||
const { stdout: buildContainers } = await executeDockerCmd({ dockerId, command: `docker container ls --filter "label=coolify.buildId=${buildId}" --format '{{json .}}'` })
|
||||
@ -1890,14 +1895,16 @@ export async function stopBuild(buildId, applicationId) {
|
||||
if (!containerObj.Names.startsWith(`${applicationId} `)) {
|
||||
await removeContainer({ id, dockerId });
|
||||
clearInterval(interval);
|
||||
if (scheduler.workers.has('deployApplication')) {
|
||||
scheduler.workers.get('deployApplication').postMessage("action:flushQueue")
|
||||
}
|
||||
await cleanupDB(buildId);
|
||||
return resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
} catch (error) { } finally {
|
||||
await cleanupDB(buildId);
|
||||
}
|
||||
} catch (error) { }
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
@ -1905,7 +1912,7 @@ export async function stopBuild(buildId, applicationId) {
|
||||
async function cleanupDB(buildId: string) {
|
||||
const data = await prisma.build.findUnique({ where: { id: buildId } });
|
||||
if (data?.status === 'queued' || data?.status === 'running') {
|
||||
await prisma.build.update({ where: { id: buildId }, data: { status: 'failed' } });
|
||||
await prisma.build.update({ where: { id: buildId }, data: { status: 'canceled' } });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1914,10 +1921,7 @@ export function convertTolOldVolumeNames(type) {
|
||||
return 'nc'
|
||||
}
|
||||
}
|
||||
// export async function getAvailableServices(): Promise<any> {
|
||||
// const { data } = await axios.get(`https://gist.githubusercontent.com/andrasbacsai/4aac36d8d6214dbfc34fa78110554a50/raw/5b27e6c37d78aaeedc1148d797112c827a2f43cf/availableServices.json`)
|
||||
// return data
|
||||
//
|
||||
|
||||
export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) {
|
||||
// Cleanup old coolify images
|
||||
try {
|
||||
|
@ -2,7 +2,8 @@ import Bree from 'bree';
|
||||
import path from 'path';
|
||||
import Cabin from 'cabin';
|
||||
import TSBree from '@breejs/ts-worker';
|
||||
import { isDev } from './common';
|
||||
|
||||
export const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
Bree.extend(TSBree);
|
||||
|
||||
|
@ -146,6 +146,7 @@
|
||||
class="tooltip tooltip-primary tooltip-top flex cursor-pointer items-center justify-center border-l-2 py-4 no-underline transition-all duration-100 hover:bg-coolgray-400 hover:shadow-xl"
|
||||
class:bg-coolgray-400={buildId === build.id}
|
||||
class:border-red-500={build.status === 'failed'}
|
||||
class:border-orange-500={build.status === 'canceled'}
|
||||
class:border-green-500={build.status === 'success'}
|
||||
class:border-yellow-500={build.status === 'running'}
|
||||
>
|
||||
|
@ -194,12 +194,13 @@
|
||||
</div>
|
||||
</a>
|
||||
<div class="flex items-center justify-center">
|
||||
<button class="bg-coollabs hover:bg-coollabs-100" on:click={() => redeploy(container)}
|
||||
<button class="btn btn-sm bg-coollabs hover:bg-coollabs-100" on:click={() => redeploy(container)}
|
||||
>{$t('application.preview.redeploy')}</button
|
||||
>
|
||||
</div>
|
||||
<div class="flex items-center justify-center">
|
||||
<button
|
||||
class="btn btn-sm"
|
||||
class:bg-red-600={!loading.removing}
|
||||
class:hover:bg-red-500={!loading.removing}
|
||||
disabled={loading.removing}
|
||||
|
@ -343,7 +343,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
{:else if $appSession.teamId !== '0'}
|
||||
<div class="text-center text-xl font-bold">Nothing is configured yet.</div>
|
||||
{/if}
|
||||
{#if $appSession.teamId === '0'}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coolify",
|
||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||
"version": "3.8.0",
|
||||
"version": "3.8.1",
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:coollabsio/coolify",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user