debug more
This commit is contained in:
@@ -20,6 +20,7 @@ async function applicationConfiguration(traefik: any, remoteId: string | null =
|
|||||||
const configurableApplications = []
|
const configurableApplications = []
|
||||||
if (applications.length > 0) {
|
if (applications.length > 0) {
|
||||||
for (const application of applications) {
|
for (const application of applications) {
|
||||||
|
try {
|
||||||
const {
|
const {
|
||||||
fqdn,
|
fqdn,
|
||||||
id,
|
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) {
|
for (const application of configurableApplications) {
|
||||||
let { id, port, isCustomSSL, pathPrefix, isHttps, nakedDomain, isWWW, domain, dualCerts } = application
|
let { id, port, isCustomSSL, pathPrefix, isHttps, nakedDomain, isWWW, domain, dualCerts } = application
|
||||||
|
try {
|
||||||
if (isHttps) {
|
if (isHttps) {
|
||||||
traefik.http.routers[`${id}-${port || 'default'}`] = generateHttpRouter(`${id}-${port || 'default'}`, nakedDomain, pathPrefix)
|
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')
|
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 = []
|
const configurableServices = []
|
||||||
if (services.length > 0) {
|
if (services.length > 0) {
|
||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
|
try {
|
||||||
let {
|
let {
|
||||||
fqdn,
|
fqdn,
|
||||||
id,
|
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) {
|
for (const service of configurableServices) {
|
||||||
let { id, fqdn, dualCerts, configuration, isCustomSSL = false } = service
|
let { id, fqdn, dualCerts, configuration, isCustomSSL = false } = service
|
||||||
|
try {
|
||||||
let port, pathPrefix, customDomain;
|
let port, pathPrefix, customDomain;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
port = configuration?.port;
|
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) {
|
async function coolifyConfiguration(traefik: any) {
|
||||||
|
try {
|
||||||
const { fqdn, dualCerts } = await prisma.setting.findFirst();
|
const { fqdn, dualCerts } = await prisma.setting.findFirst();
|
||||||
let coolifyConfigurations = []
|
|
||||||
if (fqdn) {
|
if (fqdn) {
|
||||||
const domain = getDomain(fqdn);
|
const domain = getDomain(fqdn);
|
||||||
const nakedDomain = domain.replace(/^www\./, '');
|
const nakedDomain = domain.replace(/^www\./, '');
|
||||||
const isHttps = fqdn.startsWith('https://');
|
const isHttps = fqdn.startsWith('https://');
|
||||||
const isWWW = fqdn.includes('www.');
|
const isWWW = fqdn.includes('www.');
|
||||||
coolifyConfigurations.push({
|
const id = isDev ? 'host.docker.internal' : 'coolify'
|
||||||
id: isDev ? 'host.docker.internal' : 'coolify',
|
const container = isDev ? 'host.docker.internal' : 'coolify'
|
||||||
container: isDev ? 'host.docker.internal' : 'coolify',
|
const port = 3000
|
||||||
port: 3000,
|
const pathPrefix = '/'
|
||||||
domain,
|
const isCustomSSL = false
|
||||||
nakedDomain,
|
|
||||||
isHttps,
|
|
||||||
isWWW,
|
|
||||||
isDualCerts: dualCerts,
|
|
||||||
pathPrefix: '/'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (const coolify of coolifyConfigurations) {
|
|
||||||
const { id, pathPrefix, port, domain, nakedDomain, isHttps, isWWW, isDualCerts, scriptName, type, isCustomSSL } = coolify;
|
|
||||||
if (isHttps) {
|
if (isHttps) {
|
||||||
traefik.http.routers[`${id}-${port || 'default'}`] = generateHttpRouter(`${id}-${port || 'default'}`, nakedDomain, pathPrefix)
|
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')
|
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) {
|
function generateLoadBalancerService(id, port) {
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user