Compare commits

...

10 Commits

Author SHA1 Message Date
Andras Bacsai
c63237684a fix: Hostname issue 2022-07-06 20:04:16 +02:00
Andras Bacsai
792d51d93f fix: trustProxy for Fastify 2022-07-06 19:34:16 +02:00
Andras Bacsai
62bfb5dacc fix: Domain check 2022-07-06 19:04:54 +02:00
Andras Bacsai
d7fa80703d fix: Domain check 2022-07-06 19:04:40 +02:00
Andras Bacsai
52b712d90b fix: new destinations 2022-07-06 16:42:31 +02:00
Andras Bacsai
331e13b7cb fix: include post 2022-07-06 16:13:11 +02:00
Andras Bacsai
64bb4a2525 fix: new destination can be created 2022-07-06 15:52:00 +02:00
Andras Bacsai
31d7e7e806 fix: forgot that the version bump changed 😅 2022-07-06 13:46:00 +02:00
Andras Bacsai
e740788d6c chore: version++ 2022-07-06 11:49:53 +02:00
Andras Bacsai
928d53e532 fix: Seeding 2022-07-06 11:49:07 +02:00
12 changed files with 37 additions and 20 deletions

View File

@@ -23,7 +23,8 @@ async function main() {
await prisma.setting.create({ await prisma.setting.create({
data: { data: {
isRegistrationEnabled: true, isRegistrationEnabled: true,
isTraefikUsed: true, proxyPassword: encrypt(generatePassword()),
proxyUser: cuid()
} }
}); });
} else { } else {
@@ -72,4 +73,16 @@ main()
}) })
.finally(async () => { .finally(async () => {
await prisma.$disconnect(); await prisma.$disconnect();
}); });
const encrypt = (text) => {
if (text) {
const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv(algorithm, process.env['COOLIFY_SECRET_KEY'], iv);
const encrypted = Buffer.concat([cipher.update(text), cipher.final()]);
return JSON.stringify({
iv: iv.toString('hex'),
content: encrypted.toString('hex')
});
}
};

View File

@@ -26,7 +26,8 @@ declare module 'fastify' {
const port = isDev ? 3001 : 3000; const port = isDev ? 3001 : 3000;
const host = '0.0.0.0'; const host = '0.0.0.0';
const fastify = Fastify({ const fastify = Fastify({
logger: false logger: false,
trustProxy: true
}); });
const schema = { const schema = {
type: 'object', type: 'object',

View File

@@ -23,7 +23,7 @@ const customConfig: Config = {
length: 3 length: 3
}; };
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
export const version = '3.0.0'; export const version = '3.0.3';
export const defaultProxyImage = `coolify-haproxy-alpine:latest`; export const defaultProxyImage = `coolify-haproxy-alpine:latest`;
export const defaultProxyImageTcp = `coolify-haproxy-tcp-alpine:latest`; export const defaultProxyImageTcp = `coolify-haproxy-tcp-alpine:latest`;
@@ -209,7 +209,7 @@ export async function checkDomainsIsValidInDNS({ hostname, fqdn, dualCerts }): P
resolves = await dns.resolve4(hostname); resolves = await dns.resolve4(hostname);
} }
} catch (error) { } catch (error) {
throw `DNS not set correctly or propogated.<br>Please check your DNS settings.` throw { status: 500, message: `Could not determine IP address for ${hostname}.` }
} }
if (dualCerts) { if (dualCerts) {
@@ -231,9 +231,9 @@ export async function checkDomainsIsValidInDNS({ hostname, fqdn, dualCerts }): P
} }
} }
if (ipDomainFound && ipDomainDualCertFound) return { status: 200 }; if (ipDomainFound && ipDomainDualCertFound) return { status: 200 };
throw false; throw { status: 500, message: `DNS not set correctly or propogated.<br>Please check your DNS settings.` }
} catch (error) { } catch (error) {
throw `DNS not set correctly or propogated.<br>Please check your DNS settings.` throw { status: 500, message: `DNS not set correctly or propogated.<br>Please check your DNS settings.` }
} }
} else { } else {
try { try {
@@ -245,9 +245,9 @@ export async function checkDomainsIsValidInDNS({ hostname, fqdn, dualCerts }): P
} }
} }
if (ipDomainFound) return { status: 200 }; if (ipDomainFound) return { status: 200 };
throw false; throw { status: 500, message: `DNS not set correctly or propogated.<br>Please check your DNS settings.` }
} catch (error) { } catch (error) {
throw `DNS not set correctly or propogated.<br>Please check your DNS settings.` throw { status: 500, message: `DNS not set correctly or propogated.<br>Please check your DNS settings.` }
} }
} }
} }

View File

