fixes
This commit is contained in:
5
TODO.md
5
TODO.md
@@ -1,3 +1,6 @@
|
|||||||
- RDE Application DNS check not working
|
- RDE Application DNS check not working
|
||||||
- Check DNS configurations for app/service/coolify with RDE and local engines
|
- Check DNS configurations for app/service/coolify with RDE and local engines
|
||||||
- Refactor PR deployments (/apps/api/src/routes/api/v1/applications/handlers.ts#L744) and create previews model inside coolify db?
|
|
||||||
|
|
||||||
|
# Low
|
||||||
|
- Create previews model in Coolify DB
|
@@ -1,4 +1,18 @@
|
|||||||
import { executeDockerCmd } from './common';
|
import { executeDockerCmd } from './common';
|
||||||
|
|
||||||
|
export function formatLabelsOnDocker(data) {
|
||||||
|
return data.trim().split('\n').map(a => JSON.parse(a)).map((container) => {
|
||||||
|
const labels = container.Labels.split(',')
|
||||||
|
let jsonLabels = {}
|
||||||
|
labels.forEach(l => {
|
||||||
|
const name = l.split('=')[0]
|
||||||
|
const value = l.split('=')[1]
|
||||||
|
jsonLabels = { ...jsonLabels, ...{ [name]: value } }
|
||||||
|
})
|
||||||
|
container.Labels = jsonLabels;
|
||||||
|
return container
|
||||||
|
})
|
||||||
|
}
|
||||||
export async function checkContainer({ dockerId, container, remove = false }: { dockerId: string, container: string, remove?: boolean }): Promise<boolean> {
|
export async function checkContainer({ dockerId, container, remove = false }: { dockerId: string, container: string, remove?: boolean }): Promise<boolean> {
|
||||||
let containerFound = false;
|
let containerFound = false;
|
||||||
try {
|
try {
|
||||||
|
@@ -6,7 +6,7 @@ import { FastifyReply } from 'fastify';
|
|||||||
import { day } from '../../../../lib/dayjs';
|
import { day } from '../../../../lib/dayjs';
|
||||||
import { setDefaultBaseImage, setDefaultConfiguration } from '../../../../lib/buildPacks/common';
|
import { setDefaultBaseImage, setDefaultConfiguration } from '../../../../lib/buildPacks/common';
|
||||||
import { checkDomainsIsValidInDNS, checkDoubleBranch, decrypt, encrypt, errorHandler, executeDockerCmd, generateSshKeyPair, getContainerUsage, getDomain, getFreeExposedPort, isDev, isDomainConfigured, prisma, stopBuild, uniqueName } from '../../../../lib/common';
|
import { checkDomainsIsValidInDNS, checkDoubleBranch, decrypt, encrypt, errorHandler, executeDockerCmd, generateSshKeyPair, getContainerUsage, getDomain, getFreeExposedPort, isDev, isDomainConfigured, prisma, stopBuild, uniqueName } from '../../../../lib/common';
|
||||||
import { checkContainer, isContainerExited, removeContainer } from '../../../../lib/docker';
|
import { checkContainer, formatLabelsOnDocker, isContainerExited, removeContainer } from '../../../../lib/docker';
|
||||||
import { scheduler } from '../../../../lib/scheduler';
|
import { scheduler } from '../../../../lib/scheduler';
|
||||||
|
|
||||||
import type { FastifyRequest } from 'fastify';
|
import type { FastifyRequest } from 'fastify';
|
||||||
@@ -741,22 +741,8 @@ export async function getPreviews(request: FastifyRequest<OnlyId>) {
|
|||||||
PRMRSecrets: []
|
PRMRSecrets: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const out = stdout.trim().split('\n')
|
const containers = formatLabelsOnDocker(stdout).filter(container => container.Labels['coolify.configuration'] && container.Labels['coolify.type'] === 'standalone-application')
|
||||||
const jsonStdout = out.map(a => JSON.parse(a))
|
|
||||||
const containers = jsonStdout.filter((container) => {
|
|
||||||
const labels = container.Labels.split(',')
|
|
||||||
let jsonLabels = {}
|
|
||||||
labels.forEach(l => {
|
|
||||||
const name = l.split('=')[0]
|
|
||||||
const value = l.split('=')[1]
|
|
||||||
jsonLabels = { ...jsonLabels, ...{ [name]: value } }
|
|
||||||
})
|
|
||||||
container.Labels = jsonLabels;
|
|
||||||
return (
|
|
||||||
jsonLabels['coolify.configuration'] &&
|
|
||||||
jsonLabels['coolify.type'] === 'standalone-application'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const jsonContainers = containers
|
const jsonContainers = containers
|
||||||
.map((container) =>
|
.map((container) =>
|
||||||
JSON.parse(Buffer.from(container.Labels['coolify.configuration'], 'base64').toString())
|
JSON.parse(Buffer.from(container.Labels['coolify.configuration'], 'base64').toString())
|
||||||
|
Reference in New Issue
Block a user