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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: remote haproxy password/etc
Andras Bacsai4b26aeef9ab0
diff --git a/apps/api/prisma/migrations/20221123122143_remote_haproxy_from_db/migration.sql b/apps/api/prisma/migrations/20221123122143_remote_haproxy_from_db/migration.sqlnew file mode 100644index 0000000000..1acf261a57--- /dev/null+++ b/apps/api/prisma/migrations/20221123122143_remote_haproxy_from_db/migration.sql@@ -0,0 +1,37 @@+/*+ Warnings:++ - You are about to drop the column `proxyHash` on the `Setting` table. All the data in the column will be lost.+ - You are about to drop the column `proxyPassword` on the `Setting` table. All the data in the column will be lost.+ - You are about to drop the column `proxyUser` on the `Setting` table. All the data in the column will be lost.++*/+-- RedefineTables+PRAGMA foreign_keys=OFF;+CREATE TABLE "new_Setting" (+ "id" TEXT NOT NULL PRIMARY KEY,+ "fqdn" TEXT,+ "dualCerts" BOOLEAN NOT NULL DEFAULT false,+ "minPort" INTEGER NOT NULL DEFAULT 9000,+ "maxPort" INTEGER NOT NULL DEFAULT 9100,+ "DNSServers" TEXT,+ "ipv4" TEXT,+ "ipv6" TEXT,+ "arch" TEXT,+ "concurrentBuilds" INTEGER NOT NULL DEFAULT 1,+ "applicationStoragePathMigrationFinished" BOOLEAN NOT NULL DEFAULT false,+ "proxyDefaultRedirect" TEXT,+ "isAPIDebuggingEnabled" BOOLEAN DEFAULT false,+ "isRegistrationEnabled" BOOLEAN NOT NULL DEFAULT false,+ "isAutoUpdateEnabled" BOOLEAN NOT NULL DEFAULT false,+ "isDNSCheckEnabled" BOOLEAN NOT NULL DEFAULT true,+ "isTraefikUsed" BOOLEAN NOT NULL DEFAULT true,+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "updatedAt" DATETIME NOT NULL+);+INSERT INTO "new_Setting" ("DNSServers", "applicationStoragePathMigrationFinished", "arch", "concurrentBuilds", "createdAt", "dualCerts", "fqdn", "id", "ipv4", "ipv6", "isAPIDebuggingEnabled", "isAutoUpdateEnabled", "isDNSCheckEnabled", "isRegistrationEnabled", "isTraefikUsed", "maxPort", "minPort", "proxyDefaultRedirect", "updatedAt") SELECT "DNSServers", "applicationStoragePathMigrationFinished", "arch", "concurrentBuilds", "createdAt", "dualCerts", "fqdn", "id", "ipv4", "ipv6", "isAPIDebuggingEnabled", "isAutoUpdateEnabled", "isDNSCheckEnabled", "isRegistrationEnabled", "isTraefikUsed", "maxPort", "minPort", "proxyDefaultRedirect", "updatedAt" FROM "Setting";+DROP TABLE "Setting";+ALTER TABLE "new_Setting" RENAME TO "Setting";+CREATE UNIQUE INDEX "Setting_fqdn_key" ON "Setting"("fqdn");+PRAGMA foreign_key_check;+PRAGMA foreign_keys=ON;diff --git a/apps/api/prisma/schema.prisma b/apps/api/prisma/schema.prismaindex 49d40694d2..d7bcc3c93b 100644--- a/apps/api/prisma/schema.prisma+++ b/apps/api/prisma/schema.prisma@@ -21,26 +21,23 @@ model Certificate {model Setting {id String @id @default(cuid())fqdn String? @unique- isAPIDebuggingEnabled Boolean? @default(false)- isRegistrationEnabled Boolean @default(false)dualCerts Boolean @default(false)minPort Int @default(9000)maxPort Int @default(9100)- proxyPassword String- proxyUser String- proxyHash String?- proxyDefaultRedirect String?- isAutoUpdateEnabled Boolean @default(false)- isDNSCheckEnabled Boolean @default(true)DNSServers String?- isTraefikUsed Boolean @default(true)- createdAt DateTime @default(now())- updatedAt DateTime @updatedAtipv4 String?ipv6 String?arch String?concurrentBuilds Int @default(1)applicationStoragePathMigrationFinished Boolean @default(false)+ proxyDefaultRedirect String?+ isAPIDebuggingEnabled Boolean? @default(false)+ isRegistrationEnabled Boolean @default(false)+ isAutoUpdateEnabled Boolean @default(false)+ isDNSCheckEnabled Boolean @default(true)+ isTraefikUsed Boolean @default(true)+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt}model User {diff --git a/apps/api/prisma/seed.js b/apps/api/prisma/seed.jsindex 39240123cf..d1ff11fb33 100644--- a/apps/api/prisma/seed.js+++ b/apps/api/prisma/seed.js@@ -1,18 +1,8 @@const dotEnvExtended = require('dotenv-extended');dotEnvExtended.load();const crypto = require('crypto');-const generator = require('generate-password');-const cuid = require('cuid');const { PrismaClient } = require('@prisma/client');const prisma = new PrismaClient();--function generatePassword(length = 24) {- return generator.generate({- length,- numbers: true,- strict: true- });-}const algorithm = 'aes-256-ctr';async function main() {@@ -22,8 +12,6 @@ async function main() {await prisma.setting.create({data: {isRegistrationEnabled: true,- proxyPassword: encrypt(generatePassword()),- proxyUser: cuid(),arch: process.arch,DNSServers: '1.1.1.1,8.8.8.8'}diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.tsindex 41f991b894..712d2254a1 100644--- a/apps/api/src/lib/common.ts+++ b/apps/api/src/lib/common.ts@@ -714,9 +714,7 @@ export async function stopTraefikProxy(}export async function listSettings(): Promise<any> {- const settings = await prisma.setting.findFirst({});- if (settings.proxyPassword) settings.proxyPassword = decrypt(settings.proxyPassword);- return settings;+ return await prisma.setting.findFirst({});}export function generateToken() {diff --git a/apps/api/src/routes/api/v1/sources/handlers.ts b/apps/api/src/routes/api/v1/sources/handlers.tsindex b67ab7eb42..e336525717 100644--- a/apps/api/src/routes/api/v1/sources/handlers.ts+++ b/apps/api/src/routes/api/v1/sources/handlers.ts@@ -37,9 +37,7 @@ export async function getSource(request: FastifyRequest<OnlyId>) {try {const { id } = request.paramsconst { teamId } = request.user-const settings = await prisma.setting.findFirst({});- if (settings.proxyPassword) settings.proxyPassword = decrypt(settings.proxyPassword);if (id === 'new') {return {