Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: skip ssl cert in case of error

Andras Bacsai927bf4630495
diff --git a/src/lib/letsencrypt/index.ts b/src/lib/letsencrypt/index.ts
index ff189845f9..e85f539de3 100644
--- a/src/lib/letsencrypt/index.ts
+++ b/src/lib/letsencrypt/index.ts
@@ -103,34 +103,38 @@ export async function generateSSLCerts() {
orderBy: { createdAt: 'desc' }
});
for (const application of applications) {
- const {
- fqdn,
- id,
- destinationDocker: { engine, network },
- settings: { previews }
- } = application;
- const isRunning = await checkContainer(engine, id);
- const domain = getDomain(fqdn);
- const isHttps = fqdn.startsWith('https://');
- if (isRunning) {
- if (isHttps) ssls.push({ domain, id, isCoolify: false });
- }
- if (previews) {
- const host = getEngine(engine);
- const { stdout } = await asyncExecShell(
- `DOCKER_HOST=${host} docker container ls --filter="status=running" --filter="network=${network}" --filter="name=${id}-" --format="{{json .Names}}"`
- );
- const containers = stdout
- .trim()
- .split('\n')
- .filter((a) => a)
- .map((c) => c.replace(/"/g, ''));
- if (containers.length > 0) {
- for (const container of containers) {
- let previewDomain = `${container.split('-')[1]}.${domain}`;
- if (isHttps) ssls.push({ domain: previewDomain, id, isCoolify: false });
+ try {
+ const {
+ fqdn,
+ id,
+ destinationDocker: { engine, network },
+ settings: { previews }
+ } = application;
+ const isRunning = await checkContainer(engine, id);
+ const domain = getDomain(fqdn);
+ const isHttps = fqdn.startsWith('https://');
+ if (isRunning) {
+ if (isHttps) ssls.push({ domain, id, isCoolify: false });
+ }
+ if (previews) {
+ const host = getEngine(engine);
+ const { stdout } = await asyncExecShell(
+ `DOCKER_HOST=${host} docker container ls --filter="status=running" --filter="network=${network}" --filter="name=${id}-" --format="{{json .Names}}"`
+ );
+ const containers = stdout
+ .trim()
+ .split('\n')
+ .filter((a) => a)
+ .map((c) => c.replace(/"/g, ''));
+ if (containers.length > 0) {
+ for (const container of containers) {
+ let previewDomain = `${container.split('-')[1]}.${domain}`;
+ if (isHttps) ssls.push({ domain: previewDomain, id, isCoolify: false });
+ }
}
}
+ } catch (error) {
+ console.log(`Error during generateSSLCerts with ${application.fqdn}: ${error}`);
}
}
const services = await db.prisma.service.findMany({
@@ -145,20 +149,24 @@ export async function generateSSLCerts() {
});
for (const service of services) {
- const {
- fqdn,
- id,
- type,
- destinationDocker: { engine }
- } = service;
- const found = db.supportedServiceTypesAndVersions.find((a) => a.name === type);
- if (found) {
- const domain = getDomain(fqdn);
- const isHttps = fqdn.startsWith('https://');
- const isRunning = await checkContainer(engine, id);
- if (isRunning) {
- if (isHttps) ssls.push({ domain, id, isCoolify: false });
+ try {
+ const {
+ fqdn,
+ id,
+ type,
+ destinationDocker: { engine }
+ } = service;
+ const found = db.supportedServiceTypesAndVersions.find((a) => a.name === type);
+ if (found) {
+ const domain = getDomain(fqdn);
+ const isHttps = fqdn.startsWith('https://');
+ const isRunning = await checkContainer(engine, id);
+ if (isRunning) {
+ if (isHttps) ssls.push({ domain, id, isCoolify: false });
+ }
}
+ } catch (error) {
+ console.log(`Error during generateSSLCerts with ${service.fqdn}: ${error}`);
}
}
const { fqdn } = await db.prisma.setting.findFirst();