fix: Lets encrypt

This commit is contained in:
Andras Bacsai 2022-02-18 00:08:50 +01:00
parent 6a71233eb2
commit 50cae5ac3b
2 changed files with 9 additions and 5 deletions

View File

@ -47,23 +47,27 @@ export async function letsEncrypt({ domain, isCoolify = false, id = null }) {
}
}
if (dualCerts) {
await asyncExecShell(
const error = await asyncExecShell(
`DOCKER_HOST=${host} docker run --rm --name certbot-${randomCuid} -p ${randomPort}:${randomPort} -v "coolify-letsencrypt:/etc/letsencrypt" certbot/certbot --logs-dir /etc/letsencrypt/logs certonly --standalone --preferred-challenges http --http-01-address 0.0.0.0 --http-01-port ${randomPort} -d ${nakedDomain} -d ${wwwDomain} --expand --agree-tos --non-interactive --register-unsafely-without-email ${
dev ? '--test-cert' : ''
}`
);
await asyncExecShell(
if (error.stderr) throw error;
const sslCopyError = await asyncExecShell(
`DOCKER_HOST=${host} docker run --rm -v "coolify-letsencrypt:/etc/letsencrypt" -v "coolify-ssl-certs:/app/ssl" alpine:latest sh -c "test -d /etc/letsencrypt/live/${nakedDomain}/ && cat /etc/letsencrypt/live/${nakedDomain}/fullchain.pem /etc/letsencrypt/live/${nakedDomain}/privkey.pem > /app/ssl/${nakedDomain}.pem || cat /etc/letsencrypt/live/${wwwDomain}/fullchain.pem /etc/letsencrypt/live/${wwwDomain}/privkey.pem > /app/ssl/${wwwDomain}.pem"`
);
if (sslCopyError.stderr) throw sslCopyError;
} else {
await asyncExecShell(
const sslGenerateError = await asyncExecShell(
`DOCKER_HOST=${host} docker run --rm --name certbot-${randomCuid} -p ${randomPort}:${randomPort} -v "coolify-letsencrypt:/etc/letsencrypt" certbot/certbot --logs-dir /etc/letsencrypt/logs certonly --standalone --preferred-challenges http --http-01-address 0.0.0.0 --http-01-port ${randomPort} -d ${domain} --expand --agree-tos --non-interactive --register-unsafely-without-email ${
dev ? '--test-cert' : ''
}`
);
await asyncExecShell(
if (sslGenerateError.stderr) throw sslGenerateError;
const sslCopyError = await asyncExecShell(
`DOCKER_HOST=${host} docker run --rm -v "coolify-letsencrypt:/etc/letsencrypt" -v "coolify-ssl-certs:/app/ssl" alpine:latest sh -c "cat /etc/letsencrypt/live/${domain}/fullchain.pem /etc/letsencrypt/live/${domain}/privkey.pem > /app/ssl/${domain}.pem"`
);
if (sslCopyError.stderr) throw sslCopyError;
}
if (!isCoolify) {
await forceSSLOnApplication({ domain });

View File

@ -170,7 +170,7 @@ a {
padding: 8px;
color: #fff;
content: attr(data-tooltip);
@apply min-w-[100px] rounded bg-coollabs text-center font-medium;
@apply min-w-[100px] rounded bg-coollabs text-center font-normal;
}
/* Directions */