Merge branch 'temp' into next
This commit is contained in:
commit
7949bbe66d
@ -20,7 +20,7 @@ export const includeServices: any = {
|
||||
glitchTip: true,
|
||||
searxng: true,
|
||||
weblate: true,
|
||||
taiga: true
|
||||
taiga: true,
|
||||
};
|
||||
export async function configureServiceType({
|
||||
id,
|
||||
@ -350,13 +350,6 @@ export async function configureServiceType({
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (type === 'grafana') {
|
||||
await prisma.service.update({
|
||||
where: { id },
|
||||
data: {
|
||||
type
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await prisma.service.update({
|
||||
where: { id },
|
||||
@ -385,6 +378,6 @@ export async function removeService({ id }: { id: string }): Promise<void> {
|
||||
await prisma.searxng.deleteMany({ where: { serviceId: id } });
|
||||
await prisma.weblate.deleteMany({ where: { serviceId: id } });
|
||||
await prisma.taiga.deleteMany({ where: { serviceId: id } });
|
||||
|
||||
|
||||
await prisma.service.delete({ where: { id } });
|
||||
}
|
@ -73,6 +73,10 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
|
||||
if (type === 'grafana') {
|
||||
return await startGrafanaService(request)
|
||||
}
|
||||
if (type === 'trilium') {
|
||||
return await startTriliumService(request)
|
||||
}
|
||||
|
||||
throw `Service type ${type} not supported.`
|
||||
} catch (error) {
|
||||
throw { status: 500, message: error?.message || error }
|
||||
@ -904,8 +908,8 @@ async function startMeilisearchService(request: FastifyRequest<ServiceStartStop>
|
||||
const {
|
||||
meiliSearch: { masterKey }
|
||||
} = service;
|
||||
const { type, version, destinationDockerId, destinationDocker, serviceSecret, exposePort, persistentStorage } =
|
||||
service;
|
||||
const { type, version, destinationDockerId, destinationDocker,
|
||||
serviceSecret, exposePort, persistentStorage } = service;
|
||||
const network = destinationDockerId && destinationDocker.network;
|
||||
const port = getServiceMainPort('meilisearch');
|
||||
|
||||
@ -2698,6 +2702,60 @@ async function startGrafanaService(request: FastifyRequest<ServiceStartStop>) {
|
||||
return errorHandler({ status, message })
|
||||
}
|
||||
}
|
||||
async function startTriliumService(request: FastifyRequest<ServiceStartStop>) {
|
||||
try {
|
||||
const { id } = request.params;
|
||||
const teamId = request.user.teamId;
|
||||
const service = await getServiceFromDB({ id, teamId });
|
||||
const { type, version, destinationDockerId, destinationDocker, serviceSecret, exposePort, persistentStorage } =
|
||||
service;
|
||||
const network = destinationDockerId && destinationDocker.network;
|
||||
const port = getServiceMainPort('trilium');
|
||||
|
||||
const { workdir } = await createDirectories({ repository: type, buildId: id });
|
||||
const image = getServiceImage(type);
|
||||
|
||||
const config = {
|
||||
trilium: {
|
||||
image: `${image}:${version}`,
|
||||
volumes: [`${id}-trilium:/home/node/trilium-data`],
|
||||
environmentVariables: {}
|
||||
}
|
||||
};
|
||||
if (serviceSecret.length > 0) {
|
||||
serviceSecret.forEach((secret) => {
|
||||
config.trilium.environmentVariables[secret.name] = secret.value;
|
||||
});
|
||||
}
|
||||
const { volumeMounts } = persistentVolumes(id, persistentStorage, config)
|
||||
const composeFile: ComposeFile = {
|
||||
version: '3.8',
|
||||
services: {
|
||||
[id]: {
|
||||
container_name: id,
|
||||
image: config.trilium.image,
|
||||
volumes: config.trilium.volumes,
|
||||
environment: config.trilium.environmentVariables,
|
||||
...(exposePort ? { ports: [`${exposePort}:${port}`] } : {}),
|
||||
labels: makeLabelForServices('trilium'),
|
||||
...defaultComposeConfiguration(network),
|
||||
}
|
||||
},
|
||||
networks: {
|
||||
[network]: {
|
||||
external: true
|
||||
}
|
||||
},
|
||||
volumes: volumeMounts
|
||||
};
|
||||
const composeFileDestination = `${workdir}/docker-compose.yaml`;
|
||||
await fs.writeFile(composeFileDestination, yaml.dump(composeFile));
|
||||
await startServiceContainers(destinationDocker.id, composeFileDestination)
|
||||
return {}
|
||||
} catch ({ status, message }) {
|
||||
return errorHandler({ status, message })
|
||||
}
|
||||
}
|
||||
|
||||
export async function migrateAppwriteDB(request: FastifyRequest<OnlyId>, reply: FastifyReply) {
|
||||
try {
|
||||
|
@ -172,7 +172,7 @@ export const supportedServiceTypesAndVersions = [
|
||||
fancyName: 'Appwrite',
|
||||
baseImage: 'appwrite/appwrite',
|
||||
images: ['mariadb:10.7', 'redis:6.2-alpine', 'appwrite/telegraf:1.4.0'],
|
||||
versions: ['latest', '1.0','0.15.3'],
|
||||
versions: ['latest', '1.0', '0.15.3'],
|
||||
recommendedVersion: '1.0',
|
||||
ports: {
|
||||
main: 80
|
||||
@ -244,4 +244,15 @@ export const supportedServiceTypesAndVersions = [
|
||||
main: 3000
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'trilium',
|
||||
fancyName: 'Trilium Notes',
|
||||
baseImage: 'zadam/trilium',
|
||||
images: [],
|
||||
versions: ['latest'],
|
||||
recommendedVersion: 'latest',
|
||||
ports: {
|
||||
main: 8080
|
||||
}
|
||||
},
|
||||
];
|
@ -44,4 +44,6 @@
|
||||
<Icons.Weblate {isAbsolute} />
|
||||
{:else if type === 'grafana'}
|
||||
<Icons.Grafana {isAbsolute} />
|
||||
{/if}
|
||||
{:else if type === 'trilium'}
|
||||
<Icons.Trilium {isAbsolute} />
|
||||
{/if}
|
||||
|
9
apps/ui/src/lib/components/svg/services/Trilium.svelte
Normal file
9
apps/ui/src/lib/components/svg/services/Trilium.svelte
Normal file
@ -0,0 +1,9 @@
|
||||
<script lang="ts">
|
||||
export let isAbsolute = false;
|
||||
</script>
|
||||
|
||||
<img
|
||||
alt="trilium logo"
|
||||
class={isAbsolute ? 'w-9 h-9 absolute top-3 left-0 -m-3 -mt-5' : 'w-8 h-8 mx-auto'}
|
||||
src="/trilium.png"
|
||||
/>
|
@ -18,4 +18,5 @@ export { default as Moodle } from './Moodle.svelte';
|
||||
export { default as GlitchTip } from './GlitchTip.svelte';
|
||||
export { default as Searxng } from './Searxng.svelte';
|
||||
export { default as Weblate } from './Weblate.svelte';
|
||||
export { default as Grafana } from './Grafana.svelte';
|
||||
export { default as Grafana } from './Grafana.svelte';
|
||||
export { default as Trilium } from './Trilium.svelte'
|
||||
|
@ -79,4 +79,8 @@
|
||||
<a href="https://github.com/grafana/grafana" target="_blank">
|
||||
<Icons.Grafana />
|
||||
</a>
|
||||
{:else if service.type === 'trilium'}
|
||||
<a href="https://github.com/zadam/trilium" target="_blank">
|
||||
<Icons.Trilium />
|
||||
</a>
|
||||
{/if}
|
||||
|
BIN
apps/ui/static/trilium.png
Normal file
BIN
apps/ui/static/trilium.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
x
Reference in New Issue
Block a user