mirror of
https://github.com/cupcakearmy/coolify.git
synced 2024-10-23 00:24:15 +02:00
add umami + hashedpws
This commit is contained in:
parent
b708e79929
commit
e09fdbcef0
@ -23,7 +23,7 @@ export async function migrateServicesToNewTemplate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function umami(service: any) {
|
async function umami(service: any) {
|
||||||
const { postgresqlUser, postgresqlPassword, postgresqlDatabase, umamiAdminPassword, hashSalt } = service.ghost
|
const { postgresqlUser, postgresqlPassword, postgresqlDatabase, umamiAdminPassword, hashSalt } = service.umami
|
||||||
|
|
||||||
|
|
||||||
const secrets = [
|
const secrets = [
|
||||||
|
@ -692,7 +692,7 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
|
|||||||
const teamId = request.user.teamId;
|
const teamId = request.user.teamId;
|
||||||
|
|
||||||
const service = await getServiceFromDB({ id, teamId });
|
const service = await getServiceFromDB({ id, teamId });
|
||||||
const { type, version, destinationDockerId, destinationDocker, serviceSecret, serviceSetting, exposePort, persistentStorage } =
|
const { type, destinationDockerId, destinationDocker, persistentStorage } =
|
||||||
service;
|
service;
|
||||||
|
|
||||||
const { workdir } = await createDirectories({ repository: type, buildId: id });
|
const { workdir } = await createDirectories({ repository: type, buildId: id });
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
"templateVersion": "1.0.0",
|
"templateVersion": "1.0.0",
|
||||||
"serviceDefaultVersion": "postgres:12-alpine",
|
"serviceDefaultVersion": "postgresql-v1.38.0",
|
||||||
"name": "umami",
|
"name": "umami",
|
||||||
"displayName": "Umami",
|
"displayName": "Umami",
|
||||||
"description": "Umami is a simple, easy to use, self-hosted web analytics solution. The goal is to provide you with a friendly privacy-focused alternative to Google Analytics.",
|
"description": "Umami is a simple, easy to use, self-hosted web analytics solution. The goal is to provide you with a friendly privacy-focused alternative to Google Analytics.",
|
||||||
@ -15,6 +15,7 @@ export default [
|
|||||||
"image": "ghcr.io/umami-software/umami:$$core_version",
|
"image": "ghcr.io/umami-software/umami:$$core_version",
|
||||||
"volumes": [],
|
"volumes": [],
|
||||||
"environment": [
|
"environment": [
|
||||||
|
"ADMIN_PASSWORD=$$secret_admin_password",
|
||||||
"DATABASE_URL=$$secret_database_url",
|
"DATABASE_URL=$$secret_database_url",
|
||||||
"DATABASE_TYPE=postgresql",
|
"DATABASE_TYPE=postgresql",
|
||||||
"HASH_SALT=$$secret_hash_salt",
|
"HASH_SALT=$$secret_hash_salt",
|
||||||
@ -26,6 +27,10 @@ export default [
|
|||||||
"$$id-postgresql": {
|
"$$id-postgresql": {
|
||||||
"name": "PostgreSQL",
|
"name": "PostgreSQL",
|
||||||
"documentation": "Official docs are [here](https://umami.is/docs/getting-started)",
|
"documentation": "Official docs are [here](https://umami.is/docs/getting-started)",
|
||||||
|
"build": {
|
||||||
|
context: "$$workdir",
|
||||||
|
dockerfile: "Dockerfile.$$id-postgresql"
|
||||||
|
},
|
||||||
"depends_on": [],
|
"depends_on": [],
|
||||||
"image": "postgres:12-alpine",
|
"image": "postgres:12-alpine",
|
||||||
"volumes": [
|
"volumes": [
|
||||||
@ -41,7 +46,8 @@ export default [
|
|||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
source: "$$workdir/schema.postgresql.sql",
|
source: "$$workdir/schema.postgresql.sql",
|
||||||
destination: `
|
destination: "/docker-entrypoint-initdb.d/schema.postgresql.sql",
|
||||||
|
content: `
|
||||||
-- CreateTable
|
-- CreateTable
|
||||||
CREATE TABLE "account" (
|
CREATE TABLE "account" (
|
||||||
"user_id" SERIAL NOT NULL,
|
"user_id" SERIAL NOT NULL,
|
||||||
@ -172,7 +178,7 @@ export default [
|
|||||||
-- AddForeignKey
|
-- AddForeignKey
|
||||||
ALTER TABLE "website" ADD FOREIGN KEY ("user_id") REFERENCES "account"("user_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
ALTER TABLE "website" ADD FOREIGN KEY ("user_id") REFERENCES "account"("user_id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
insert into account (username, password, is_admin) values ('admin', '$$secret_admin_password', true);`
|
insert into account (username, password, is_admin) values ('admin', '$$hashed$$secret_admin_password', true);`
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -201,7 +207,7 @@ export default [
|
|||||||
"description": "",
|
"description": "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "$$config_postgres_password",
|
"id": "$$secret_postgres_password",
|
||||||
"name": "POSTGRES_PASSWORD",
|
"name": "POSTGRES_PASSWORD",
|
||||||
"label": "PostgreSQL Password",
|
"label": "PostgreSQL Password",
|
||||||
"defaultValue": "$$generate_password",
|
"defaultValue": "$$generate_password",
|
||||||
@ -218,8 +224,11 @@ export default [
|
|||||||
"id": "$$secret_admin_password",
|
"id": "$$secret_admin_password",
|
||||||
"name": "ADMIN_PASSWORD",
|
"name": "ADMIN_PASSWORD",
|
||||||
"label": "Admin Password",
|
"label": "Admin Password",
|
||||||
"defaultValue": "$$generate_hashed_password",
|
"defaultValue": "$$generate_password",
|
||||||
"description": "",
|
"description": "",
|
||||||
|
"extras": {
|
||||||
|
"isVisibleOnUI": true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,7 @@ import type { OnlyId } from '../../../../types';
|
|||||||
import type { ActivateWordpressFtp, CheckService, CheckServiceDomain, DeleteServiceSecret, DeleteServiceStorage, GetServiceLogs, SaveService, SaveServiceDestination, SaveServiceSecret, SaveServiceSettings, SaveServiceStorage, SaveServiceType, SaveServiceVersion, ServiceStartStop, SetGlitchTipSettings, SetWordpressSettings } from './types';
|
import type { ActivateWordpressFtp, CheckService, CheckServiceDomain, DeleteServiceSecret, DeleteServiceStorage, GetServiceLogs, SaveService, SaveServiceDestination, SaveServiceSecret, SaveServiceSettings, SaveServiceStorage, SaveServiceType, SaveServiceVersion, ServiceStartStop, SetGlitchTipSettings, SetWordpressSettings } from './types';
|
||||||
import { supportedServiceTypesAndVersions } from '../../../../lib/services/supportedVersions';
|
import { supportedServiceTypesAndVersions } from '../../../../lib/services/supportedVersions';
|
||||||
import { configureServiceType, removeService } from '../../../../lib/services/common';
|
import { configureServiceType, removeService } from '../../../../lib/services/common';
|
||||||
|
import { hashPassword } from '../handlers';
|
||||||
|
|
||||||
export async function listServices(request: FastifyRequest) {
|
export async function listServices(request: FastifyRequest) {
|
||||||
try {
|
try {
|
||||||
@ -169,7 +170,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
|
|||||||
if (service.serviceSecret.length > 0) {
|
if (service.serviceSecret.length > 0) {
|
||||||
for (const secret of service.serviceSecret) {
|
for (const secret of service.serviceSecret) {
|
||||||
const { name, value } = secret
|
const { name, value } = secret
|
||||||
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(`$$secret_${name.toLowerCase()}`, value))
|
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(`$$hashed$$secret_${name.toLowerCase()}`, bcrypt.hashSync(value, 10)).replaceAll(`$$secret_${name.toLowerCase()}`, value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,11 +224,6 @@ export async function saveServiceType(request: FastifyRequest<SaveServiceType>,
|
|||||||
variable.value = generatePassword({ length });
|
variable.value = generatePassword({ length });
|
||||||
} else if (variable.defaultValue === '$$generate_passphrase') {
|
} else if (variable.defaultValue === '$$generate_passphrase') {
|
||||||
variable.value = generatePassword({ length });
|
variable.value = generatePassword({ length });
|
||||||
} else if (variable.defaultValue === '$$generate_hashed_password') {
|
|
||||||
variable.value = bcrypt.hashSync(
|
|
||||||
generatePassword({ length }),
|
|
||||||
10
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (variableId.startsWith('$$config_')) {
|
if (variableId.startsWith('$$config_')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user