@@ -324,7 +324,7 @@ export async function checkDNS(request: FastifyRequest<CheckDNS>) {
} }
} }
if (isDNSCheckEnabled && !isDev && !forceSave) { if (isDNSCheckEnabled && !isDev && !forceSave) {
return await checkDomainsIsValidInDNS({ hostname: request.hostname, fqdn, dualCerts }); return await checkDomainsIsValidInDNS({ hostname: request.hostname.split(':')[0], fqdn, dualCerts });
} }
return {} return {}
} catch ({ status, message }) { } catch ({ status, message }) {

View File

@@ -43,7 +43,7 @@ export async function getDestination(request: FastifyRequest) {
const destination = await prisma.destinationDocker.findFirst({ const destination = await prisma.destinationDocker.findFirst({
where: { id, teams: { some: { id: teamId === '0' ? undefined : teamId } } } where: { id, teams: { some: { id: teamId === '0' ? undefined : teamId } } }
}); });
if (!destination) { if (!destination && id !== 'new') {
throw { status: 404, message: `Destination not found.` }; throw { status: 404, message: `Destination not found.` };
} }
const settings = await listSettings(); const settings = await listSettings();
@@ -62,10 +62,7 @@ export async function getDestination(request: FastifyRequest) {
// // await saveSshKey(destination); // // await saveSshKey(destination);
// payload.state = await checkContainer(engine, 'coolify-haproxy'); // payload.state = await checkContainer(engine, 'coolify-haproxy');
} else { } else {
let containerName = 'coolify-proxy'; const containerName = 'coolify-proxy';
if (!settings.isTraefikUsed) {
containerName = 'coolify-haproxy';
}
payload.state = payload.state =
destination?.engine && (await checkContainer(destination.engine, containerName)); destination?.engine && (await checkContainer(destination.engine, containerName));
} }

View File

@@ -67,7 +67,7 @@ export async function checkDomain(request: FastifyRequest, reply: FastifyReply)
throw "Domain already configured"; throw "Domain already configured";
} }
if (isDNSCheckEnabled && !forceSave) { if (isDNSCheckEnabled && !forceSave) {
return await checkDomainsIsValidInDNS({ hostname: request.hostname, fqdn, dualCerts }); return await checkDomainsIsValidInDNS({ hostname: request.hostname.split(':')[0], fqdn, dualCerts });
} }
return {}; return {};
} catch ({ status, message }) { } catch ({ status, message }) {

View File

@@ -18,7 +18,7 @@ interface AppSession {
} }
export const loginEmail: Writable<string | undefined> = writable() export const loginEmail: Writable<string | undefined> = writable()
export const appSession: Writable<AppSession> = writable({ export const appSession: Writable<AppSession> = writable({
version: '3.0.0', version: '3.0.3',
userId: null, userId: null,
teamId: null, teamId: null,
permission: 'read', permission: 'read',

View File

@@ -136,6 +136,8 @@
statusInterval = setInterval(async () => { statusInterval = setInterval(async () => {
await getStatus(); await getStatus();
}, 2000); }, 2000);
} else {
$status.application.initialLoading = false;
} }
}); });
</script> </script>

View File

@@ -126,6 +126,8 @@
statusInterval = setInterval(async () => { statusInterval = setInterval(async () => {
await getStatus(); await getStatus();
}, 2000); }, 2000);
} else {
$status.database.initialLoading = false;
} }
}); });
</script> </script>

View File

@@ -22,7 +22,7 @@
import { t } from '$lib/translations'; import { t } from '$lib/translations';
import { appSession } from '$lib/store'; import { appSession } from '$lib/store';
import { get } from '$lib/api'; import { get, post } from '$lib/api';
const ownDestinations = destinations.filter((destination) => { const ownDestinations = destinations.filter((destination) => {
if (destination.teams[0].id === $appSession.teamId) { if (destination.teams[0].id === $appSession.teamId) {
@@ -39,7 +39,7 @@
<div class="flex space-x-1 p-6 font-bold"> <div class="flex space-x-1 p-6 font-bold">
<div class="mr-4 text-2xl tracking-tight">{$t('index.destinations')}</div> <div class="mr-4 text-2xl tracking-tight">{$t('index.destinations')}</div>
{#if $appSession.isAdmin} {#if $appSession.isAdmin}
<a href="/destinations/new" class="add-icon bg-sky-600 hover:bg-sky-500"> <a href="/destinations/new" class="add-icon bg-sky-600 hover:bg-sky-500">
<svg <svg
class="w-6" class="w-6"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"

View File

@@ -135,6 +135,8 @@
statusInterval = setInterval(async () => { statusInterval = setInterval(async () => {
await getStatus(); await getStatus();
}, 2000); }, 2000);
} else {
$status.service.initialLoading = false;
} }
}); });
</script> </script>

View File

@@ -1,6 +1,6 @@
{ {
"name": "coolify", "name": "coolify",
"version": "3.0.0", "version": "3.0.3",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {