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: fqdn or expose port required

Andras Bacsaidbd16e82858a
diff --git a/apps/api/src/routes/api/v1/applications/handlers.ts b/apps/api/src/routes/api/v1/applications/handlers.ts
index 3f71c6fd5d..85f35a7b74 100644
--- a/apps/api/src/routes/api/v1/applications/handlers.ts
+++ b/apps/api/src/routes/api/v1/applications/handlers.ts
@@ -500,11 +500,15 @@ export async function checkDomain(request: FastifyRequest<CheckDomain>) {
}
export async function checkDNS(request: FastifyRequest<CheckDNS>) {
try {
+
const { id } = request.params
let { exposePort, fqdn, forceSave, dualCerts } = request.body
-
- if (fqdn) fqdn = fqdn.toLowerCase();
+ if (!fqdn) {
+ return {}
+ } else {
+ fqdn = fqdn.toLowerCase();
+ }
if (exposePort) exposePort = Number(exposePort);
const { destinationDocker: { id: dockerId, remoteIpAddress, remoteEngine }, exposePort: configuredPort } = await prisma.application.findUnique({ where: { id }, include: { destinationDocker: true } })
diff --git a/apps/ui/src/lib/store.ts b/apps/ui/src/lib/store.ts
index cbe906d513..eac6867572 100644
--- a/apps/ui/src/lib/store.ts
+++ b/apps/ui/src/lib/store.ts
@@ -45,6 +45,17 @@ export const appSession: Writable<AppSession> = writable({
supportedServiceTypesAndVersions: []
});
export const disabledButton: Writable<boolean> = writable(false);
+export const isDeploymentEnabled: Writable<boolean> = writable(false);
+export function checkIfDeploymentEnabledApplications(isAdmin: boolean, application: any) {
+ return (
+ isAdmin &&
+ (application.fqdn || (application.settings.isBot && application.exposePort)) &&
+ application.gitSource &&
+ application.repository &&
+ application.destinationDocker &&
+ application.buildPack
+ );
+}
export const status: Writable<any> = writable({
application: {
isRunning: false,
diff --git a/apps/ui/src/routes/applications/[id]/__layout.svelte b/apps/ui/src/routes/applications/[id]/__layout.svelte
index e69a6fe8a1..7ede7832b9 100644
--- a/apps/ui/src/routes/applications/[id]/__layout.svelte
+++ b/apps/ui/src/routes/applications/[id]/__layout.svelte
@@ -60,23 +60,26 @@
import { goto } from '$app/navigation';
import { onDestroy, onMount } from 'svelte';
import { t } from '$lib/translations';
- import { appSession, disabledButton, status, location, setLocation, addToast } from '$lib/store';
+ import {
+ appSession,
+ status,
+ location,
+ setLocation,
+ addToast,
+ isDeploymentEnabled,
+ checkIfDeploymentEnabledApplications
+ } from '$lib/store';
import { errorNotification, handlerNotFoundLoad } from '$lib/common';
import Tooltip from '$lib/components/Tooltip.svelte';
let statusInterval: any;
let forceDelete = false;
- $disabledButton =
- !$appSession.isAdmin ||
- (!application.fqdn && !application.settings.isBot) ||
- !application.gitSource ||
- !application.repository ||
- !application.destinationDocker ||
- !application.buildPack;
-
const { id } = $page.params;
+ $isDeploymentEnabled = checkIfDeploymentEnabledApplications($appSession.isAdmin, application);
+
async function handleDeploySubmit(forceRebuild = false) {
+ if (!$isDeploymentEnabled) return;
try {
const { buildId } = await post(`/applications/${id}/deploy`, {
...application,
@@ -214,7 +217,7 @@
{#if $status.application.isExited}
<a
id="applicationerror"
- href={!$disabledButton ? `/applications/${id}/logs` : null}
+ href={$isDeploymentEnabled ? `/applications/${id}/logs` : null}
class="icons bg-transparent text-sm flex items-center text-error"
sveltekit:prefetch
>
@@ -266,7 +269,7 @@
id="stop"
on:click={stopApplication}
type="submit"
- disabled={$disabledButton}
+ disabled={!$isDeploymentEnabled}
class="icons bg-transparent text-sm flex items-center space-x-2 text-error"
>
<svg
@@ -290,7 +293,7 @@
id="restart"
on:click={restartApplication}
type="submit"
- disabled={$disabledButton}
+ disabled={!$isDeploymentEnabled}
class="icons bg-transparent text-sm flex items-center space-x-2"
>
<svg
@@ -314,7 +317,7 @@
<button
id="forceredeploy"
type="submit"
- disabled={$disabledButton}
+ disabled={!$isDeploymentEnabled}
class="icons bg-transparent text-sm flex items-center space-x-2"
>
<svg
@@ -341,7 +344,7 @@
<button
id="deploy"
type="submit"
- disabled={$disabledButton}
+ disabled={!$isDeploymentEnabled}
class="icons bg-transparent text-sm flex items-center space-x-2 text-success"
>
<svg
@@ -364,14 +367,17 @@
<div class="border border-coolgray-500 h-8" />
<a
- id="configurations"
- href={!$disabledButton ? `/applications/${id}` : null}
+ href={$isDeploymentEnabled ? `/applications/${id}` : null}
sveltekit:prefetch
class="hover:text-yellow-500 rounded"
class:text-yellow-500={$page.url.pathname === `/applications/${id}`}
class:bg-coolgray-500={$page.url.pathname === `/applications/${id}`}
>
- <button disabled={$disabledButton} class="icons bg-transparent text-sm">
+ <button
+ disabled={!$isDeploymentEnabled}
+ id="configurations"
+ class="icons bg-transparent text-sm"
+ >
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
@@ -396,14 +402,13 @@
></a
>
<a
- id="secrets"
- href={!$disabledButton ? `/applications/${id}/secrets` : null}
+ href={$isDeploymentEnabled ? `/applications/${id}/secrets` : null}
sveltekit:prefetch
class="hover:text-pink-500 rounded"
class:text-pink-500={$page.url.pathname === `/applications/${id}/secrets`}
class:bg-coolgray-500={$page.url.pathname === `/applications/${id}/secrets`}
>
- <button disabled={$disabledButton} class="icons bg-transparent text-sm">
+ <button id="secrets" disabled={!$isDeploymentEnabled} class="icons bg-transparent text-sm">
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
@@ -424,14 +429,17 @@
></a
>
<a
- id="persistentstorages"
- href={!$disabledButton ? `/applications/${id}/storages` : null}
+ href={$isDeploymentEnabled ? `/applications/${id}/storages` : null}
sveltekit:prefetch
class="hover:text-pink-500 rounded"
class:text-pink-500={$page.url.pathname === `/applications/${id}/storages`}
class:bg-coolgray-500={$page.url.pathname === `/applications/${id}/storages`}
>
- <button disabled={$disabledButton} class="icons bg-transparent text-sm">
+ <button
+ id="persistentstorages"
+ disabled={!$isDeploymentEnabled}
+ class="icons bg-transparent text-sm"
+ >
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
@@ -451,14 +459,13 @@
>
{#if !application.settings.isBot}
<a
- id="previews"
- href={!$disabledButton ? `/applications/${id}/previews` : null}
+ href={$isDeploymentEnabled ? `/applications/${id}/previews` : null}
sveltekit:prefetch
class="hover:text-orange-500 rounded"
class:text-orange-500={$page.url.pathname === `/applications/${id}/previews`}
class:bg-coolgray-500={$page.url.pathname === `/applications/${id}/previews`}
>
- <button disabled={$disabledButton} class="icons bg-transparent text-sm">
+ <button id="previews" disabled={!$isDeploymentEnabled} class="icons bg-transparent text-sm">
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
@@ -481,15 +488,15 @@
{/if}
<div class="border border-coolgray-500 h-8" />
<a
- id="applicationlogs"
- href={!$disabledButton && $status.application.isRunning ? `/applications/${id}/logs` : null}
+ href={$isDeploymentEnabled && $status.application.isRunning ? `/applications/${id}/logs` : null}
sveltekit:prefetch
class="hover:text-sky-500 rounded"
class:text-sky-500={$page.url.pathname === `/applications/${id}/logs`}
class:bg-coolgray-500={$page.url.pathname === `/applications/${id}/logs`}
>
<button
- disabled={$disabledButton || !$status.application.isRunning}
+ id="applicationlogs"
+ disabled={!$isDeploymentEnabled || !$status.application.isRunning}
class="icons bg-transparent text-sm"
>
<svg
@@ -512,14 +519,13 @@
</button></a
>
<a
- id="buildlogs"
- href={!$disabledButton ? `/applications/${id}/logs/build` : null}
+ href={$isDeploymentEnabled ? `/applications/${id}/logs/build` : null}
sveltekit:prefetch
class="hover:text-red-500 rounded"
class:text-red-500={$page.url.pathname === `/applications/${id}/logs/build`}
class:bg-coolgray-500={$page.url.pathname === `/applications/${id}/logs/build`}
>
- <button disabled={$disabledButton} class="icons bg-transparent text-sm">
+ <button id="buildlogs" disabled={!$isDeploymentEnabled} class="icons bg-transparent text-sm">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
diff --git a/apps/ui/src/routes/applications/[id]/index.svelte b/apps/ui/src/routes/applications/[id]/index.svelte
index 8641d9c8f2..51f171fa42 100644
--- a/apps/ui/src/routes/applications/[id]/index.svelte
+++ b/apps/ui/src/routes/applications/[id]/index.svelte
@@ -34,13 +34,20 @@
import { get, post } from '$lib/api';
import cuid from 'cuid';
- import { addToast, appSession, disabledButton, setLocation, status } from '$lib/store';
+ import {
+ addToast,
+ appSession,
+ checkIfDeploymentEnabledApplications,
+ setLocation,
+ status,
+ isDeploymentEnabled
+ } from '$lib/store';
import { t } from '$lib/translations';
import { errorNotification, getDomain, notNodeDeployments, staticDeployments } from '$lib/common';
import Setting from '$lib/components/Setting.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import Explainer from '$lib/components/Explainer.svelte';
-
+
const { id } = $page.params;
$: isDisabled =
@@ -64,6 +71,7 @@
let dualCerts = application.settings.dualCerts;
let autodeploy = application.settings.autodeploy;
let isBot = application.settings.isBot;
+ let isDBBranching = application.settings.isDBBranching;
let nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, '');
let isNonWWWDomainOK = false;
@@ -162,6 +170,10 @@
application.settings.isBot = isBot;
setLocation(application, settings);
}
+ if (name === 'isDBBranching') {
+ isDBBranching = !isDBBranching;
+ application.settings.isDBBranching = isDBBranching;
+ }
try {
await post(`/applications/${id}/settings`, {
previews,
@@ -193,13 +205,15 @@
isBot = !isBot;
}
return errorNotification(error);
+ } finally {
+ $isDeploymentEnabled = checkIfDeploymentEnabledApplications($appSession.isAdmin, application);
}
}
async function handleSubmit() {
- if (loading || (!application.fqdn && !isBot)) return;
+ if (loading) return;
loading = true;
try {
- nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, '');
+ nonWWWDomain = application.fqdn != null && getDomain(application.fqdn).replace(/^www\./, '');
if (application.deploymentType)
application.deploymentType = application.deploymentType.toLowerCase();
!isBot &&
@@ -211,8 +225,10 @@
}));
await post(`/applications/${id}`, { ...application });
setLocation(application, settings);
- $disabledButton = false;
+ $isDeploymentEnabled = checkIfDeploymentEnabledApplications($appSession.isAdmin, application);
+
forceSave = false;
+
addToast({
message: 'Configuration saved.',
type: 'success'
@@ -551,7 +567,6 @@
disabled={isDisabled}
name="fqdn"
id="fqdn"
- required
bind:value={application.fqdn}
pattern="^https?://([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{'{'}2,{'}'}$"
placeholder="eg: https://coollabs.io"
@@ -831,6 +846,16 @@
/>
</div>
{/if}
+ <div class="grid grid-cols-2 items-center">
+ <Setting
+ id="isDBBranching"
+ isCenter={false}
+ bind:setting={isDBBranching}
+ on:click={() => changeSettings('isDBBranching')}
+ title="Enable DB Branching"
+ description="Enable DB Branching"
+ />
+ </div>
<div class="grid grid-cols-2 items-center">
<Setting
id="debug"