This commit is contained in:
Andras Bacsai 2022-11-03 09:31:01 +01:00
parent 44feba4d89
commit c6c037ff17
8 changed files with 189 additions and 62 deletions

View File

@ -1757,8 +1757,8 @@
showOnConfiguration: true showOnConfiguration: true
- templateVersion: 1.0.0 - templateVersion: 1.0.0
defaultVersion: latest defaultVersion: latest
type: ghost type: ghost-mariadb
name: Ghost name: Ghost (MariaDB)
description: >- description: >-
Ghost is a free and open source blogging platform written in JavaScript and Ghost is a free and open source blogging platform written in JavaScript and
distributed under the MIT License distributed under the MIT License
@ -1869,6 +1869,147 @@
label: MariaDB Root Password label: MariaDB Root Password
defaultValue: $$generate_password defaultValue: $$generate_password
description: '' description: ''
- templateVersion: 1.0.0
defaultVersion: '5.22'
type: ghost-only
name: Ghost Only (No Database)
description: >-
Ghost is a free and open source blogging platform written in JavaScript and
distributed under the MIT License
services:
$$id:
name: Ghost
documentation: 'Taken from https://docs.ghost.org/'
image: 'ghost:$$core_version'
volumes:
- '$$id-ghost:/var/lib/ghost/content'
environment:
- url=$$config_url
- database__client=$$config_database__client
- database__connection__host=$$config_database__connection__host
- database__connection__user=$$config_database__connection__user
- database__connection__password=$$secret_database__connection__password
- database__connection__database=$$config_database__connection__database
ports:
- '2368'
variables:
- id: $$config_url
name: url
label: URL
defaultValue: $$generate_fqdn
description: ''
- id: $$config_database__client
name: database__client
label: Database Client
defaultValue: mysql
description: ''
required: true
- id: $$config_database__connection__host
name: database__connection__host
label: Database Host
defaultValue: ''
description: ''
required: true
placeholder: 'db.coolify.io'
- id: $$config_database__connection__user
name: database__connection__user
label: Database User
defaultValue: ''
description: ''
placeholder: 'ghost'
required: true
- id: $$secret_database__connection__password
name: database__connection__password
label: Database Password
defaultValue: ''
description: ''
placeholder: 'superSecretP4ssword'
showOnConfiguration: true
required: true
- id: $$config_database__connection__database
name: database__connection__database
label: Database Name
defaultValue: ''
description: ''
placeholder: 'ghost_db'
required: true
- templateVersion: 1.0.0
defaultVersion: '5.22'
type: ghost-mysql
name: Ghost (MySQL)
description: >-
Ghost is a free and open source blogging platform written in JavaScript and
distributed under the MIT License
services:
$$id:
name: Ghost
documentation: 'Taken from https://docs.ghost.org/'
depends_on:
- $$id-mysql
image: 'ghost:$$core_version'
volumes:
- '$$id-ghost:/var/lib/ghost/content'
environment:
- url=$$config_url
- database__client=$$config_database__client
- database__connection__host=$$config_database__connection__host
- database__connection__user=$$config_mysql_user
- database__connection__password=$$secret_mysql_password
- database__connection__database=$$config_mysql_database
ports:
- '2368'
$$id-mysql:
name: MySQL
depends_on: []
image: 'mysql:8.0'
volumes:
- '$$id-mysql:/var/lib/mysql'
environment:
- MYSQL_USER=$$config_mysql_user
- MYSQL_PASSWORD=$$secret_mysql_password
- MYSQL_DATABASE=$$config_mysql_database
- MYSQL_ROOT_PASSWORD=$$secret_mysql_root_password
ports: []
variables:
- id: $$config_url
name: url
label: URL
defaultValue: $$generate_fqdn
description: ''
- id: $$config_database__client
name: database__client
label: Database Client
defaultValue: mysql
description: ''
readOnly: true
- id: $$config_database__connection__host
name: database__connection__host
label: Database Host
defaultValue: $$id-mysql
description: ''
- id: $$config_mysql_user
main: $$id-mysql
name: MYSQL_USER
label: MySQL User
defaultValue: $$generate_username
description: ''
- id: $$secret_mysql_password
main: $$id-mysql
name: MYSQL_PASSWORD
label: MySQL Password
defaultValue: $$generate_password
description: ''
- id: $$config_mysql_database
main: $$id-mysql
name: MYSQL_DATABASE
label: MySQL Database
defaultValue: ghost
description: ''
- id: $$secret_mysql_root_password
name: MYSQL_ROOT_PASSWORD
label: MySQL Root Password
defaultValue: $$generate_password
description: ''
- templateVersion: 1.0.0 - templateVersion: 1.0.0
defaultVersion: php8.1 defaultVersion: php8.1
type: wordpress type: wordpress
@ -1912,25 +2053,7 @@
label: Database Host label: Database Host
defaultValue: $$id-mysql defaultValue: $$id-mysql
description: '' description: ''
readonly: true readOnly: true
- id: $$config_wordpress_db_user
name: WORDPRESS_DB_USER
label: Database User
defaultValue: $$config_mysql_user
description: ''
readonly: true
- id: $$secret_wordpress_db_password
name: WORDPRESS_DB_PASSWORD
label: Database Password
defaultValue: $$secret_mysql_password
description: ''
readonly: true
- id: $$config_wordpress_db_name
name: WORDPRESS_DB_NAME
label: Database Name
defaultValue: $$config_mysql_database
description: ''
readonly: true
- id: $$config_wordpress_config_extra - id: $$config_wordpress_config_extra
name: WORDPRESS_CONFIG_EXTRA name: WORDPRESS_CONFIG_EXTRA
label: WordPress Config Extra label: WordPress Config Extra
@ -1947,31 +2070,31 @@
label: MySQL Root Password label: MySQL Root Password
defaultValue: $$generate_password defaultValue: $$generate_password
description: '' description: ''
readonly: true readOnly: true
- id: $$config_mysql_root_user - id: $$config_mysql_root_user
name: MYSQL_ROOT_USER name: MYSQL_ROOT_USER
label: MySQL Root User label: MySQL Root User
defaultValue: $$generate_username defaultValue: $$generate_username
description: '' description: ''
readonly: true readOnly: true
- id: $$config_mysql_database - id: $$config_mysql_database
name: MYSQL_DATABASE name: MYSQL_DATABASE
label: MySQL Database label: MySQL Database
defaultValue: wordpress defaultValue: wordpress
description: '' description: ''
readonly: true readOnly: true
- id: $$config_mysql_user - id: $$config_mysql_user
name: MYSQL_USER name: MYSQL_USER
label: MySQL User label: MySQL User
defaultValue: $$generate_username defaultValue: $$generate_username
description: '' description: ''
readonly: true readOnly: true
- id: $$secret_mysql_password - id: $$secret_mysql_password
name: MYSQL_PASSWORD name: MYSQL_PASSWORD
label: MySQL Password label: MySQL Password
defaultValue: $$generate_password defaultValue: $$generate_password
description: '' description: ''
readonly: true readOnly: true
- templateVersion: 1.0.0 - templateVersion: 1.0.0
defaultVersion: php8.1 defaultVersion: php8.1
type: wordpress-only type: wordpress-only

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,8 @@ export async function migrateServicesToNewTemplate() {
if (!service.type) { if (!service.type) {
continue; continue;
} }
let template = templates.find(t => fixType(t.name) === fixType(service.type)); console.log(service.type)
let template = templates.find(t => fixType(t.type) === fixType(service.type));
if (template) { if (template) {
template = JSON.parse(JSON.stringify(template).replaceAll('$$id', service.id)) template = JSON.parse(JSON.stringify(template).replaceAll('$$id', service.id))
if (service.type === 'plausibleanalytics' && service.plausibleAnalytics) await plausibleAnalytics(service, template) if (service.type === 'plausibleanalytics' && service.plausibleAnalytics) await plausibleAnalytics(service, template)
@ -131,8 +132,8 @@ async function appwrite(service: any, template: any) {
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { appwrite: { disconnect: true } } })
} }
async function weblate(service: any, template: any) { async function weblate(service: any, template: any) {
const { adminPassword, postgresqlUser, postgresqlPassword, postgresqlDatabase } = service.weblate const { adminPassword, postgresqlUser, postgresqlPassword, postgresqlDatabase } = service.weblate
@ -154,8 +155,8 @@ async function weblate(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { weblate: { disconnect: true } } })
} }
async function searxng(service: any, template: any) { async function searxng(service: any, template: any) {
const { secretKey, redisPassword } = service.searxng const { secretKey, redisPassword } = service.searxng
@ -171,13 +172,13 @@ async function searxng(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { searxng: { disconnect: true } } })
} }
async function glitchtip(service: any, template: any) { async function glitchtip(service: any, template: any) {
const { postgresqlUser, postgresqlPassword, postgresqlDatabase, secretKeyBase, defaultEmail, defaultUsername, defaultPassword, defaultEmailFrom, emailSmtpHost, emailSmtpPort, emailSmtpUser, emailSmtpPassword, emailSmtpUseTls, emailSmtpUseSsl, emailBackend, mailgunApiKey, sendgridApiKey, enableOpenUserRegistration } = service.glitchTip const { postgresqlUser, postgresqlPassword, postgresqlDatabase, secretKeyBase, defaultEmail, defaultUsername, defaultPassword, defaultEmailFrom, emailSmtpHost, emailSmtpPort, emailSmtpUser, emailSmtpPassword, emailSmtpUseTls, emailSmtpUseSsl, emailBackend, mailgunApiKey, sendgridApiKey, enableOpenUserRegistration } = service.glitchTip
const { id } = service const { id } = service
const secrets = [ const secrets = [
`POSTGRES_PASSWORD@@@${postgresqlPassword}`, `POSTGRES_PASSWORD@@@${postgresqlPassword}`,
`SECRET_KEY@@@${secretKeyBase}`, `SECRET_KEY@@@${secretKeyBase}`,
@ -202,8 +203,9 @@ async function glitchtip(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data
await prisma.service.update({ where: { id: service.id }, data: { type: 'glitchtip' } }) await prisma.service.update({ where: { id: service.id }, data: { type: 'glitchtip' } })
// Disconnect old service data
await prisma.service.update({ where: { id: service.id }, data: { glitchTip: { disconnect: true } } })
} }
async function hasura(service: any, template: any) { async function hasura(service: any, template: any) {
const { postgresqlUser, postgresqlPassword, postgresqlDatabase, graphQLAdminPassword } = service.hasura const { postgresqlUser, postgresqlPassword, postgresqlDatabase, graphQLAdminPassword } = service.hasura
@ -221,8 +223,8 @@ async function hasura(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { hasura: { disconnect: true } } })
} }
async function umami(service: any, template: any) { async function umami(service: any, template: any) {
const { postgresqlUser, postgresqlPassword, postgresqlDatabase, umamiAdminPassword, hashSalt } = service.umami const { postgresqlUser, postgresqlPassword, postgresqlDatabase, umamiAdminPassword, hashSalt } = service.umami
@ -242,8 +244,8 @@ async function umami(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { umami: { disconnect: true } } })
} }
async function meilisearch(service: any, template: any) { async function meilisearch(service: any, template: any) {
const { masterKey } = service.meiliSearch const { masterKey } = service.meiliSearch
@ -255,8 +257,8 @@ async function meilisearch(service: any, template: any) {
// await migrateSettings(settings, service, template); // await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { meiliSearch: { disconnect: true } } })
} }
async function ghost(service: any, template: any) { async function ghost(service: any, template: any) {
const { defaultEmail, defaultPassword, mariadbUser, mariadbPassword, mariadbRootUser, mariadbRootUserPassword, mariadbDatabase } = service.ghost const { defaultEmail, defaultPassword, mariadbUser, mariadbPassword, mariadbRootUser, mariadbRootUserPassword, mariadbDatabase } = service.ghost
@ -286,13 +288,14 @@ async function ghost(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data await prisma.service.update({ where: { id: service.id }, data: { type: "ghost-mariadb" } })
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } })
// Disconnect old service data
await prisma.service.update({ where: { id: service.id }, data: { ghost: { disconnect: true } } })
} }
async function wordpress(service: any, template: any) { async function wordpress(service: any, template: any) {
const { extraConfig, tablePrefix, ownMysql, mysqlHost, mysqlPort, mysqlUser, mysqlPassword, mysqlRootUser, mysqlRootUserPassword, mysqlDatabase, ftpEnabled, ftpUser, ftpPassword, ftpPublicPort, ftpHostKey, ftpHostKeyPrivate } = service.wordpress const { extraConfig, tablePrefix, ownMysql, mysqlHost, mysqlPort, mysqlUser, mysqlPassword, mysqlRootUser, mysqlRootUserPassword, mysqlDatabase, ftpEnabled, ftpUser, ftpPassword, ftpPublicPort, ftpHostKey, ftpHostKeyPrivate } = service.wordpress
let settings = [] let settings = []
let secrets = [] let secrets = []
if (ownMysql) { if (ownMysql) {
@ -338,8 +341,8 @@ async function wordpress(service: any, template: any) {
if (ownMysql) { if (ownMysql) {
await prisma.service.update({ where: { id: service.id }, data: { type: "wordpress-only" } }) await prisma.service.update({ where: { id: service.id }, data: { type: "wordpress-only" } })
} }
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } }) // await prisma.service.update({ where: { id: service.id }, data: { wordpress: { disconnect: true } } })
} }
async function vscodeserver(service: any, template: any) { async function vscodeserver(service: any, template: any) {
const { password } = service.vscodeserver const { password } = service.vscodeserver
@ -349,8 +352,8 @@ async function vscodeserver(service: any, template: any) {
] ]
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { vscodeserver: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { vscodeserver: { disconnect: true } } })
} }
async function minio(service: any, template: any) { async function minio(service: any, template: any) {
const { rootUser, rootUserPassword, apiFqdn } = service.minio const { rootUser, rootUserPassword, apiFqdn } = service.minio
@ -367,8 +370,8 @@ async function minio(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { minio: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { minio: { disconnect: true } } })
} }
async function fider(service: any, template: any) { async function fider(service: any, template: any) {
const { postgresqlUser, postgresqlPassword, postgresqlDatabase, jwtSecret, emailNoreply, emailMailgunApiKey, emailMailgunDomain, emailMailgunRegion, emailSmtpHost, emailSmtpPort, emailSmtpUser, emailSmtpPassword, emailSmtpEnableStartTls } = service.fider const { postgresqlUser, postgresqlPassword, postgresqlDatabase, jwtSecret, emailNoreply, emailMailgunApiKey, emailMailgunDomain, emailMailgunRegion, emailSmtpHost, emailSmtpPort, emailSmtpUser, emailSmtpPassword, emailSmtpEnableStartTls } = service.fider
@ -396,8 +399,8 @@ async function fider(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { fider: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { fider: { disconnect: true } } })
} }
async function plausibleAnalytics(service: any, template: any) { async function plausibleAnalytics(service: any, template: any) {
@ -423,8 +426,8 @@ async function plausibleAnalytics(service: any, template: any) {
await migrateSettings(settings, service, template); await migrateSettings(settings, service, template);
await migrateSecrets(secrets, service); await migrateSecrets(secrets, service);
// Remove old service data // Disconnect old service data
// await prisma.service.update({ where: { id: service.id }, data: { plausibleAnalytics: { delete: true } } }) await prisma.service.update({ where: { id: service.id }, data: { plausibleAnalytics: { disconnect: true } } })
} }
async function migrateSettings(settings: any[], service: any, template: any) { async function migrateSettings(settings: any[], service: any, template: any) {

View File

@ -168,14 +168,14 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
const main = variable?.main || '$$id' const main = variable?.main || '$$id'
const type = variable?.type || 'input' const type = variable?.type || 'input'
const placeholder = variable?.placeholder || '' const placeholder = variable?.placeholder || ''
const readonly = variable?.readonly || false const readOnly = variable?.readOnly || false
const required = variable?.required || false const required = variable?.required || false
if (envValue.startsWith('$$config') || variable?.showOnConfiguration) { if (envValue.startsWith('$$config') || variable?.showOnConfiguration) {
if (envValue.startsWith('$$config_coolify')) { if (envValue.startsWith('$$config_coolify')) {
continue continue
} }
parsedTemplate[realKey].environment.push( parsedTemplate[realKey].environment.push(
{ id, name: envKey, value: envValue, main, label, description, defaultValue, type, placeholder, required, readonly } { id, name: envKey, value: envValue, main, label, description, defaultValue, type, placeholder, required, readOnly }
) )
} }
} }
@ -560,7 +560,7 @@ export async function getServiceSecrets(request: FastifyRequest<OnlyId>) {
secrets = secrets.map((secret) => { secrets = secrets.map((secret) => {
const foundVariable = foundTemplate?.variables.find(v => v.name === secret.name) || null const foundVariable = foundTemplate?.variables.find(v => v.name === secret.name) || null
if (foundVariable) { if (foundVariable) {
secret.readonly = foundVariable.readonly secret.readOnly = foundVariable.readOnly
} }
secret.value = decrypt(secret.value); secret.value = decrypt(secret.value);
return secret; return secret;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -519,8 +519,8 @@
<CopyPasswordField <CopyPasswordField
isPasswordField={variable.id.startsWith('secret')} isPasswordField={variable.id.startsWith('secret')}
required={variable?.required} required={variable?.required}
readonly={variable.readonly || isDisabled} readonly={variable.readOnly || isDisabled}
disabled={variable.readonly || isDisabled} disabled={variable.readOnly || isDisabled}
name={variable.name} name={variable.name}
id={variable.name} id={variable.name}
value={variable.value} value={variable.value}

View File

@ -83,7 +83,7 @@
{#each secrets as secret} {#each secrets as secret}
{#key secret.id} {#key secret.id}
<tr> <tr>
<Secret name={secret.name} value={secret.value} readonly={secret.readonly} on:refresh={refreshSecrets} /> <Secret name={secret.name} value={secret.value} readonly={secret.readOnly} on:refresh={refreshSecrets} />
</tr> </tr>
{/key} {/key}
{/each} {/each}