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.

Removed some checking that doesn't work properly. Added a switch for exposing a port.

Aaron Styles40cbee0d758f
diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json
index d77d2a1c1e..11fe2e71ce 100644
--- a/src/lib/locales/en.json
+++ b/src/lib/locales/en.json
@@ -200,6 +200,7 @@
"enable_automatic_deployment": "Enable Automatic Deployment",
"enable_auto_deploy_webhooks": "Enable automatic deployment through webhooks.",
"enable_mr_pr_previews": "Enable MR/PR Previews",
+ "expose_a_port": "Expose a port",
"enable_preview_deploy_mr_pr_requests": "Enable preview deployments from pull or merge requests.",
"debug_logs": "Debug Logs",
"enable_debug_log_during_build": "Enable debug logs during build phase.<br><span class='text-red-500 font-bold'>Sensitive information</span> could be visible and saved in logs.",
diff --git a/src/lib/locales/fr.json b/src/lib/locales/fr.json
index 36f10dfb4e..242ac6fce0 100644
--- a/src/lib/locales/fr.json
+++ b/src/lib/locales/fr.json
@@ -61,6 +61,7 @@
"enable_debug_log_during_build": "Activez les journaux de débogage pendant la phase de build.<br><span class='text-red-500 font-bold'>Les informations sensibles</span> peuvent être visibles et enregistrées dans les journaux.",
"enable_mr_pr_previews": "Activer les aperçus MR/PR",
"enable_preview_deploy_mr_pr_requests": "Activez les déploiements de prévisualisation à partir de demandes d'extraction ou de fusion.",
+ "expose_a_port": "Exposer un port",
"features": "Caractéristiques",
"git_repository": "Dépôt Git",
"git_source": "Source Git",
diff --git a/src/routes/applications/[id]/check.json.ts b/src/routes/applications/[id]/check.json.ts
index db794e9bd4..f432b5dba5 100644
--- a/src/routes/applications/[id]/check.json.ts
+++ b/src/routes/applications/[id]/check.json.ts
@@ -54,9 +54,6 @@ export const post: RequestHandler = async (event) => {
}
const publicPort = await getPort({ port: exposePort });
- if (exposePort !== publicPort) {
- throw { message: `Expose Port ${exposePort} is already in use` };
- }
}
return {
diff --git a/src/routes/applications/[id]/index.json.ts b/src/routes/applications/[id]/index.json.ts
index 560ec21e7c..558e44a9f7 100644
--- a/src/routes/applications/[id]/index.json.ts
+++ b/src/routes/applications/[id]/index.json.ts
@@ -3,10 +3,7 @@ import * as db from '$lib/database';
import { ErrorHandler } from '$lib/database';
import { checkContainer, isContainerExited } from '$lib/haproxy';
import type { RequestHandler } from '@sveltejs/kit';
-import jsonwebtoken from 'jsonwebtoken';
-import { get as getRequest } from '$lib/api';
import { setDefaultConfiguration } from '$lib/buildPacks/common';
-import getPort from 'get-port';
export const get: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
diff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelte
index 07bcd4f36e..80b4b25428 100644
--- a/src/routes/applications/[id]/index.svelte
+++ b/src/routes/applications/[id]/index.svelte
@@ -60,6 +60,7 @@
let previews = application.settings.previews;
let dualCerts = application.settings.dualCerts;
let autodeploy = application.settings.autodeploy;
+ let showExposePort = application.exposePort !== null;
let wsgis = [
{
@@ -174,29 +175,6 @@
</svg></a
>
{/if}
-
- {#if application.exposePort}
- <a
- href={`${window.location.origin.split(':').slice(0, 2).join(':')}:${application.exposePort}`}
- target="_blank"
- class="icons tooltip-bottom flex items-center bg-transparent text-sm"
- ><svg
- xmlns="http://www.w3.org/2000/svg"
- class="h-6 w-6"
- viewBox="0 0 24 24"
- stroke-width="1.5"
- stroke="currentColor"
- fill="none"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" />
- <line x1="10" y1="14" x2="20" y2="4" />
- <polyline points="15 4 20 4 20 9" />
- </svg></a
- >
- {/if}
<a
href="{application.gitSource.htmlUrl}/{application.repository}/tree/{application.branch}"
target="_blank"
@@ -423,15 +401,30 @@
{/if}
{#if !staticDeployments.includes(application.buildPack)}
<div class="grid grid-cols-2 items-center">
- <label for="exposePort" class="text-base font-bold text-stone-100">Expose Port</label>
- <input
- readonly={!$session.isAdmin}
- name="exposePort"
- id="exposePort"
- bind:value={application.exposePort}
- placeholder="12345"
+ <Setting
+ isCenter={false}
+ bind:setting={showExposePort}
+ on:click={() => {
+ showExposePort = !showExposePort;
+ application.exposePort = undefined;
+ }}
+ title={$t('application.expose_a_port')}
+ description="Expose a port to the host system"
/>
</div>
+
+ {#if showExposePort}
+ <div class="grid grid-cols-2 items-center">
+ <label for="exposePort" class="text-base font-bold text-stone-100">Expose Port</label>
+ <input
+ readonly={!$session.isAdmin}
+ name="exposePort"
+ id="exposePort"
+ bind:value={application.exposePort}
+ placeholder="12345"
+ />
+ </div>
+ {/if}
{/if}
{#if !notNodeDeployments.includes(application.buildPack)}
<div class="grid grid-cols-2 items-center">
diff --git a/src/routes/services/[id]/wordpress/settings.json.ts b/src/routes/services/[id]/wordpress/settings.json.ts
index 4f9c1f9b2c..cee85bc41e 100644
--- a/src/routes/services/[id]/wordpress/settings.json.ts
+++ b/src/routes/services/[id]/wordpress/settings.json.ts
@@ -8,7 +8,6 @@ import type { ComposeFile } from '$lib/types/composeFile';
import type { RequestHandler } from '@sveltejs/kit';
import cuid from 'cuid';
import fs from 'fs/promises';
-import getPort, { portNumbers } from 'get-port';
import yaml from 'js-yaml';
export const post: RequestHandler = async (event) => {