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.

code cleanup

Andras Bacsai3deff162bb17
diff --git a/src/lib/common.ts b/src/lib/common.ts
index 70fd7eebaf..b4b6966bcb 100644
--- a/src/lib/common.ts
+++ b/src/lib/common.ts
@@ -67,7 +67,6 @@ export const getTeam = (event) => {
};
export const getUserDetails = async (event, isAdminRequired = true) => {
- // try {
const teamId = getTeam(event);
const userId = event.locals.session.data.uid || null;
const { permission = 'read' } = await db.prisma.permission.findFirst({
@@ -91,18 +90,6 @@ export const getUserDetails = async (event, isAdminRequired = true) => {
}
return payload;
- // } catch (err) {
- // console.log(err);
- // return {
- // teamId: null,
- // userId: null,
- // permission: 'read',
- // status: 401,
- // body: {
- // message: 'You do not have permission to do this. \nAsk an admin to modify your permissions.'
- // }
- // };
- // }
};
export function getEngine(engine) {
diff --git a/src/lib/components/CopyPasswordField.svelte b/src/lib/components/CopyPasswordField.svelte
index 4237f6e8e3..ab43f48bd6 100644
--- a/src/lib/components/CopyPasswordField.svelte
+++ b/src/lib/components/CopyPasswordField.svelte
@@ -20,9 +20,6 @@
function showActions(value) {
actionsShow = value;
- // if (value === false) {
- // showPassword = false;
- // }
}
function copyToClipboard() {
if (isHttps && navigator.clipboard) {
diff --git a/src/lib/components/Setting.svelte b/src/lib/components/Setting.svelte
index 4a80e56ae5..b26e3e072e 100644
--- a/src/lib/components/Setting.svelte
+++ b/src/lib/components/Setting.svelte
@@ -6,7 +6,6 @@
export let description;
export let isPadding = true;
export let disabled = false;
- // export let disabledReason = '';
</script>
<li class="flex items-center py-4">
@@ -14,11 +13,6 @@
<p class="text-xs font-bold text-stone-100 md:text-base">{title}</p>
<Explainer text={description} />
</div>
- <!-- {#if disabled}
- <div class="flex" class:px-4={isPadding} class:pr-32={!isPadding}>
- <p class="text-xs font-bold text-stone-400">{disabledReason}</p>
- </div>
- {:else} -->
<div
type="button"
on:click
diff --git a/src/lib/database/destinations.ts b/src/lib/database/destinations.ts
index 4a8c46ef95..884600bfe4 100644
--- a/src/lib/database/destinations.ts
+++ b/src/lib/database/destinations.ts
@@ -109,22 +109,4 @@ export async function setDestinationSettings({ engine, isCoolifyProxyUsed }) {
where: { engine },
data: { isCoolifyProxyUsed }
});
-
- // if (isCoolifyProxyUsed) {
- // await installCoolifyProxy(engine)
- // await configureNetworkCoolifyProxy(engine)
- // } else {
- // // TODO: must check if other destination is using the proxy??? or not?
- // const domain = await prisma.setting.findUnique({ where: { name: 'domain' }, rejectOnNotFound: false })
- // if (!domain) {
- // await uninstallCoolifyProxy(engine)
- // } else {
- // return {
- // stastus: 500,
- // body: {
- // message: 'You can not disable the Coolify proxy while the domain is set for Coolify itself.'
- // }
- // }
- // }
- // }
}
diff --git a/src/lib/database/users.ts b/src/lib/database/users.ts
index 20b1a4aab6..5c99143a92 100644
--- a/src/lib/database/users.ts
+++ b/src/lib/database/users.ts
@@ -97,17 +97,6 @@ export async function login({ email, password }) {
});
}
}
-
- // const token = jsonwebtoken.sign({}, secretKey, {
- // expiresIn: 15778800,
- // algorithm: 'HS256',
- // audience: 'coolify',
- // issuer: 'coolify',
- // jwtid: uid,
- // subject: `User:${uid}`,
- // notBefore: -1000
- // });
-
return {
status: 200,
headers: {
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index 7679fe28f6..3199008fa2 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -188,94 +188,7 @@ export async function deleteProxy({ id }) {
await completeTransaction(transactionId);
}
}
-// export async function configureProxyForDatabase({ id, port, isPublic, privatePort }) {
-// const haproxy = await haproxyInstance()
-// try {
-// await checkHAProxy()
-// } catch (error) {
-// return
-// }
-// let alreadyConfigured = false
-// try {
-// const backend: any = await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json()
-// const server: any = await haproxy.get(`v2/services/haproxy/configuration/servers/${id}`, {
-// searchParams: {
-// backend: id
-// },
-// }).json()
-// if (backend.data.name === id) {
-// if (server.data.port === privatePort) {
-// if (server.data.check === 'enabled') {
-// if (server.data.address === id) {
-// alreadyConfigured = true
-// }
-// }
-// }
-// }
-// } catch (error) {
-// console.log('error getting backend or server', error.response.body)
-// }
-// if (alreadyConfigured) return
-
-// const transactionId = await getNextTransactionId()
-// try {
-// await haproxy.post('v2/services/haproxy/configuration/backends', {
-// searchParams: {
-// transaction_id: transactionId
-// },
-// json: {
-// "init-addr": "last,libc,none",
-// "mode": "tcp",
-// "name": id
-// }
-// })
-// await haproxy.post('v2/services/haproxy/configuration/servers', {
-// searchParams: {
-// transaction_id: transactionId,
-// backend: id
-// },
-// json: {
-// "address": id,
-// "check": "enabled",
-// "name": id,
-// "port": privatePort
-// }
-// })
-// await haproxy.post('v2/services/haproxy/configuration/frontends', {
-// searchParams: {
-// transaction_id: transactionId,
-// backend: id
-// },
-// json: {
-// "default_backend": id,
-// "mode": "tcp",
-// "name": id
-// }
-// })
-// await haproxy.post('v2/services/haproxy/configuration/binds', {
-// searchParams: {
-// transaction_id: transactionId,
-// frontend: id
-// },
-// json: {
-// "address": "*",
-// "name": id,
-// "port": port
-// }
-// })
-// } catch (error) {
-// console.log(error.response.body)
-// throw error.response.body
-// } finally {
-// try {
-// await completeTransaction(transactionId)
-// } catch (error) {
-// console.log(error.response.body)
-// }
-// }
-// await configureDatabaseVisibility({ id, isPublic })
-// }
export async function reloadHaproxy(engine) {
const host = getEngine(engine);
return await asyncExecShell(`DOCKER_HOST=${host} docker exec coolify-haproxy kill -HUP 1`);
diff --git a/src/lib/queues/builder.ts b/src/lib/queues/builder.ts
index aba494d92e..89513ebcf1 100644
--- a/src/lib/queues/builder.ts
+++ b/src/lib/queues/builder.ts
@@ -64,10 +64,6 @@ export default async function (job) {
if (destinationDockerId) {
destinationType = 'docker';
}
- // Not implemented yet
- // if (destinationKubernetesId) {
- // destinationType = 'kubernetes'
- // }
if (destinationType === 'docker') {
const docker = dockerInstance({ destinationDocker });
diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.ts
index e1889bd4fb..ebe154051c 100644
--- a/src/lib/queues/index.ts
+++ b/src/lib/queues/index.ts
@@ -144,28 +144,6 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
});
});
-// const letsEncryptQueueName = dev ? cuid() : 'letsencrypt_queue'
-// const letsEncryptQueue = new Queue(letsEncryptQueueName, connectionOptions)
-
-// const letsEncryptWorker = new Worker(letsEncryptQueueName, async (job) => await letsencrypt(job), {
-// concurrency: 1,
-// ...connectionOptions
-// })
-// letsEncryptWorker.on('completed', async () => {
-// // TODO: Save letsencrypt logs as build logs!
-// console.log('[DEBUG] Lets Encrypt job completed')
-// })
-
-// letsEncryptWorker.on('failed', async (job: Job, failedReason: string) => {
-// try {
-// await prisma.applicationSettings.updateMany({ where: { applicationId: job.data.id }, data: { forceSSL: false } })
-// } catch (error) {
-// console.log(error)
-// }
-// console.log('[DEBUG] Lets Encrypt job failed')
-// console.log(failedReason)
-// })
-
const buildLogQueueName = dev ? cuid() : 'log_queue';
const buildLogQueue = new Queue(buildLogQueueName, connectionOptions);
const buildLogWorker = new Worker(buildLogQueueName, async (job) => await logger(job), {
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte
index fa9ce0fe31..d8e185a137 100644
--- a/src/routes/__layout.svelte
+++ b/src/routes/__layout.svelte
@@ -124,25 +124,6 @@
updateStatus.success = false;
updateStatus.loading = false;
}
- // } else {
- // let reachable = false;
- // let tries = 0;
- // do {
- // await asyncSleep(1000);
- // try {
- // await get(`/undead.json`);
- // reachable = true;
- // } catch (error) {
- // console.log(error);
- // reachable = false;
- // }
- // if (reachable) break;
- // tries++;
- // } while (!reachable || tries < 120);
- // toast.push('New version reachable. Reloading...');
- // await asyncSleep(2000);
- // window.location.reload();
- // }
}
</script>
diff --git a/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte b/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte
index a97291debc..fb1dd602b0 100644
--- a/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte
+++ b/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte
@@ -142,14 +142,6 @@
return errorNotification('Branch already configured');
}
}
- // async function saveDeployKey(deployKeyId: number) {
- // try {
- // await post(updateDeployKeyIdUrl, { deployKeyId });
- // } catch (error) {
- // errorNotification(error);
- // throw new Error(error);
- // }
- // }
async function checkSSHKey(sshkeyUrl) {
try {
return await post(sshkeyUrl, {});
diff --git a/src/routes/databases/[id]/index.json.ts b/src/routes/databases/[id]/index.json.ts
index 1f08ab7e61..c9867c94f9 100644
--- a/src/routes/databases/[id]/index.json.ts
+++ b/src/routes/databases/[id]/index.json.ts
@@ -25,9 +25,7 @@ export const get: RequestHandler = async (event) => {
state = 'running';
}
} catch (error) {
- // if (!error.stderr.includes('No such object')) {
- // console.log(error)
- // }
+ //
}
}
const configuration = generateDatabaseConfiguration(database);
diff --git a/src/routes/services/[id]/index.json.ts b/src/routes/services/[id]/index.json.ts
index eefed08b05..58f9beaef6 100644
--- a/src/routes/services/[id]/index.json.ts
+++ b/src/routes/services/[id]/index.json.ts
@@ -46,24 +46,3 @@ export const get: RequestHandler = async (event) => {
return PrismaErrorHandler(error);
}
};
-
-// export const post: RequestHandler<Locals, FormData> = async (request) => {
-// const { teamId, status, body } = await getUserDetails(request);
-// if (status === 401) return { status, body }
-// const { id } = request.params
-
-// const name = request.body.get('name')
-// const defaultDatabase = request.body.get('defaultDatabase')
-// const dbUser = request.body.get('dbUser')
-// const dbUserPassword = request.body.get('dbUserPassword')
-// const rootUser = request.body.get('rootUser')
-// const rootUserPassword = request.body.get('rootUserPassword')
-// const version = request.body.get('version')
-
-// try {
-// return await db.updateDatabase({ id, name, defaultDatabase, dbUser, dbUserPassword, rootUser, rootUserPassword, version })
-// } catch (err) {
-// return err
-// }
-
-// }
diff --git a/src/routes/sources/[id]/_Gitlab.svelte b/src/routes/sources/[id]/_Gitlab.svelte
index 4530cc0e03..c95bbb1ba6 100644
--- a/src/routes/sources/[id]/_Gitlab.svelte
+++ b/src/routes/sources/[id]/_Gitlab.svelte
@@ -71,8 +71,6 @@
window.open(`${source.htmlUrl}/groups/${payload.groupName}/-/settings/applications`);
break;
case 'instance':
- // TODO: This is not correct
- // window.location.assign(`${source.htmlUrl}/-/profile/applications`);
break;
default:
break;