fix: remove old minio proxies
This commit is contained in:
parent
2781848aac
commit
a97f7d225a
@ -443,7 +443,7 @@ async function migrateSettings(settings: any[], service: any, template: any) {
|
|||||||
if (!variableName) {
|
if (!variableName) {
|
||||||
variableName = `$$config_${name.toLowerCase()}`
|
variableName = `$$config_${name.toLowerCase()}`
|
||||||
}
|
}
|
||||||
console.log('Migrating setting', name, value, 'for service', service.id, ', service name:', service.name, 'variableName: ', variableName)
|
// console.log('Migrating setting', name, value, 'for service', service.id, ', service name:', service.name, 'variableName: ', variableName)
|
||||||
|
|
||||||
await prisma.serviceSetting.findFirst({ where: { name: minio, serviceId: service.id } }) || await prisma.serviceSetting.create({ data: { name: minio, value, variableName, service: { connect: { id: service.id } } } })
|
await prisma.serviceSetting.findFirst({ where: { name: minio, serviceId: service.id } }) || await prisma.serviceSetting.create({ data: { name: minio, value, variableName, service: { connect: { id: service.id } } } })
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import sshConfig from 'ssh-config';
|
|||||||
|
|
||||||
import { checkContainer, removeContainer } from './docker';
|
import { checkContainer, removeContainer } from './docker';
|
||||||
import { day } from './dayjs';
|
import { day } from './dayjs';
|
||||||
import * as serviceFields from './services/serviceFields';
|
|
||||||
import { saveBuildLog } from './buildPacks/common';
|
import { saveBuildLog } from './buildPacks/common';
|
||||||
import { scheduler } from './scheduler';
|
import { scheduler } from './scheduler';
|
||||||
|
|
||||||
@ -1470,50 +1469,6 @@ export async function getServiceFromDB({
|
|||||||
return { ...body, settings };
|
return { ...body, settings };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function saveUpdateableFields(type: string, data: any) {
|
|
||||||
const update = {};
|
|
||||||
if (type && serviceFields[type]) {
|
|
||||||
serviceFields[type].map((k) => {
|
|
||||||
let temp = data[k.name];
|
|
||||||
if (temp) {
|
|
||||||
if (k.isEncrypted) {
|
|
||||||
temp = encrypt(temp);
|
|
||||||
}
|
|
||||||
if (k.isLowerCase) {
|
|
||||||
temp = temp.toLowerCase();
|
|
||||||
}
|
|
||||||
if (k.isNumber) {
|
|
||||||
temp = Number(temp);
|
|
||||||
}
|
|
||||||
if (k.isBoolean) {
|
|
||||||
temp = Boolean(temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (k.isNumber && temp === '') {
|
|
||||||
temp = null;
|
|
||||||
}
|
|
||||||
update[k.name] = temp;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return update;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getUpdateableFields(type: string, data: any) {
|
|
||||||
const update = {};
|
|
||||||
if (type && serviceFields[type]) {
|
|
||||||
serviceFields[type].map((k) => {
|
|
||||||
let temp = data[k.name];
|
|
||||||
if (temp) {
|
|
||||||
if (k.isEncrypted) {
|
|
||||||
temp = decrypt(temp);
|
|
||||||
}
|
|
||||||
update[k.name] = temp;
|
|
||||||
}
|
|
||||||
update[k.name] = temp;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return update;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function fixType(type) {
|
export function fixType(type) {
|
||||||
return type?.replaceAll(' ', '').toLowerCase() || null;
|
return type?.replaceAll(' ', '').toLowerCase() || null;
|
||||||
|
@ -140,7 +140,21 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
|
|||||||
await fs.writeFile(composeFileDestination, yaml.dump(composeFile));
|
await fs.writeFile(composeFileDestination, yaml.dump(composeFile));
|
||||||
await startServiceContainers(fastify, id, teamId, destinationDocker.id, composeFileDestination)
|
await startServiceContainers(fastify, id, teamId, destinationDocker.id, composeFileDestination)
|
||||||
if (service.type === 'minio') {
|
if (service.type === 'minio') {
|
||||||
await stopTcpHttpProxy(id, destinationDocker, 9000);
|
try {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: destinationDocker.id,
|
||||||
|
command:
|
||||||
|
`docker container ls -a --filter 'name=${id}-' --format {{.ID}}|xargs -r -n 1 docker container stop -t 0`
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) { }
|
||||||
|
try {
|
||||||
|
await executeDockerCmd({
|
||||||
|
dockerId: destinationDocker.id,
|
||||||
|
command:
|
||||||
|
`docker container ls -a --filter 'name=${id}-' --format {{.ID}}|xargs -r -n 1 docker container rm -f`
|
||||||
|
});
|
||||||
|
} catch (error) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
|
@ -4,7 +4,7 @@ import yaml from 'js-yaml';
|
|||||||
import bcrypt from 'bcryptjs';
|
import bcrypt from 'bcryptjs';
|
||||||
import cuid from 'cuid';
|
import cuid from 'cuid';
|
||||||
|
|
||||||
import { prisma, uniqueName, asyncExecShell, getServiceFromDB, getContainerUsage, isDomainConfigured, saveUpdateableFields, fixType, decrypt, encrypt, ComposeFile, getFreePublicPort, getDomain, errorHandler, generatePassword, isDev, stopTcpHttpProxy, executeDockerCmd, checkDomainsIsValidInDNS, checkExposedPort, listSettings } from '../../../../lib/common';
|
import { prisma, uniqueName, asyncExecShell, getServiceFromDB, getContainerUsage, isDomainConfigured, fixType, decrypt, encrypt, ComposeFile, getFreePublicPort, getDomain, errorHandler, generatePassword, isDev, stopTcpHttpProxy, executeDockerCmd, checkDomainsIsValidInDNS, checkExposedPort, listSettings } from '../../../../lib/common';
|
||||||
import { day } from '../../../../lib/dayjs';
|
import { day } from '../../../../lib/dayjs';
|
||||||
import { checkContainer, } from '../../../../lib/docker';
|
import { checkContainer, } from '../../../../lib/docker';
|
||||||
import { removeService } from '../../../../lib/services/common';
|
import { removeService } from '../../../../lib/services/common';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user