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.

fixes

Andras Bacsai513c4f9e2942
diff --git a/apps/api/prisma/migrations/20221129081832_fix_defaults/migration.sql b/apps/api/prisma/migrations/20221129081832_fix_defaults/migration.sql
new file mode 100644
index 0000000000..96f6de3fb7
--- /dev/null
+++ b/apps/api/prisma/migrations/20221129081832_fix_defaults/migration.sql
@@ -0,0 +1,31 @@
+-- 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 NOT NULL DEFAULT '1.1.1.1,8.8.8.8',
+ "ipv4" TEXT,
+ "ipv6" TEXT,
+ "arch" TEXT,
+ "concurrentBuilds" INTEGER NOT NULL DEFAULT 1,
+ "applicationStoragePathMigrationFinished" BOOLEAN NOT NULL DEFAULT false,
+ "proxyDefaultRedirect" TEXT,
+ "doNotTrack" BOOLEAN NOT NULL DEFAULT false,
+ "sentryDSN" TEXT,
+ "isAPIDebuggingEnabled" BOOLEAN NOT NULL DEFAULT false,
+ "isRegistrationEnabled" BOOLEAN NOT NULL DEFAULT true,
+ "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", "doNotTrack", "dualCerts", "fqdn", "id", "ipv4", "ipv6", "isAPIDebuggingEnabled", "isAutoUpdateEnabled", "isDNSCheckEnabled", "isRegistrationEnabled", "isTraefikUsed", "maxPort", "minPort", "proxyDefaultRedirect", "sentryDSN", "updatedAt") SELECT coalesce("DNSServers", '1.1.1.1,8.8.8.8') AS "DNSServers", "applicationStoragePathMigrationFinished", "arch", "concurrentBuilds", "createdAt", "doNotTrack", "dualCerts", "fqdn", "id", "ipv4", "ipv6", "isAPIDebuggingEnabled", "isAutoUpdateEnabled", "isDNSCheckEnabled", "isRegistrationEnabled", "isTraefikUsed", "maxPort", "minPort", "proxyDefaultRedirect", "sentryDSN", "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.prisma
index 088378ecb1..3cc460a286 100644
--- a/apps/api/prisma/schema.prisma
+++ b/apps/api/prisma/schema.prisma
@@ -24,7 +24,7 @@ model Setting {
dualCerts Boolean @default(false)
minPort Int @default(9000)
maxPort Int @default(9100)
- DNSServers String?
+ DNSServers String @default("1.1.1.1,8.8.8.8")
ipv4 String?
ipv6 String?
arch String?
@@ -34,7 +34,7 @@ model Setting {
doNotTrack Boolean @default(false)
sentryDSN String?
isAPIDebuggingEnabled Boolean @default(false)
- isRegistrationEnabled Boolean @default(false)
+ isRegistrationEnabled Boolean @default(true)
isAutoUpdateEnabled Boolean @default(false)
isDNSCheckEnabled Boolean @default(true)
isTraefikUsed Boolean @default(true)
diff --git a/apps/api/prisma/seed.js b/apps/api/prisma/seed.js
index 495bd30a85..93fcb477be 100644
--- a/apps/api/prisma/seed.js
+++ b/apps/api/prisma/seed.js
@@ -12,9 +12,7 @@ async function main() {
await prisma.setting.create({
data: {
id: '0',
- isRegistrationEnabled: true,
arch: process.arch,
- DNSServers: '1.1.1.1,8.8.8.8'
}
});
} else {
@@ -23,11 +21,11 @@ async function main() {
id: settingsFound.id
},
data: {
- id: '0',
- isTraefikUsed: true,
+ id: '0'
}
});
}
+ // Create local docker engine
const localDocker = await prisma.destinationDocker.findFirst({
where: { engine: '/var/run/docker.sock' }
});
@@ -52,12 +50,10 @@ async function main() {
isAutoUpdateEnabled
}
});
+ // Create public github source
const github = await prisma.gitSource.findFirst({
where: { htmlUrl: 'https://github.com', forPublic: true }
});
- const gitlab = await prisma.gitSource.findFirst({
- where: { htmlUrl: 'https://gitlab.com', forPublic: true }
- });
if (!github) {
await prisma.gitSource.create({
data: {
@@ -69,6 +65,10 @@ async function main() {
}
});
}
+ // Create public gitlab source
+ const gitlab = await prisma.gitSource.findFirst({
+ where: { htmlUrl: 'https://gitlab.com', forPublic: true }
+ });
if (!gitlab) {
await prisma.gitSource.create({
data: {
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index ac4fb9be10..0303cdec90 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -240,14 +240,6 @@ async function getTagsTemplates() {
async function initServer() {
const appId = process.env['COOLIFY_APP_ID'];
const settings = await prisma.setting.findUnique({ where: { id: '0' } })
- try {
- let doNotTrack = false
- if (appId === '') doNotTrack = true
- doNotTrack = settings.doNotTrack
- await prisma.setting.update({ where: { id: '0' }, data: { doNotTrack } })
- } catch (error) {
- console.log(error)
- }
try {
if (settings.doNotTrack === true) {
console.log('[000] Telemetry disabled...')
@@ -258,14 +250,12 @@ async function initServer() {
}
// Initialize Sentry
Sentry.init({
- debug: true,
dsn: sentryDSN,
environment: isDev ? 'development' : 'production',
release: version
});
console.log('[000] Sentry initialized...')
}
-
} catch (error) {
console.error(error)
}
@@ -274,7 +264,7 @@ async function initServer() {
await asyncExecShell(`docker network create --attachable coolify`);
} catch (error) { }
try {
- console.log(`[002] Set stuck builds to failed...`);
+ console.log(`[002] Cleanup stucked builds...`);
const isOlder = compareVersions('3.8.1', version);
if (isOlder === 1) {
await prisma.build.updateMany({ where: { status: { in: ['running', 'queued'] } }, data: { status: 'failed' } });
diff --git a/apps/api/src/routes/api/v1/settings/handlers.ts b/apps/api/src/routes/api/v1/settings/handlers.ts
index b03eed9bb9..3a91449cc5 100644
--- a/apps/api/src/routes/api/v1/settings/handlers.ts
+++ b/apps/api/src/routes/api/v1/settings/handlers.ts
@@ -80,7 +80,6 @@ export async function saveSettings(request: FastifyRequest<SaveSettings>, reply:
}
if (doNotTrack === false) {
Sentry.init({
- debug: true,
dsn: sentryDSN,
environment: isDev ? 'development' : 'production',
release: version