mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-18 20:59:24 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bd8ac5820 | ||
|
|
f514aa676d | ||
|
|
73fc9755dd | ||
|
|
5089c843b6 | ||
|
|
cd527f2bce | ||
|
|
82de234f21 | ||
|
|
ae6f325c0a |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "coolify",
|
"name": "coolify",
|
||||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||||
"version": "2.0.0",
|
"version": "2.0.3",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
|
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ if (dev) {
|
|||||||
export const prisma = new PrismaClient(prismaOptions);
|
export const prisma = new PrismaClient(prismaOptions);
|
||||||
|
|
||||||
export function PrismaErrorHandler(e) {
|
export function PrismaErrorHandler(e) {
|
||||||
|
if (e! instanceof Error) {
|
||||||
|
e = new Error(e.toString());
|
||||||
|
}
|
||||||
sentry.captureException(e);
|
sentry.captureException(e);
|
||||||
const payload = {
|
const payload = {
|
||||||
status: e.status || 500,
|
status: e.status || 500,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
|
import fs from 'fs/promises';
|
||||||
import * as buildpacks from '../buildPacks';
|
import * as buildpacks from '../buildPacks';
|
||||||
import * as importers from '../importers';
|
import * as importers from '../importers';
|
||||||
import { dockerInstance } from '../docker';
|
import { dockerInstance } from '../docker';
|
||||||
@@ -208,10 +209,11 @@ export default async function (job) {
|
|||||||
if (secrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
secrets.forEach((secret) => {
|
secrets.forEach((secret) => {
|
||||||
if (!secret.isBuildSecret) {
|
if (!secret.isBuildSecret) {
|
||||||
envs.push(`--env ${secret.name}=${secret.value}`);
|
envs.push(`${secret.name}=${secret.value}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
await fs.writeFile(`${workdir}/.env`, envs.join('\n'));
|
||||||
const labels = makeLabelForStandaloneApplication({
|
const labels = makeLabelForStandaloneApplication({
|
||||||
applicationId,
|
applicationId,
|
||||||
fqdn,
|
fqdn,
|
||||||
@@ -230,14 +232,20 @@ export default async function (job) {
|
|||||||
baseDirectory,
|
baseDirectory,
|
||||||
publishDirectory
|
publishDirectory
|
||||||
});
|
});
|
||||||
saveBuildLog({ line: 'Deployment started.', buildId, applicationId });
|
try {
|
||||||
const { stderr } = await asyncExecShell(
|
saveBuildLog({ line: 'Deployment started.', buildId, applicationId });
|
||||||
`DOCKER_HOST=${host} docker run ${envs.join()} ${labels.join(
|
const { stderr } = await asyncExecShell(
|
||||||
' '
|
`DOCKER_HOST=${host} docker run --env-file=${workdir}/.env ${labels.join(
|
||||||
)} --name ${imageId} --network ${docker.network} --restart always -d ${applicationId}:${tag}`
|
' '
|
||||||
);
|
)} --name ${imageId} --network ${
|
||||||
if (stderr) console.log(stderr);
|
docker.network
|
||||||
saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });
|
} --restart always -d ${applicationId}:${tag}`
|
||||||
|
);
|
||||||
|
if (stderr) console.log(stderr);
|
||||||
|
saveBuildLog({ line: 'Deployment successful!', buildId, applicationId });
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
|
||||||
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
saveBuildLog({ line: 'Proxy configuration started!', buildId, applicationId });
|
saveBuildLog({ line: 'Proxy configuration started!', buildId, applicationId });
|
||||||
|
|||||||
@@ -120,7 +120,11 @@ buildWorker.on('completed', async (job: Bullmq.Job) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
} finally {
|
} finally {
|
||||||
await asyncExecShell(`rm -fr ${job.data.workdir}`);
|
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
|
||||||
|
await asyncExecShell(`rm -fr ${workdir}`);
|
||||||
|
await asyncExecShell(
|
||||||
|
`test -f /tmp/build-sources/${job.data.repository}/id.rsa && rm /tmp/build-sources/${job.data.repository}/id.rsa`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
@@ -132,7 +136,11 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
await asyncExecShell(`rm -fr ${job.data.workdir}`);
|
const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`;
|
||||||
|
await asyncExecShell(`rm -fr ${workdir}`);
|
||||||
|
await asyncExecShell(
|
||||||
|
`test -f /tmp/build-sources/${job.data.repository}/id.rsa && rm /tmp/build-sources/${job.data.repository}/id.rsa`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
saveBuildLog({ line: 'Failed build!', buildId: job.data.build_id, applicationId: job.data.id });
|
saveBuildLog({ line: 'Failed build!', buildId: job.data.build_id, applicationId: job.data.id });
|
||||||
saveBuildLog({
|
saveBuildLog({
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ export const get: RequestHandler = async (event) => {
|
|||||||
where: { buildId, time: { gt: sequence } },
|
where: { buildId, time: { gt: sequence } },
|
||||||
orderBy: { time: 'asc' }
|
orderBy: { time: 'asc' }
|
||||||
});
|
});
|
||||||
const { status } = await db.prisma.build.findFirst({ where: { id: buildId } });
|
const data = await db.prisma.build.findFirst({ where: { id: buildId } });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
body: {
|
body: {
|
||||||
logs,
|
logs,
|
||||||
status
|
status: data?.status || 'running'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user