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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat: Ports range
Andras Bacsaid606cd86a046
diff --git a/src/lib/queues/ssl.ts b/src/lib/queues/ssl.tsindex 213788db6a..cbc7964c0f 100644--- a/src/lib/queues/ssl.ts+++ b/src/lib/queues/ssl.ts@@ -4,9 +4,16 @@ import { dockerInstance } from '$lib/docker';import { forceSSLOnApplication } from '$lib/haproxy';import * as db from '$lib/database';import { dev } from '$app/env';+import getPort, { portNumbers } from 'get-port';+import cuid from 'cuid';export default async function () {try {+ const data = await db.prisma.setting.findFirst();+ const { minPort, maxPort } = data;++ const publicPort = await getPort({ port: portNumbers(minPort, maxPort) });+ const randomCuid = cuid();const destinationDockers = await prisma.destinationDocker.findMany({});for (const destination of destinationDockers) {if (destination.isCoolifyProxyUsed) {@@ -30,10 +37,10 @@ export default async function () {} else {const host = getEngine(destination.engine);await asyncExecShell(- `DOCKER_HOST=${host} docker run --rm --name certbot -p 9080:9080 -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 9080 -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`+ `DOCKER_HOST=${host} docker run --rm --name certbot-${randomCuid} -p 9080:${publicPort} -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 ${publicPort} -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`);const { stderr } = await asyncExecShell(- `DOCKER_HOST=${host} docker run --rm --name bash -v "coolify-letsencrypt:/etc/letsencrypt" -v "coolify-ssl-certs:/app/ssl" alpine:latest cat /etc/letsencrypt/live/${domain}/fullchain.pem /etc/letsencrypt/live/${domain}/privkey.pem > /app/ssl/${domain}.pem`+ `DOCKER_HOST=${host} docker run --rm -v "coolify-letsencrypt:/etc/letsencrypt" -v "coolify-ssl-certs:/app/ssl" alpine:latest cat /etc/letsencrypt/live/${domain}/fullchain.pem /etc/letsencrypt/live/${domain}/privkey.pem > /app/ssl/${domain}.pem`);if (stderr) throw new Error(stderr);}@@ -52,7 +59,7 @@ export default async function () {console.log('DEV MODE: SSL is enabled');} else {await asyncExecShell(- `docker run --rm --name certbot -p 9080:9080 -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 9080 -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`+ `docker run --rm --name certbot-${randomCuid} -p 9080:${publicPort} -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 ${publicPort} -d ${domain} --agree-tos --non-interactive --register-unsafely-without-email`);const { stderr } = await asyncExecShell(diff --git a/src/routes/services/[id]/minio/start.json.ts b/src/routes/services/[id]/minio/start.json.tsindex e865b5e526..13d1c96044 100644--- a/src/routes/services/[id]/minio/start.json.ts+++ b/src/routes/services/[id]/minio/start.json.ts@@ -9,10 +9,9 @@ import {configureSimpleServiceProxyOn,reloadHaproxy,setWwwRedirection,- startHttpProxy,- startTcpProxy+ startHttpProxy} from '$lib/haproxy';-import getPort from 'get-port';+import getPort, { portNumbers } from 'get-port';import { getDomain } from '$lib/components/common';import { ErrorHandler } from '$lib/database';import { makeLabelForServices } from '$lib/buildPacks/common';@@ -35,14 +34,20 @@ export const post: RequestHandler = async (event) => {minio: { rootUser, rootUserPassword }} = service;+ const data = await db.prisma.setting.findFirst();+ const { minPort, maxPort } = data;+const domain = getDomain(fqdn);const isHttps = fqdn.startsWith('https://');const network = destinationDockerId && destinationDocker.network;const host = getEngine(destinationDocker.engine);- const publicPort = await getPort();++ const publicPort = await getPort({ port: portNumbers(minPort, maxPort) });+const consolePort = 9001;const apiPort = 9000;+const { workdir } = await createDirectories({ repository: type, buildId: id });const config = {