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
meilisearch
Andras Bacsaicbaecff3b727
diff --git a/apps/api/src/lib.ts b/apps/api/src/lib.tsindex 0eefbf2a9d..5e76e986b2 100644--- a/apps/api/src/lib.ts+++ b/apps/api/src/lib.ts@@ -1,6 +1,6 @@import { decrypt, encrypt, getDomain, prisma } from "./lib/common";import { includeServices } from "./lib/services/common";-+import templates from "./lib/templates";export async function migrateServicesToNewTemplate() {// This function migrates old hardcoded services to the new template based services@@ -13,8 +13,8 @@ export async function migrateServicesToNewTemplate() {if (service.type === 'vscodeserver' && service.vscodeserver) await vscodeserver(service)if (service.type === 'wordpress' && service.wordpress) await wordpress(service)if (service.type === 'ghost' && service.ghost) await ghost(service)- if (service.type === 'meilisearch' && service.meilisearch) await meilisearch(service)-+ if (service.type === 'meilisearch' && service.meiliSearch) await meilisearch(service)+ await createVolumes(service);}} catch (error) {console.log(error)@@ -23,7 +23,7 @@ export async function migrateServicesToNewTemplate() {}async function meilisearch(service: any) {- const { masterKey } = service.meilisearch+ const { masterKey } = service.meiliSearchconst secrets = [`MEILI_MASTER_KEY@@@${masterKey}`,@@ -173,13 +173,9 @@ async function plausibleAnalytics(service: any) {`POSTGRES_PASSWORD@@@${postgresqlPassword}`,`DATABASE_URL@@@${encrypt(`postgres://${postgresqlUser}:${decrypt(postgresqlPassword)}@$$generate_fqdn:5432/${postgresqlDatabase}`)}`,]- const volumes = [- `${service.id}-postgresql-data@@@/bitnami/postgresql@@@${service.id}-postgresql`,- `${service.id}-clickhouse-data@@@/var/lib/clickhouse/data@@@${service.id}-clickhouse`,- ]await migrateSettings(settings, service);await migrateSecrets(secrets, service);- await createVolumes(volumes, service);+ await createVolumes(service);// Remove old service data// await prisma.service.update({ where: { id: service.id }, data: { plausibleAnalytics: { delete: true } } })@@ -189,7 +185,7 @@ async function migrateSettings(settings: any[], service: any) {for (const setting of settings) {if (!setting) continue;const [name, value] = setting.split('@@@')- console.log('Migrating setting', name, value, 'for service', service.id, ', service name:', service.name)+ // console.log('Migrating setting', name, value, 'for service', service.id, ', service name:', service.name)await prisma.serviceSetting.findFirst({ where: { name, serviceId: service.id } }) || await prisma.serviceSetting.create({ data: { name, value, service: { connect: { id: service.id } } } })}}@@ -197,14 +193,29 @@ async function migrateSecrets(secrets: any[], service: any) {for (const secret of secrets) {if (!secret) continue;const [name, value] = secret.split('@@@')- console.log('Migrating secret', name, value, 'for service', service.id, ', service name:', service.name)+ // console.log('Migrating secret', name, value, 'for service', service.id, ', service name:', service.name)await prisma.serviceSecret.findFirst({ where: { name, serviceId: service.id } }) || await prisma.serviceSecret.create({ data: { name, value, service: { connect: { id: service.id } } } })}}-async function createVolumes(volumes: any[], service: any) {+async function createVolumes(service: any) {+ const volumes = [];+ let template = templates.find(t => t.name === service.type)+ if (template) {+ template = JSON.parse(JSON.stringify(template).replaceAll('$$id', service.id))+ for (const s of Object.keys(template.services)) {+ if (template.services[s].volumes && template.services[s].volumes.length > 0) {+ for (const volume of template.services[s].volumes) {+ const volumeName = volume.split(':')[0]+ const volumePath = volume.split(':')[1]+ const volumeService = service.id+ volumes.push(`${volumeName}@@@${volumePath}@@@${volumeService}`)+ }+ }+ }+ }for (const volume of volumes) {const [volumeName, path, containerId] = volume.split('@@@')- console.log('Creating volume', volumeName, path, containerId, 'for service', service.id, ', service name:', service.name)+ // console.log('Creating volume', volumeName, path, containerId, 'for service', service.id, ', service name:', service.name)await prisma.servicePersistentStorage.findFirst({ where: { volumeName, serviceId: service.id } }) || await prisma.servicePersistentStorage.create({ data: { volumeName, path, containerId, predefined: true, service: { connect: { id: service.id } } } })}}\ No newline at end of filediff --git a/apps/api/src/lib/templates.ts b/apps/api/src/lib/templates.tsindex 7de4c54aff..08350e56c0 100644--- a/apps/api/src/lib/templates.ts+++ b/apps/api/src/lib/templates.ts@@ -1,7 +1,7 @@export default [{"templateVersion": "1.0.0",- "serviceDefaultVersion": "latest",+ "serviceDefaultVersion": "v0.29.1","name": "meilisearch","displayName": "MeiliSearch","description": "MeiliSearch is a lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine",@@ -26,7 +26,6 @@ export default ["7700"]}-},"variables": [{@@ -34,7 +33,10 @@ export default ["name": "MEILI_MASTER_KEY","label": "Master Key","defaultValue": "$$generate_passphrase",- "description": ""+ "description": "",+ "extras": {+ "isVisibleOnUI": true,+ }}]},diff --git a/apps/api/src/routes/api/v1/services/handlers.ts b/apps/api/src/routes/api/v1/services/handlers.tsindex 903f48c527..1a6c8bc797 100644--- a/apps/api/src/routes/api/v1/services/handlers.ts+++ b/apps/api/src/routes/api/v1/services/handlers.ts@@ -142,7 +142,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strinparsedTemplate = foundTemplate}// replace $$id and $$workdir- parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll('$$id', service.id).replaceAll('$$core_version', foundTemplate.serviceDefaultVersion))+ parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll('$$id', service.id).replaceAll('$$core_version', service.version || foundTemplate.serviceDefaultVersion))// replace $$fqdnif (workdir) {diff --git a/apps/ui/src/routes/services/[id]/_Storage.svelte b/apps/ui/src/routes/services/[id]/_Storage.svelteindex a7c8a155bd..8db7d59f7b 100644--- a/apps/ui/src/routes/services/[id]/_Storage.svelte+++ b/apps/ui/src/routes/services/[id]/_Storage.svelte@@ -64,11 +64,11 @@<div class="grid grid-col-1 lg:grid-cols-2 pt-2"><div><input- id={storage.id}+ id={storage.volumeName}disabledreadonlyclass="w-full"- value={`${storage.id}${storage.path.replace(/\//gi, '-')}:${storage.path}`}+ value={`${storage.volumeName}:${storage.path}`}/></div><div class="lg:px-2">diff --git a/apps/ui/src/routes/services/[id]/index.svelte b/apps/ui/src/routes/services/[id]/index.svelteindex 1ebb4a08db..747deebf28 100644--- a/apps/ui/src/routes/services/[id]/index.svelte+++ b/apps/ui/src/routes/services/[id]/index.svelte@@ -428,7 +428,7 @@<option value="true">true</option><option value="false"> false</option></select>- {:else if variable.defaultValue === '$$generate_password'}+ {:else if variable.defaultValue === '$$generate_password' || variable.defaultValue === '$$generate_passphrase'}<CopyPasswordFieldisPasswordFieldreadonly