fixes
This commit is contained in:
parent
1a28e65e50
commit
943a05edcc
@ -121,7 +121,6 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
port: exposePort ? `${exposePort}:${port}` : port,
|
||||
});
|
||||
try {
|
||||
await saveBuildLog({ line: 'Deployment initiated', buildId, applicationId });
|
||||
const composeVolumes = volumes.map((volume) => {
|
||||
return {
|
||||
[`${volume.split(':')[0]}`]: {
|
||||
@ -156,7 +155,7 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
};
|
||||
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
||||
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
||||
await saveBuildLog({ line: 'Deployed successfully 🎉', buildId, applicationId });
|
||||
await saveBuildLog({ line: 'Deployed successfully', buildId, applicationId });
|
||||
} catch (error) {
|
||||
await saveBuildLog({ line: error, buildId, applicationId });
|
||||
const foundBuild = await prisma.build.findUnique({ where: { id: buildId } })
|
||||
@ -185,6 +184,9 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
if (error !== 1) {
|
||||
await saveBuildLog({ line: error, buildId, applicationId: application.id });
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
await saveBuildLog({ line: error.message, buildId, applicationId: application.id });
|
||||
}
|
||||
if (!isDev) {
|
||||
await fs.rm(workdir, { recursive: true, force: true });
|
||||
}
|
||||
@ -196,7 +198,7 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
const imageName = application.dockerRegistryImageName.split(':')[0];
|
||||
await saveBuildLog({ line: `Pushing ${imageName}:${customTag} to Docker Registry... It could take a while...`, buildId, applicationId: application.id });
|
||||
await pushToRegistry(application, workdir, buildId, imageName, customTag)
|
||||
await saveBuildLog({ line: "Success 🎉", buildId, applicationId: application.id });
|
||||
await saveBuildLog({ line: "Success", buildId, applicationId: application.id });
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.stdout) {
|
||||
@ -310,6 +312,13 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
)
|
||||
.digest('hex');
|
||||
const { debug } = settings;
|
||||
if (!debug) {
|
||||
await saveBuildLog({
|
||||
line: `Debug logging is disabled. Enable it above if necessary!`,
|
||||
buildId,
|
||||
applicationId
|
||||
});
|
||||
}
|
||||
const volumes =
|
||||
persistentStorage?.map((storage) => {
|
||||
if (storage.oldPath) {
|
||||
@ -370,12 +379,17 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
if (pullmergeRequestId) {
|
||||
tag = `${commit.slice(0, 7)}-${pullmergeRequestId}`;
|
||||
}
|
||||
if (application.dockerRegistryImageName) {
|
||||
imageName = application.dockerRegistryImageName.split(':')[0]
|
||||
customTag = application.dockerRegistryImageName.split(':')[1] || tag
|
||||
} else {
|
||||
customTag = tag
|
||||
imageName = applicationId;
|
||||
}
|
||||
|
||||
customTag = application.dockerRegistryImageName.split(':')[1] || tag;
|
||||
if (pullmergeRequestId) {
|
||||
customTag = `${customTag}-${pullmergeRequestId}`;
|
||||
}
|
||||
imageName = application.dockerRegistryImageName.split(':')[0];
|
||||
|
||||
try {
|
||||
await prisma.build.update({ where: { id: buildId }, data: { commit } });
|
||||
@ -403,9 +417,10 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
|
||||
const { url, username, password } = dockerRegistry
|
||||
location = await saveDockerRegistryCredentials({ url, username, password, workdir })
|
||||
if (dockerRegistry) {
|
||||
const { url, username, password } = dockerRegistry
|
||||
location = await saveDockerRegistryCredentials({ url, username, password, workdir })
|
||||
}
|
||||
|
||||
try {
|
||||
await executeDockerCmd({
|
||||
@ -512,7 +527,7 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
}
|
||||
try {
|
||||
await executeDockerCmd({ debug, buildId, applicationId, dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
||||
await saveBuildLog({ line: 'Deployed successfully 🎉', buildId, applicationId });
|
||||
await saveBuildLog({ line: 'Deployed successfully', buildId, applicationId });
|
||||
await prisma.build.update({ where: { id: buildId }, data: { status: 'success' } });
|
||||
await prisma.application.update({
|
||||
where: { id: applicationId },
|
||||
@ -565,9 +580,10 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
});
|
||||
}
|
||||
await fs.writeFile(`${workdir}/.env`, envs.join('\n'));
|
||||
|
||||
const { url, username, password } = dockerRegistry
|
||||
await saveDockerRegistryCredentials({ url, username, password, workdir })
|
||||
if (dockerRegistry) {
|
||||
const { url, username, password } = dockerRegistry
|
||||
await saveDockerRegistryCredentials({ url, username, password, workdir })
|
||||
}
|
||||
|
||||
let envFound = false;
|
||||
try {
|
||||
@ -576,7 +592,6 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
//
|
||||
}
|
||||
try {
|
||||
await saveBuildLog({ line: 'Deployment initiated', buildId, applicationId });
|
||||
const composeVolumes = volumes.map((volume) => {
|
||||
return {
|
||||
[`${volume.split(':')[0]}`]: {
|
||||
@ -608,7 +623,7 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
};
|
||||
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
|
||||
await executeDockerCmd({ dockerId: destinationDocker.id, command: `docker compose --project-directory ${workdir} up -d` })
|
||||
await saveBuildLog({ line: 'Deployed successfully 🎉', buildId, applicationId });
|
||||
await saveBuildLog({ line: 'Deployed successfully', buildId, applicationId });
|
||||
} catch (error) {
|
||||
await saveBuildLog({ line: error, buildId, applicationId });
|
||||
const foundBuild = await prisma.build.findUnique({ where: { id: buildId } })
|
||||
@ -642,6 +657,9 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
if (error !== 1) {
|
||||
await saveBuildLog({ line: error, buildId, applicationId: application.id });
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
await saveBuildLog({ line: error.message, buildId, applicationId: application.id });
|
||||
}
|
||||
if (!isDev) {
|
||||
await fs.rm(workdir, { recursive: true, force: true });
|
||||
}
|
||||
@ -651,7 +669,7 @@ import * as buildpacks from '../lib/buildPacks';
|
||||
if (application.dockerRegistryImageName && (!imageFoundRemotely || forceRebuild)) {
|
||||
await saveBuildLog({ line: `Pushing ${imageName}:${customTag} to Docker Registry... It could take a while...`, buildId, applicationId: application.id });
|
||||
await pushToRegistry(application, workdir, tag, imageName, customTag)
|
||||
await saveBuildLog({ line: "Success 🎉", buildId, applicationId: application.id });
|
||||
await saveBuildLog({ line: "Success", buildId, applicationId: application.id });
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.stdout) {
|
||||
|
@ -641,16 +641,9 @@ export async function buildImage({
|
||||
commit
|
||||
}) {
|
||||
if (isCache) {
|
||||
await saveBuildLog({ line: `Building cache image`, buildId, applicationId });
|
||||
await saveBuildLog({ line: `Building cache image...`, buildId, applicationId });
|
||||
} else {
|
||||
await saveBuildLog({ line: `Building production image`, buildId, applicationId });
|
||||
}
|
||||
if (!debug) {
|
||||
await saveBuildLog({
|
||||
line: `Debug logging is disabled. Enable it above if necessary!`,
|
||||
buildId,
|
||||
applicationId
|
||||
});
|
||||
await saveBuildLog({ line: `Building production image...`, buildId, applicationId });
|
||||
}
|
||||
const dockerFile = isCache ? `${dockerFileLocation}-cache` : `${dockerFileLocation}`
|
||||
const cache = `${applicationId}:${tag}${isCache ? '-cache' : ''}`
|
||||
@ -670,9 +663,9 @@ export async function buildImage({
|
||||
throw new Error('Canceled.')
|
||||
}
|
||||
if (isCache) {
|
||||
await saveBuildLog({ line: `Building cache image built successful 🎉`, buildId, applicationId });
|
||||
await saveBuildLog({ line: `Built successfully`, buildId, applicationId });
|
||||
} else {
|
||||
await saveBuildLog({ line: `Building production image built successful 🎉`, buildId, applicationId });
|
||||
await saveBuildLog({ line: `Built successfully`, buildId, applicationId });
|
||||
}
|
||||
}
|
||||
export function makeLabelForSimpleDockerfile({ applicationId, port, type }) {
|
||||
|
@ -480,9 +480,7 @@ export async function restartApplication(request: FastifyRequest<RestartApplicat
|
||||
});
|
||||
}
|
||||
const { workdir } = await createDirectories({ repository, buildId });
|
||||
const labels = [
|
||||
`coolify.managed=true`,
|
||||
]
|
||||
const labels = []
|
||||
let image = null
|
||||
if (imageId) {
|
||||
image = imageId
|
||||
@ -499,8 +497,11 @@ export async function restartApplication(request: FastifyRequest<RestartApplicat
|
||||
})
|
||||
}
|
||||
}
|
||||
const { url, username, password } = dockerRegistry
|
||||
location = await saveDockerRegistryCredentials({ url, username, password, workdir })
|
||||
if (dockerRegistry) {
|
||||
const { url, username, password } = dockerRegistry
|
||||
location = await saveDockerRegistryCredentials({ url, username, password, workdir })
|
||||
}
|
||||
|
||||
let imageFoundLocally = false;
|
||||
try {
|
||||
await executeDockerCmd({
|
||||
|
@ -62,10 +62,10 @@ export function checkIfDeploymentEnabledApplications(isAdmin: boolean, applicati
|
||||
(application.buildPack === 'compose') ||
|
||||
(application.fqdn || application.settings.isBot) &&
|
||||
((application.gitSource &&
|
||||
application.repository &&
|
||||
application.buildPack) || application.simpleDockerfile) &&
|
||||
application.repository &&
|
||||
application.buildPack) || application.simpleDockerfile) &&
|
||||
application.destinationDocker
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
export function checkIfDeploymentEnabledServices(isAdmin: boolean, service: any) {
|
||||
@ -82,6 +82,7 @@ export const status: Writable<any> = writable({
|
||||
statuses: [],
|
||||
overallStatus: 'stopped',
|
||||
loading: false,
|
||||
restarting: false,
|
||||
initialLoading: true
|
||||
},
|
||||
service: {
|
||||
|
@ -167,7 +167,7 @@
|
||||
}
|
||||
}
|
||||
async function getStatus() {
|
||||
if ($status.application.loading && stopping) return;
|
||||
if (($status.application.loading && stopping) || $status.application.restarting === true) return;
|
||||
$status.application.loading = true;
|
||||
const data = await get(`/applications/${id}/status`);
|
||||
|
||||
@ -185,26 +185,6 @@
|
||||
if ($status.application.statuses.length === 0) {
|
||||
$status.application.overallStatus = 'stopped';
|
||||
} else {
|
||||
// if ($status.application.statuses.length !== numberOfApplications) {
|
||||
// $status.application.overallStatus = 'degraded';
|
||||
// } else {
|
||||
// for (const oneStatus of $status.application.statuses) {
|
||||
// if (oneStatus.status.isExited || oneStatus.status.isRestarting) {
|
||||
// $status.application.overallStatus = 'degraded';
|
||||
// break;
|
||||
// }
|
||||
// if (oneStatus.status.isRunning) {
|
||||
// $status.application.overallStatus = 'healthy';
|
||||
// }
|
||||
// if (
|
||||
// !oneStatus.status.isExited &&
|
||||
// !oneStatus.status.isRestarting &&
|
||||
// !oneStatus.status.isRunning
|
||||
// ) {
|
||||
// $status.application.overallStatus = 'stopped';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (const oneStatus of $status.application.statuses) {
|
||||
if (oneStatus.status.isExited || oneStatus.status.isRestarting) {
|
||||
$status.application.overallStatus = 'degraded';
|
||||
|
@ -53,13 +53,11 @@
|
||||
import { saveForm } from './utils';
|
||||
|
||||
const { id } = $page.params;
|
||||
|
||||
$: isDisabled =
|
||||
!$appSession.isAdmin ||
|
||||
$status.application.overallStatus === 'degraded' ||
|
||||
$status.application.overallStatus === 'healthy' ||
|
||||
$status.application.initialLoading;
|
||||
|
||||
$isDeploymentEnabled = checkIfDeploymentEnabledApplications($appSession.isAdmin, application);
|
||||
let statues: any = {};
|
||||
let loading = {
|
||||
@ -274,12 +272,13 @@
|
||||
$isDeploymentEnabled = checkIfDeploymentEnabledApplications($appSession.isAdmin, application);
|
||||
|
||||
forceSave = false;
|
||||
|
||||
toast &&
|
||||
if (toast) {
|
||||
addToast({
|
||||
message: 'Configuration saved.',
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
if (application.fqdn && application.fqdn.startsWith('https')) {
|
||||
isHttps = true;
|
||||
} else {
|
||||
@ -514,7 +513,6 @@
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<label for="repository">Git commit</label>
|
||||
<div class="flex gap-2">
|
||||
@ -601,7 +599,7 @@
|
||||
name="dockerRegistryImageName"
|
||||
id="dockerRegistryImageName"
|
||||
readonly={isDisabled}
|
||||
disabled={isDisabled}
|
||||
disabled={isDisabled}
|
||||
class="w-full"
|
||||
placeholder="e.g. coollabsio/myimage (tag will be commit sha) or coollabsio/myimage:tag"
|
||||
bind:value={application.dockerRegistryImageName}
|
||||
|
@ -57,6 +57,7 @@
|
||||
try {
|
||||
$status.application.initialLoading = true;
|
||||
$status.application.loading = true;
|
||||
$status.application.restarting = true;
|
||||
await post(`/applications/${id}/restart`, { imageId: remoteImage });
|
||||
addToast({
|
||||
type: 'success',
|
||||
@ -67,6 +68,7 @@
|
||||
} finally {
|
||||
$status.application.initialLoading = false;
|
||||
$status.application.loading = false;
|
||||
$status.application.restarting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user