diff --git a/src/lib/buildPacks/python.ts b/src/lib/buildPacks/python.ts index fc5e8738b..edced9c20 100644 --- a/src/lib/buildPacks/python.ts +++ b/src/lib/buildPacks/python.ts @@ -34,7 +34,10 @@ const createDockerfile = async (data, image): Promise => { } if (pythonWSGI?.toLowerCase() === 'gunicorn') { Dockerfile.push(`RUN pip install gunicorn`); - } else if (pythonWSGI?.toLowerCase() === 'uwsgi') { + } else if (pythonWSGI?.toLowerCase() === "uvicorn") { + Dockerfile.push(`RUN pip install uvicorn`); + } + else if (pythonWSGI?.toLowerCase() === 'uwsgi') { Dockerfile.push(`RUN apk add --no-cache uwsgi-python3`); // Dockerfile.push(`RUN pip install --no-cache-dir uwsgi`) } @@ -49,8 +52,12 @@ const createDockerfile = async (data, image): Promise => { Dockerfile.push(`COPY .${baseDirectory || ''} ./`); Dockerfile.push(`EXPOSE ${port}`); if (pythonWSGI?.toLowerCase() === 'gunicorn') { - Dockerfile.push(`CMD gunicorn -w=4 -b=0.0.0.0:8000 ${pythonModule}:${pythonVariable}`); - } else if (pythonWSGI?.toLowerCase() === 'uwsgi') { + Dockerfile.push(`CMD gunicorn ${pythonModule}:${pythonVariable}`); + } else if (pythonWSGI?.toLowerCase() === "uvicorn") { + Dockerfile.push(`CMD uvicorn ${pythonModule}:${pythonVariable} --reload --port ${port}`); + + } + else if (pythonWSGI?.toLowerCase() === 'uwsgi') { Dockerfile.push( `CMD uwsgi --master -p 4 --http-socket 0.0.0.0:8000 --uid uwsgi --plugins python3 --protocol uwsgi --wsgi ${pythonModule}:${pythonVariable}` ); diff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelte index aec49c09a..134f02467 100644 --- a/src/routes/applications/[id]/index.svelte +++ b/src/routes/applications/[id]/index.svelte @@ -45,9 +45,9 @@ import Explainer from '$lib/components/Explainer.svelte'; import Setting from '$lib/components/Setting.svelte'; import type Prisma from '@prisma/client'; - import { getDomain, notNodeDeployments, staticDeployments } from '$lib/components/common'; + import { notNodeDeployments, staticDeployments } from '$lib/components/common'; import { toast } from '@zerodevx/svelte-toast'; - import { get, post } from '$lib/api'; + import { post } from '$lib/api'; import cuid from 'cuid'; import { browser } from '$app/env'; import { disabledButton } from '$lib/store'; @@ -63,10 +63,6 @@ let dualCerts = application.settings.dualCerts; let autodeploy = application.settings.autodeploy; - let nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, ''); - let isNonWWWDomainOK = false; - let isWWWDomainOK = false; - let wsgis = [ { value: 'None', @@ -75,6 +71,10 @@ { value: 'Gunicorn', label: 'Gunicorn' + }, + { + value: 'Uvicorn', + label: 'Uvicorn' } ]; function containerClass() { @@ -131,31 +131,13 @@ async function handleSubmit() { loading = true; try { - nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, ''); - await post(`/applications/${id}/check.json`, { - fqdn: application.fqdn, - forceSave, - dualCerts, - exposePort: application.exposePort - }); + await post(`/applications/${id}/check.json`, { fqdn: application.fqdn, forceSave }); await post(`/applications/${id}.json`, { ...application }); $disabledButton = false; - forceSave = false; return toast.push('Configurations saved.'); } catch ({ error }) { if (error?.startsWith($t('application.dns_not_set_partial_error'))) { forceSave = true; - if (dualCerts) { - isNonWWWDomainOK = await isDNSValid(getDomain(nonWWWDomain), false); - isWWWDomainOK = await isDNSValid(getDomain(`www.${nonWWWDomain}`), true); - } else { - const isWWW = getDomain(application.fqdn).includes('www.'); - if (isWWW) { - isWWWDomainOK = await isDNSValid(getDomain(`www.${nonWWWDomain}`), true); - } else { - isNonWWWDomainOK = await isDNSValid(getDomain(nonWWWDomain), false); - } - } } return errorNotification(error); } finally { @@ -173,19 +155,6 @@ application.baseBuildImage = event.detail.value; await handleSubmit(); } - - async function isDNSValid(domain, isWWW) { - try { - await get(`/applications/${id}/check.json?domain=${domain}`); - toast.push('DNS configuration is valid.'); - isWWW ? (isWWWDomainOK = true) : (isNonWWWDomainOK = true); - return true; - } catch ({ error }) { - errorNotification(error); - isWWW ? (isWWWDomainOK = false) : (isNonWWWDomainOK = false); - return false; - } - }
@@ -358,26 +327,24 @@ />
- {#if application.buildPack !== 'docker'} -
- -
-
- {/if} + +
{#if application.buildCommand || application.buildPack === 'rust' || application.buildPack === 'laravel'}
-
- - {#if forceSave} -
- {#if isNonWWWDomainOK} - - {:else} - - {/if} - {#if dualCerts} - {#if isWWWDomainOK} - - {:else} - - {/if} - {/if} -
- {/if} -
+
{#if application.buildPack === 'python'}
- +
+
+ {/if} {/if} {#if !staticDeployments.includes(application.buildPack)}
@@ -523,24 +468,9 @@ />
{/if} - {#if application.buildPack !== 'docker'} -
- - -
Useful if you would like to use your own reverse proxy or tunnel and also in development mode. Otherwise leave empty.'} - /> -
- {/if} + {#if !notNodeDeployments.includes(application.buildPack)} -
+
@@ -578,7 +508,7 @@
{/if} {#if application.buildPack === 'docker'} -
+