commit
c370fba9ba
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "coolify",
|
"name": "coolify",
|
||||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||||
"version": "2.0.19",
|
"version": "2.0.20",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
|
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
|
||||||
|
@ -79,7 +79,7 @@ export async function login({ email, password }) {
|
|||||||
create: {
|
create: {
|
||||||
id: uid,
|
id: uid,
|
||||||
name: uniqueName(),
|
name: uniqueName(),
|
||||||
destinationDocker: { connect: { network: cuid() } }
|
destinationDocker: { connect: { network: 'coolify' } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
permission: { create: { teamId: uid, permission: 'owner' } }
|
permission: { create: { teamId: uid, permission: 'owner' } }
|
||||||
|
@ -1,24 +1,47 @@
|
|||||||
import { asyncExecShell, getDomain, getEngine, getUserDetails } from '$lib/common';
|
import { dev } from '$app/env';
|
||||||
|
import { getDomain, getUserDetails } from '$lib/common';
|
||||||
import * as db from '$lib/database';
|
import * as db from '$lib/database';
|
||||||
import { ErrorHandler } from '$lib/database';
|
import { ErrorHandler } from '$lib/database';
|
||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
|
import { promises as dns } from 'dns';
|
||||||
|
|
||||||
export const post: RequestHandler = async (event) => {
|
export const post: RequestHandler = async (event) => {
|
||||||
const { status, body } = await getUserDetails(event);
|
const { status, body } = await getUserDetails(event);
|
||||||
if (status === 401) return { status, body };
|
if (status === 401) return { status, body };
|
||||||
|
|
||||||
const { id } = event.params;
|
const { id } = event.params;
|
||||||
|
let { fqdn, forceSave } = await event.request.json();
|
||||||
let { fqdn } = await event.request.json();
|
|
||||||
fqdn = fqdn.toLowerCase();
|
fqdn = fqdn.toLowerCase();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const domain = getDomain(fqdn);
|
||||||
const found = await db.isDomainConfigured({ id, fqdn });
|
const found = await db.isDomainConfigured({ id, fqdn });
|
||||||
if (found) {
|
if (found) {
|
||||||
throw {
|
throw {
|
||||||
message: `Domain ${getDomain(fqdn).replace('www.', '')} is already used.`
|
message: `Domain ${getDomain(fqdn).replace('www.', '')} is already used.`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (!dev && !forceSave) {
|
||||||
|
let ip = [];
|
||||||
|
let localIp = [];
|
||||||
|
dns.setServers(['1.1.1.1', '8.8.8.8']);
|
||||||
|
|
||||||
|
try {
|
||||||
|
localIp = await dns.resolve4(event.url.hostname);
|
||||||
|
} catch (error) {}
|
||||||
|
try {
|
||||||
|
ip = await dns.resolve4(domain);
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
if (localIp?.length > 0) {
|
||||||
|
if (ip?.length === 0 || !ip.includes(localIp[0])) {
|
||||||
|
throw {
|
||||||
|
message: `DNS not set or propogated for ${domain}.<br><br>Please check your DNS settings.`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: 200
|
status: 200
|
||||||
};
|
};
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
let domainEl: HTMLInputElement;
|
let domainEl: HTMLInputElement;
|
||||||
|
|
||||||
let loading = false;
|
let loading = false;
|
||||||
|
let forceSave = false;
|
||||||
let debug = application.settings.debug;
|
let debug = application.settings.debug;
|
||||||
let previews = application.settings.previews;
|
let previews = application.settings.previews;
|
||||||
let dualCerts = application.settings.dualCerts;
|
let dualCerts = application.settings.dualCerts;
|
||||||
@ -78,10 +79,13 @@
|
|||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
loading = true;
|
loading = true;
|
||||||
try {
|
try {
|
||||||
await post(`/applications/${id}/check.json`, { fqdn: application.fqdn });
|
await post(`/applications/${id}/check.json`, { fqdn: application.fqdn, forceSave });
|
||||||
await post(`/applications/${id}.json`, { ...application });
|
await post(`/applications/${id}.json`, { ...application });
|
||||||
return window.location.reload();
|
return window.location.reload();
|
||||||
} catch ({ error }) {
|
} catch ({ error }) {
|
||||||
|
if (error.startsWith('DNS not set')) {
|
||||||
|
forceSave = true;
|
||||||
|
}
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
@ -167,8 +171,11 @@
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class:bg-green-600={!loading}
|
class:bg-green-600={!loading}
|
||||||
|
class:bg-orange-600={forceSave}
|
||||||
class:hover:bg-green-500={!loading}
|
class:hover:bg-green-500={!loading}
|
||||||
disabled={loading}>{loading ? 'Saving...' : 'Save'}</button
|
class:hover:bg-orange-400={forceSave}
|
||||||
|
disabled={loading}
|
||||||
|
>{loading ? 'Saving...' : forceSave ? 'Are you sure to continue?' : 'Save'}</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@ -249,7 +256,7 @@
|
|||||||
<div class="flex-col">
|
<div class="flex-col">
|
||||||
<label for="fqdn" class="pt-2 text-base font-bold text-stone-100">Domain (FQDN)</label>
|
<label for="fqdn" class="pt-2 text-base font-bold text-stone-100">Domain (FQDN)</label>
|
||||||
<Explainer
|
<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."
|
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.<br><br><span class='text-white font-bold'>You must set your DNS to point to the server IP in advance.</span>"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="flex space-x-2 h-8 items-center justify-center pt-14">
|
<div class="flex space-x-2 h-8 items-center justify-center pt-8">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
@ -71,5 +71,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
{#if browser && window.location.host === 'demo.coolify.io'}
|
||||||
|
<div class="pt-5 font-bold">
|
||||||
|
Registration is <span class="text-pink-500">open</span>, just fill in an email (does not
|
||||||
|
need to be live email address for the demo instance) and a password.
|
||||||
|
</div>
|
||||||
|
<div class="pt-5 font-bold">
|
||||||
|
All users gets an <span class="text-pink-500">own namespace</span>, so you won't be able to
|
||||||
|
access other users data.
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +45,6 @@ export const del: RequestHandler = async (event) => {
|
|||||||
|
|
||||||
const { fqdn } = await event.request.json();
|
const { fqdn } = await event.request.json();
|
||||||
let ip;
|
let ip;
|
||||||
console.log(fqdn);
|
|
||||||
try {
|
try {
|
||||||
ip = await dns.resolve(fqdn);
|
ip = await dns.resolve(fqdn);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user