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.

ghost

Andras Bacsai92d3860240d7
diff --git a/apps/api/src/lib.ts b/apps/api/src/lib.ts
index 227fd807cc..2613b63259 100644
--- a/apps/api/src/lib.ts
+++ b/apps/api/src/lib.ts
@@ -1,4 +1,4 @@
-import { decrypt, encrypt, prisma } from "./lib/common";
+import { decrypt, encrypt, getDomain, prisma } from "./lib/common";
import { includeServices } from "./lib/services/common";
@@ -12,6 +12,7 @@ export async function migrateServicesToNewTemplate() {
if (service.type === 'minio' && service.minio) await minio(service)
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)
}
} catch (error) {
@@ -19,6 +20,37 @@ export async function migrateServicesToNewTemplate() {
}
}
+async function ghost(service: any) {
+ const { defaultEmail, defaultPassword, mariadbUser, mariadbPassword, mariadbRootUser, mariadbRootUserPassword, mariadbDatabase } = service.ghost
+ const { fqdn } = service
+
+ const isHttps = fqdn.startsWith('https://');
+
+ const secrets = [
+ `GHOST_PASSWORD@@@${defaultPassword}`,
+ `MARIADB_PASSWORD@@@${mariadbPassword}`,
+ `MARIADB_ROOT_PASSWORD@@@${mariadbRootUserPassword}`,
+ `GHOST_DATABASE_PASSWORD@@@${mariadbPassword}`,
+ ]
+ const settings = [
+ `GHOST_EMAIL@@@${defaultEmail}`,
+ `GHOST_DATABASE_HOST@@@${service.id}-mariadb`,
+ `GHOST_DATABASE_USER@@@${mariadbUser}`,
+ `GHOST_DATABASE_NAME@@@${mariadbDatabase}`,
+ `GHOST_DATABASE_PORT_NUMBER@@@3306`,
+ `MARIADB_USER@@@${mariadbUser}`,
+ `MARIADB_DATABASE@@@${mariadbDatabase}`,
+ `MARIADB_ROOT_USER@@@${mariadbRootUser}`,
+ `GHOST_HOST@@@${getDomain(fqdn)}`,
+ `url@@@${fqdn}`,
+ `GHOST_ENABLE_HTTPS@@@${isHttps ? 'yes' : 'no'}`
+ ]
+ await migrateSecrets(secrets, service);
+ await migrateSettings(settings, service);
+
+ // Remove old service data
+ // await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } })
+}
async function wordpress(service: any) {
const { extraConfig, tablePrefix, ownMysql, mysqlHost, mysqlPort, mysqlUser, mysqlPassword, mysqlRootUser, mysqlRootUserPassword, mysqlDatabase, ftpEnabled, ftpUser, ftpPassword, ftpPublicPort, ftpHostKey, ftpHostKeyPrivate } = service.wordpress
diff --git a/apps/api/src/lib/templates.ts b/apps/api/src/lib/templates.ts
index 1ff7d3078d..4d20e1bbe4 100644
--- a/apps/api/src/lib/templates.ts
+++ b/apps/api/src/lib/templates.ts
@@ -21,11 +21,12 @@ export default [
"GHOST_HOST=$$config_ghost_host",
"GHOST_ENABLE_HTTPS=$$config_ghost_enable_https",
"GHOST_EMAIL=$$config_ghost_email",
+ "GHOST_PASSWORD=$$secret_ghost_password",
"GHOST_DATABASE_HOST=$$config_ghost_database_host",
"GHOST_DATABASE_USER=$$config_mariadb_user",
- "GHOST_DATABASE_PASSWORD=$$config_mariadb_password",
+ "GHOST_DATABASE_PASSWORD=$$secret_ghost_database_password",
"GHOST_DATABASE_NAME=$$config_mariadb_database",
- "GHOST_DATABASE_PORT_NUMBER=$$config_mariadb_port",
+ "GHOST_DATABASE_PORT_NUMBER=3306",
],
"ports": [
@@ -68,16 +69,23 @@ export default [
"id": "$$config_ghost_enable_https",
"name": "GHOST_ENABLE_HTTPS",
"label": "Ghost Enable HTTPS",
- "defaultValue": "$$config_mysql_user",
+ "defaultValue": "no",
"description": ""
},
{
"id": "$$config_ghost_email",
"name": "GHOST_EMAIL",
- "label": "Ghost Email",
+ "label": "Ghost Default Email",
"defaultValue": "[email protected]",
"description": ""
},
+ {
+ "id": "$$secret_ghost_password",
+ "name": "GHOST_PASSWORD",
+ "label": "Ghost Default Password",
+ "defaultValue": "$$generate_password",
+ "description": ""
+ },
{
"id": "$$config_ghost_database_host",
"name": "GHOST_DATABASE_HOST",
@@ -93,10 +101,10 @@ export default [
"description": ""
},
{
- "id": "$$config_ghost_database_password",
+ "id": "$$secret_ghost_database_password",
"name": "GHOST_DATABASE_PASSWORD",
"label": "MariaDB Password",
- "defaultValue": "$$config_mariadb_password",
+ "defaultValue": "$$secret_mariadb_password",
"description": ""
},
{
@@ -106,13 +114,6 @@ export default [
"defaultValue": "$$config_mariadb_database",
"description": ""
},
- {
- "id": "$$config_ghost_database_port_number",
- "name": "GHOST_DATABASE_PORT_NUMBER",
- "label": "MariaDB Port",
- "defaultValue": "$$config_mariadb_port",
- "description": ""
- },
{
"id": "$$config_mariadb_user",
"name": "MARIADB_USER",