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.

Frontend for port range

Andras Bacsai0c2e028b38c5
diff --git a/src/lib/components/CopyPasswordField.svelte b/src/lib/components/CopyPasswordField.svelte
index de9c6c9afe..9a409fb175 100644
--- a/src/lib/components/CopyPasswordField.svelte
+++ b/src/lib/components/CopyPasswordField.svelte
@@ -20,7 +20,7 @@
function copyToClipboard() {
if (isHttps && navigator.clipboard) {
navigator.clipboard.writeText(value);
- toast.push('Copied to clipboard');
+ toast.push('Copied to clipboard.');
}
}
</script>
diff --git a/src/lib/components/Setting.svelte b/src/lib/components/Setting.svelte
index 680203c951..c8764bed73 100644
--- a/src/lib/components/Setting.svelte
+++ b/src/lib/components/Setting.svelte
@@ -15,7 +15,12 @@
<Explainer text={description} />
</div>
</div>
-<div class:tooltip={dataTooltip} class:text-center={isCenter} data-tooltip={dataTooltip}>
+<div
+ class:tooltip={dataTooltip}
+ class:text-center={isCenter}
+ data-tooltip={dataTooltip}
+ class="flex justify-center"
+>
<div
type="button"
on:click
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte
index 04310b8b3d..c31e462cb5 100644
--- a/src/routes/__layout.svelte
+++ b/src/routes/__layout.svelte
@@ -98,7 +98,7 @@
updateStatus.loading = true;
try {
await post(`/update.json`, { type: 'update', latestVersion });
- toast.push('Update completed.<br>Waiting for the new version to start...');
+ toast.push('Update completed.<br><br>Waiting for the new version to start...');
let reachable = false;
let tries = 0;
do {
diff --git a/src/routes/applications/[id]/check.json.ts b/src/routes/applications/[id]/check.json.ts
index 36e87b616b..82fb487ed0 100644
--- a/src/routes/applications/[id]/check.json.ts
+++ b/src/routes/applications/[id]/check.json.ts
@@ -16,7 +16,7 @@ export const post: RequestHandler = async (event) => {
const found = await db.isDomainConfigured({ id, fqdn });
if (found) {
throw {
- message: `Domain ${getDomain(fqdn).replace('www.', '')} is already configured.`
+ message: `Domain ${getDomain(fqdn).replace('www.', '')} is already used.`
};
}
return {
diff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelte
index 4e487ed9c2..bfd9133ebb 100644
--- a/src/routes/applications/[id]/index.svelte
+++ b/src/routes/applications/[id]/index.svelte
@@ -173,81 +173,71 @@
{/if}
</div>
<div class="grid grid-flow-row gap-2 px-10">
- <div class="mt-2 grid grid-cols-3 items-center">
+ <div class="mt-2 grid grid-cols-2 items-center">
<label for="name">Name</label>
- <div class="col-span-2 ">
- <input
- readonly={!$session.isAdmin}
- name="name"
- id="name"
- bind:value={application.name}
- required
- />
- </div>
+ <input
+ readonly={!$session.isAdmin}
+ name="name"
+ id="name"
+ bind:value={application.name}
+ required
+ />
</div>
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="gitSource">Git Source</label>
- <div class="col-span-2">
- <a
- href={$session.isAdmin
- ? `/applications/${id}/configuration/source?from=/applications/${id}`
- : ''}
- class="no-underline"
- ><input
- value={application.gitSource.name}
- id="gitSource"
- disabled
- class="cursor-pointer hover:bg-coolgray-500"
- /></a
- >
- </div>
+ <a
+ href={$session.isAdmin
+ ? `/applications/${id}/configuration/source?from=/applications/${id}`
+ : ''}
+ class="no-underline"
+ ><input
+ value={application.gitSource.name}
+ id="gitSource"
+ disabled
+ class="cursor-pointer hover:bg-coolgray-500"
+ /></a
+ >
</div>
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="repository">Git Repository</label>
- <div class="col-span-2">
- <a
- href={$session.isAdmin
- ? `/applications/${id}/configuration/repository?from=/applications/${id}&to=/applications/${id}/configuration/buildpack`
- : ''}
- class="no-underline"
- ><input
- value="{application.repository}/{application.branch}"
- id="repository"
- disabled
- class="cursor-pointer hover:bg-coolgray-500"
- /></a
- >
- </div>
+ <a
+ href={$session.isAdmin
+ ? `/applications/${id}/configuration/repository?from=/applications/${id}&to=/applications/${id}/configuration/buildpack`
+ : ''}
+ class="no-underline"
+ ><input
+ value="{application.repository}/{application.branch}"
+ id="repository"
+ disabled
+ class="cursor-pointer hover:bg-coolgray-500"
+ /></a
+ >
</div>
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="buildPack">Build Pack</label>
- <div class="col-span-2">
- <a
- href={$session.isAdmin
- ? `/applications/${id}/configuration/buildpack?from=/applications/${id}`
- : ''}
- class="no-underline "
- >
- <input
- value={application.buildPack}
- id="buildPack"
- disabled
- class="cursor-pointer hover:bg-coolgray-500"
- /></a
- >
- </div>
+ <a
+ href={$session.isAdmin
+ ? `/applications/${id}/configuration/buildpack?from=/applications/${id}`
+ : ''}
+ class="no-underline "
+ >
+ <input
+ value={application.buildPack}
+ id="buildPack"
+ disabled
+ class="cursor-pointer hover:bg-coolgray-500"
+ /></a
+ >
</div>
- <div class="grid grid-cols-3 items-center pb-8">
+ <div class="grid grid-cols-2 items-center pb-8">
<label for="destination">Destination</label>
- <div class="col-span-2">
- <div class="no-underline">
- <input
- value={application.destinationDocker.name}
- id="destination"
- disabled
- class="bg-transparent "
- />
- </div>
+ <div class="no-underline">
+ <input
+ value={application.destinationDocker.name}
+ id="destination"
+ disabled
+ class="bg-transparent "
+ />
</div>
</div>
</div>
@@ -255,24 +245,24 @@
<div class="title">Application</div>
</div>
<div class="grid grid-flow-row gap-2 px-10">
- <div class="grid grid-cols-3">
- <label for="fqdn" class="relative pt-2">Domain (FQDN)</label>
- <div class="col-span-2">
- <input
- readonly={!$session.isAdmin || isRunning}
- disabled={!$session.isAdmin || isRunning}
- bind:this={domainEl}
- name="fqdn"
- id="fqdn"
- bind:value={application.fqdn}
- pattern="^https?://([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{'{'}2,{'}'}$"
- placeholder="eg: https://coollabs.io"
- required
- />
+ <div class="grid grid-cols-2">
+ <div class="flex-col">
+ <label for="fqdn" class="relative pt-2">Domain (FQDN)</label>
<Explainer
text="If you specify <span class='text-green-500 font-bold'>https</span>, the application will be accessible only over https. SSL certificate will be generated for you.<br>If you specify <span class='text-green-500 font-bold'>www</span>, the application will be redirected (302) from non-www and vice versa.<br><br>To modify the domain, you must first stop the application."
/>
</div>
+ <input
+ readonly={!$session.isAdmin || isRunning}
+ disabled={!$session.isAdmin || isRunning}
+ bind:this={domainEl}
+ name="fqdn"
+ id="fqdn"
+ bind:value={application.fqdn}
+ pattern="^https?://([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{'{'}2,{'}'}$"
+ placeholder="eg: https://coollabs.io"
+ required
+ />
</div>
<div class="grid grid-cols-2 items-center pb-8">
<Setting
@@ -286,90 +276,78 @@
/>
</div>
{#if !staticDeployments.includes(application.buildPack)}
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="port">Port</label>
- <div class="col-span-2">
- <input
- readonly={!$session.isAdmin}
- name="port"
- id="port"
- bind:value={application.port}
- placeholder="default: 3000"
- />
- </div>
+ <input
+ readonly={!$session.isAdmin}
+ name="port"
+ id="port"
+ bind:value={application.port}
+ placeholder="default: 3000"
+ />
</div>
{/if}
{#if !notNodeDeployments.includes(application.buildPack)}
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="installCommand">Install Command</label>
- <div class="col-span-2">
- <input
- readonly={!$session.isAdmin}
- name="installCommand"
- id="installCommand"
- bind:value={application.installCommand}
- placeholder="default: yarn install"
- />
- </div>
+ <input
+ readonly={!$session.isAdmin}
+ name="installCommand"
+ id="installCommand"
+ bind:value={application.installCommand}
+ placeholder="default: yarn install"
+ />
</div>
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="buildCommand">Build Command</label>
- <div class="col-span-2">
- <input
- readonly={!$session.isAdmin}
- name="buildCommand"
- id="buildCommand"
- bind:value={application.buildCommand}
- placeholder="default: yarn build"
- />
- </div>
+ <input
+ readonly={!$session.isAdmin}
+ name="buildCommand"
+ id="buildCommand"
+ bind:value={application.buildCommand}
+ placeholder="default: yarn build"
+ />
</div>
- <div class="grid grid-cols-3 items-center">
+ <div class="grid grid-cols-2 items-center">
<label for="startCommand" class="">Start Command</label>
- <div class="col-span-2">
- <input
- readonly={!$session.isAdmin}
- name="startCommand"
- id="startCommand"
- bind:value={application.startCommand}
- placeholder="default: yarn start"
- />
- </div>
+ <input
+ readonly={!$session.isAdmin}
+ name="startCommand"
+ id="startCommand"
+ bind:value={application.startCommand}
+ placeholder="default: yarn start"
+ />
</div>
{/if}
- <div class="grid grid-cols-3">
+ <div class="grid grid-cols-2 items-center">
<label for="baseDirectory" class="pt-2">Base Directory</label>
- <div class="col-span-2">
+ <input
+ readonly={!$session.isAdmin}
+ name="baseDirectory"
+ id="baseDirectory"
+ bind:value={application.baseDirectory}
+ placeholder="default: /"
+ />
+ <Explainer
+ text="Directory to use as the base of all commands. <br> Could be useful with monorepos."
+ />
+ </div>
+ {#if !notNodeDeployments.includes(application.buildPack)}
+ <div class="grid grid-cols-2">
+ <label for="publishDirectory" class="pt-2">Publish Directory</label>
<input
readonly={!$session.isAdmin}
- name="baseDirectory"
- id="baseDirectory"
- bind:value={application.baseDirectory}
- placeholder="default: /"
+ name="publishDirectory"
+ id="publishDirectory"
+ bind:value={application.publishDirectory}
+ placeholder=" default: /"
/>
<Explainer
- text="Directory to use as the base of all commands. <br> Could be useful with monorepos."
+ text="Directory containing all the assets for deployment. <br> For example: <span class='text-green-600 font-bold'>dist</span>,<span class='text-green-600 font-bold'>_site</span> or <span class='text-green-600 font-bold'>public</span>."
/>
</div>
- </div>
- {#if !notNodeDeployments.includes(application.buildPack)}
- <div class="grid grid-cols-3">
- <label for="publishDirectory" class="pt-2">Publish Directory</label>
- <div class="col-span-2">
- <input
- readonly={!$session.isAdmin}
- name="publishDirectory"
- id="publishDirectory"
- bind:value={application.publishDirectory}
- placeholder=" default: /"
- />
- <Explainer
- text="Directory containing all the assets for deployment. <br> For example: <span class='text-green-600 font-bold'>dist</span>,<span class='text-green-600 font-bold'>_site</span> or <span class='text-green-600 font-bold'>public</span>."
- />
- </div>
- </div>
{/if}
</div>
</form>
diff --git a/src/routes/destinations/[id]/_FoundApp.svelte b/src/routes/destinations/[id]/_FoundApp.svelte
index f183388faf..835c121bf1 100644
--- a/src/routes/destinations/[id]/_FoundApp.svelte
+++ b/src/routes/destinations/[id]/_FoundApp.svelte
@@ -61,12 +61,12 @@
<div class="w-full text-center font-bold">Loading...</div>
{:else if app.foundByDomain}
<div class="w-full bg-coolgray-200 text-xs">
- <span class="text-red-500">Domain</span> already configured for
+ <span class="text-red-500">Domain</span> already used for
<span class="text-red-500">{app.foundName}</span>
</div>
{:else if app.foundByRepository}
<div class="w-full bg-coolgray-200 text-xs">
- <span class="text-red-500">Repository</span> already configured for
+ <span class="text-red-500">Repository</span> already used for
<span class="text-red-500">{app.foundName}</span>
</div>
{:else}
diff --git a/src/routes/services/[id]/check.json.ts b/src/routes/services/[id]/check.json.ts
index 861daee845..9a91935248 100644
--- a/src/routes/services/[id]/check.json.ts
+++ b/src/routes/services/[id]/check.json.ts
@@ -17,7 +17,7 @@ export const post: RequestHandler = async (event) => {
return {
status: found ? 500 : 200,
body: {
- error: found && `Domain ${getDomain(fqdn).replace('www.', '')} is already configured`
+ error: found && `Domain ${getDomain(fqdn).replace('www.', '')} is already used.`
}
};
} catch (error) {
diff --git a/src/routes/settings/check.json.ts b/src/routes/settings/check.json.ts
index 15d91613f5..d24dcc0e6d 100644
--- a/src/routes/settings/check.json.ts
+++ b/src/routes/settings/check.json.ts
@@ -16,7 +16,7 @@ export const post: RequestHandler = async (event) => {
return {
status: found ? 500 : 200,
body: {
- error: found && `Domain ${fqdn.replace('www.', '')} is already configured`
+ error: found && `Domain ${fqdn.replace('www.', '')} is already used.`
}
};
} catch (error) {
diff --git a/src/routes/settings/index.json.ts b/src/routes/settings/index.json.ts
index bd365d5e43..a1182bb42d 100644
--- a/src/routes/settings/index.json.ts
+++ b/src/routes/settings/index.json.ts
@@ -78,7 +78,7 @@ export const post: RequestHandler = async (event) => {
};
if (status === 401) return { status, body };
- const { fqdn, isRegistrationEnabled, dualCerts } = await event.request.json();
+ const { fqdn, isRegistrationEnabled, dualCerts, minPort, maxPort } = await event.request.json();
try {
const {
id,
@@ -119,6 +119,9 @@ export const post: RequestHandler = async (event) => {
data: { isCoolifyProxyUsed: true }
});
}
+ if (minPort && maxPort) {
+ await db.prisma.setting.update({ where: { id }, data: { minPort, maxPort } });
+ }
return {
status: 201
diff --git a/src/routes/settings/index.svelte b/src/routes/settings/index.svelte
index f86af5e4b1..80c3cee800 100644
--- a/src/routes/settings/index.svelte
+++ b/src/routes/settings/index.svelte
@@ -35,6 +35,9 @@
let isRegistrationEnabled = settings.isRegistrationEnabled;
let dualCerts = settings.dualCerts;
+ let minPort = settings.minPort;
+ let maxPort = settings.maxPort;
+
let fqdn = settings.fqdn;
let isFqdnSet = !!settings.fqdn;
let loading = {
@@ -75,7 +78,11 @@
if (fqdn) {
await post(`/settings/check.json`, { fqdn });
await post(`/settings.json`, { fqdn });
- return window.location.reload();
+ }
+ if (minPort !== settings.minPort || maxPort !== settings.maxPort) {
+ await post(`/settings.json`, { minPort, maxPort });
+ settings.minPort = minPort;
+ settings.maxPort = maxPort;
}
} catch ({ error }) {
return errorNotification(error);
@@ -112,7 +119,12 @@
</div>
<div class="grid grid-flow-row gap-2 px-10">
<div class="grid grid-cols-2 items-start">
- <div class="pt-2 text-base font-bold text-stone-100">Domain (FQDN)</div>
+ <div class="flex-col">
+ <div class="pt-2 text-base font-bold text-stone-100">Domain (FQDN)</div>
+ <Explainer
+ text="If you specify <span class='text-yellow-500 font-bold'>https</span>, Coolify will be accessible only over https. SSL certificate will be generated for you.<br>If you specify <span class='text-yellow-500 font-bold'>www</span>, Coolify will be redirected (302) from non-www and vice versa."
+ />
+ </div>
<div class="justify-start text-left">
<input
bind:value={fqdn}
@@ -122,10 +134,31 @@
id="fqdn"
pattern="^https?://([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{'{'}2,{'}'}$"
placeholder="eg: https://coolify.io"
- required
/>
+ </div>
+ </div>
+ <div class="grid grid-cols-2 items-start py-6">
+ <div class="flex-col">
+ <div class="pt-2 text-base font-bold text-stone-100">Public Port Range</div>
<Explainer
- text="If you specify <span class='text-yellow-500 font-bold'>https</span>, Coolify will be accessible only over https. SSL certificate will be generated for you.<br>If you specify <span class='text-yellow-500 font-bold'>www</span>, Coolify will be redirected (302) from non-www and vice versa."
+ text="Ports used to expose databases/services/internal services.<br> Add them to your firewall (if applicable).<br><br>You can specify a range of ports, eg: <span class='text-yellow-500 font-bold'>9000-9100</span>"
+ />
+ </div>
+ <div class="mx-auto flex-row items-center justify-center space-y-2">
+ <input
+ class="h-8 w-20 px-2"
+ type="number"
+ bind:value={minPort}
+ min="1024"
+ max={maxPort}
+ />
+ -
+ <input
+ class="h-8 w-20 px-2"
+ type="number"
+ bind:value={maxPort}
+ min={minPort}
+ max="65543"
/>
</div>
</div>
@@ -135,7 +168,7 @@
disabled={isFqdnSet}
bind:setting={dualCerts}
title="Generate SSL for www and non-www?"
- description="It will generate certificates for both www and non-www. <br>You need to have <span class='font-bold text-yellow-400'>both DNS entries</span> set in advance.<br><br>Useful if you expect to have visitors on both."
+ description="It will generate certificates for both www and non-www. <br>You need to have <span class='font-bold text-yellow-500'>both DNS entries</span> set in advance.<br><br>Useful if you expect to have visitors on both."
on:click={() => !isFqdnSet && changeSettings('dualCerts')}
/>
</div>