Merge pull request #882 from coollabsio/next

v3.12.18
This commit is contained in:
Andras Bacsai
2023-01-24 15:09:51 +01:00
committed by GitHub
424 changed files with 9707 additions and 19 deletions

View File

@@ -172,9 +172,9 @@ const host = '0.0.0.0';
}, 60000 * 15); }, 60000 * 15);
// Cleanup stucked containers (not defined in Coolify, but still running and managed by Coolify) // Cleanup stucked containers (not defined in Coolify, but still running and managed by Coolify)
// setInterval(async () => { setInterval(async () => {
// await cleanupStuckedContainers(); await cleanupStuckedContainers();
// }, 60000 * 5); }, 60000);
// checkProxies, checkFluentBit & refresh templates // checkProxies, checkFluentBit & refresh templates
setInterval(async () => { setInterval(async () => {
@@ -344,9 +344,16 @@ async function cleanupStuckedContainers() {
const containersArray = containers.trim().split('\n'); const containersArray = containers.trim().split('\n');
if (containersArray.length > 0) { if (containersArray.length > 0) {
for (const container of containersArray) { for (const container of containersArray) {
const application = await prisma.application.findFirst({ where: { id: container } }); const containerId = container.split('-')[0];
const service = await prisma.service.findFirst({ where: { id: container } }); const application = await prisma.application.findFirst({
const database = await prisma.database.findFirst({ where: { id: container } }); where: { id: { startsWith: containerId } }
});
const service = await prisma.service.findFirst({
where: { id: { startsWith: containerId } }
});
const database = await prisma.database.findFirst({
where: { id: { startsWith: containerId } }
});
if (!application && !service && !database) { if (!application && !service && !database) {
await executeCommand({ command: `docker container rm -f ${container}` }); await executeCommand({ command: `docker container rm -f ${container}` });
} }

View File

@@ -19,7 +19,7 @@ import { saveBuildLog, saveDockerRegistryCredentials } from './buildPacks/common
import { scheduler } from './scheduler'; import { scheduler } from './scheduler';
import type { ExecaChildProcess } from 'execa'; import type { ExecaChildProcess } from 'execa';
export const version = '3.12.17'; export const version = '3.12.18';
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
export const sentryDSN = export const sentryDSN =
'https://409f09bcb7af47928d3e0f46b78987f3@o1082494.ingest.sentry.io/4504236622217216'; 'https://409f09bcb7af47928d3e0f46b78987f3@o1082494.ingest.sentry.io/4504236622217216';

View File

@@ -2,6 +2,7 @@ import { FastifyRequest } from 'fastify';
import { errorHandler, getDomain, isDev, prisma, executeCommand } from '../../../lib/common'; import { errorHandler, getDomain, isDev, prisma, executeCommand } from '../../../lib/common';
import { getTemplates } from '../../../lib/services'; import { getTemplates } from '../../../lib/services';
import { OnlyId } from '../../../types'; import { OnlyId } from '../../../types';
import { parseAndFindServiceTemplates } from '../../api/v1/services/handlers';
function generateServices(serviceId, containerId, port, isHttp2 = false, isHttps = false) { function generateServices(serviceId, containerId, port, isHttp2 = false, isHttps = false) {
if (isHttp2) { if (isHttp2) {
@@ -536,10 +537,11 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
} }
found = JSON.parse(JSON.stringify(found).replaceAll('$$id', id)); found = JSON.parse(JSON.stringify(found).replaceAll('$$id', id));
for (const oneService of Object.keys(found.services)) { for (const oneService of Object.keys(found.services)) {
const isDomainConfiguration = const isDomainAndProxyConfiguration =
found?.services[oneService]?.proxy?.filter((p) => p.domain) ?? []; found?.services[oneService]?.proxy?.filter((p) => p.port) ?? [];
if (isDomainConfiguration.length > 0) { if (isDomainAndProxyConfiguration.length > 0) {
const { proxy } = found.services[oneService]; const template: any = await parseAndFindServiceTemplates(service, null, true);
const { proxy } = template.services[oneService] || found.services[oneService];
for (let configuration of proxy) { for (let configuration of proxy) {
if (configuration.domain) { if (configuration.domain) {
const setting = serviceSetting.find( const setting = serviceSetting.find(

View File

@@ -6,7 +6,9 @@ import { OtherProxyConfiguration } from './types';
const root: FastifyPluginAsync = async (fastify): Promise<void> => { const root: FastifyPluginAsync = async (fastify): Promise<void> => {
fastify.get<OnlyId>('/main.json', async (request, reply) => proxyConfiguration(request, false)); fastify.get<OnlyId>('/main.json', async (request, reply) => proxyConfiguration(request, false));
fastify.get<OnlyId>('/remote/:id', async (request) => proxyConfiguration(request, true)); fastify.get<OnlyId>('/remote/:id', async (request) => proxyConfiguration(request, true));
fastify.get<OtherProxyConfiguration>('/other.json', async (request, reply) => otherProxyConfiguration(request)); fastify.get<OtherProxyConfiguration>('/other.json', async (request, reply) =>
otherProxyConfiguration(request)
);
}; };
export default root; export default root;

View File

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B

View File

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 486 B

View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

Some files were not shown because too many files have changed in this diff Show More