debug more
This commit is contained in:
@@ -20,6 +20,7 @@ async function applicationConfiguration(traefik: any, remoteId: string | null =
|
||||
const configurableApplications = []
|
||||
if (applications.length > 0) {
|
||||
for (const application of applications) {
|
||||
try {
|
||||
const {
|
||||
fqdn,
|
||||
id,
|
||||
@@ -113,9 +114,14 @@ async function applicationConfiguration(traefik: any, remoteId: string | null =
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('cannot create traefik configuration for application', application.id)
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
for (const application of configurableApplications) {
|
||||
let { id, port, isCustomSSL, pathPrefix, isHttps, nakedDomain, isWWW, domain, dualCerts } = application
|
||||
try {
|
||||
if (isHttps) {
|
||||
traefik.http.routers[`${id}-${port || 'default'}`] = generateHttpRouter(`${id}-${port || 'default'}`, nakedDomain, pathPrefix)
|
||||
traefik.http.routers[`${id}-${port || 'default'}-secure`] = generateProtocolRedirectRouter(`${id}-${port || 'default'}-secure`, nakedDomain, pathPrefix, 'http-to-https')
|
||||
@@ -192,6 +198,11 @@ async function applicationConfiguration(traefik: any, remoteId: string | null =
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Error generating traefik config for ' + id);
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,6 +235,7 @@ async function serviceConfiguration(traefik: any, remoteId: string | null = null
|
||||
const configurableServices = []
|
||||
if (services.length > 0) {
|
||||
for (const service of services) {
|
||||
try {
|
||||
let {
|
||||
fqdn,
|
||||
id,
|
||||
@@ -283,10 +295,15 @@ async function serviceConfiguration(traefik: any, remoteId: string | null = null
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Error generating traefik config for ' + service.id);
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
for (const service of configurableServices) {
|
||||
let { id, fqdn, dualCerts, configuration, isCustomSSL = false } = service
|
||||
try {
|
||||
let port, pathPrefix, customDomain;
|
||||
if (configuration) {
|
||||
port = configuration?.port;
|
||||
@@ -376,33 +393,27 @@ async function serviceConfiguration(traefik: any, remoteId: string | null = null
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Error generating router for', id);
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
async function coolifyConfiguration(traefik: any) {
|
||||
try {
|
||||
const { fqdn, dualCerts } = await prisma.setting.findFirst();
|
||||
let coolifyConfigurations = []
|
||||
if (fqdn) {
|
||||
const domain = getDomain(fqdn);
|
||||
const nakedDomain = domain.replace(/^www\./, '');
|
||||
const isHttps = fqdn.startsWith('https://');
|
||||
const isWWW = fqdn.includes('www.');
|
||||
coolifyConfigurations.push({
|
||||
id: isDev ? 'host.docker.internal' : 'coolify',
|
||||
container: isDev ? 'host.docker.internal' : 'coolify',
|
||||
port: 3000,
|
||||
domain,
|
||||
nakedDomain,
|
||||
isHttps,
|
||||
isWWW,
|
||||
isDualCerts: dualCerts,
|
||||
pathPrefix: '/'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (const coolify of coolifyConfigurations) {
|
||||
const { id, pathPrefix, port, domain, nakedDomain, isHttps, isWWW, isDualCerts, scriptName, type, isCustomSSL } = coolify;
|
||||
const id = isDev ? 'host.docker.internal' : 'coolify'
|
||||
const container = isDev ? 'host.docker.internal' : 'coolify'
|
||||
const port = 3000
|
||||
const pathPrefix = '/'
|
||||
const isCustomSSL = false
|
||||
if (isHttps) {
|
||||
traefik.http.routers[`${id}-${port || 'default'}`] = generateHttpRouter(`${id}-${port || 'default'}`, nakedDomain, pathPrefix)
|
||||
traefik.http.routers[`${id}-${port || 'default'}-secure`] = generateProtocolRedirectRouter(`${id}-${port || 'default'}-secure`, nakedDomain, pathPrefix, 'http-to-https')
|
||||
@@ -480,6 +491,11 @@ async function coolifyConfiguration(traefik: any) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('Cannot generate traefik config for Coolify.')
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
function generateLoadBalancerService(id, port) {
|
||||
return {
|
||||
|
Reference in New Issue
Block a user