updates
This commit is contained in:
1
apps/api/devTags.json
Normal file
1
apps/api/devTags.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,3 +1,35 @@
|
|||||||
|
- templateVersion: 1.0.0
|
||||||
|
defaultVersion: v1.8.6
|
||||||
|
type: appsmith
|
||||||
|
name: Appsmith
|
||||||
|
services:
|
||||||
|
$$id:
|
||||||
|
image: appsmith/appsmith-ce:$$core_version
|
||||||
|
environment:
|
||||||
|
- APPSMITH_MAIL_ENABLED: $$config_appsmith_mail_enabled
|
||||||
|
- APPSMITH_DISABLE_TELEMETRY: $$config_appsmith_disable_telemetry
|
||||||
|
- APPSMITH_DISABLE_INTERCOM: $$config_appsmith_disable_intercom
|
||||||
|
volumes:
|
||||||
|
- $$id-stacks-data:/appsmith-stacks
|
||||||
|
ports:
|
||||||
|
- '8080'
|
||||||
|
variables:
|
||||||
|
- id: $$config_appsmith_mail_enabled
|
||||||
|
name: APPSMITH_MAIL_ENABLED
|
||||||
|
label: Enable Mail
|
||||||
|
defaultValue: false
|
||||||
|
description: ''
|
||||||
|
- id: $$config_appsmith_disable_telemetry
|
||||||
|
name: APPSMITH_DISABLE_TELEMETRY
|
||||||
|
label: Disable Telemetry
|
||||||
|
defaultValue: true
|
||||||
|
description: ''
|
||||||
|
- id: $$config_appsmith_disable_intercom
|
||||||
|
name: APPSMITH_DISABLE_INTERCOM
|
||||||
|
label: Disable Intercom
|
||||||
|
defaultValue: true
|
||||||
|
description: ''
|
||||||
|
documentation: https://hub.docker.com/r/zadam/trilium
|
||||||
- templateVersion: 1.0.0
|
- templateVersion: 1.0.0
|
||||||
defaultVersion: 0.56.2
|
defaultVersion: 0.56.2
|
||||||
type: trilium
|
type: trilium
|
||||||
|
@@ -1,111 +0,0 @@
|
|||||||
// Convert caprover format to coolify format
|
|
||||||
|
|
||||||
import fs from 'fs/promises';
|
|
||||||
import yaml from 'js-yaml';
|
|
||||||
const templateYml = await fs.readFile('./convert.yaml', 'utf8')
|
|
||||||
const template = yaml.load(templateYml)
|
|
||||||
|
|
||||||
const newTemplate = {
|
|
||||||
"templateVersion": "1.0.0",
|
|
||||||
"defaultVersion": "latest",
|
|
||||||
"type": "",
|
|
||||||
"name": "",
|
|
||||||
"description": "",
|
|
||||||
"services": {
|
|
||||||
|
|
||||||
},
|
|
||||||
"variables": []
|
|
||||||
}
|
|
||||||
const version = template.caproverOneClickApp.variables.find(v => v.id === '$$cap_APP_VERSION' || v.id === '$$cap_version').defaultValue || 'latest'
|
|
||||||
|
|
||||||
newTemplate.name = template.caproverOneClickApp.displayName
|
|
||||||
newTemplate.type = template.caproverOneClickApp.displayName.replaceAll(' ', '').toLowerCase()
|
|
||||||
newTemplate.documentation = template.caproverOneClickApp.documentation
|
|
||||||
newTemplate.description = template.caproverOneClickApp.description
|
|
||||||
newTemplate.defaultVersion = version
|
|
||||||
|
|
||||||
const varSet = new Set()
|
|
||||||
|
|
||||||
const caproverVariables = template.caproverOneClickApp.variables
|
|
||||||
for (const service of Object.keys(template.services)) {
|
|
||||||
const serviceTemplate = template.services[service]
|
|
||||||
const newServiceName = service.replaceAll('cap_appname', 'id')
|
|
||||||
const newService = {
|
|
||||||
image: '',
|
|
||||||
command: '',
|
|
||||||
environment: [],
|
|
||||||
volumes: []
|
|
||||||
}
|
|
||||||
const FROM = serviceTemplate.caproverExtra?.dockerfileLines?.find((line) => line.startsWith('FROM'))
|
|
||||||
if (serviceTemplate.image) {
|
|
||||||
newService.image = serviceTemplate.image.replaceAll('cap_APP_VERSION', 'core_version').replaceAll('cap_version', 'core_version')
|
|
||||||
} else if (FROM) {
|
|
||||||
newService.image = FROM.split(' ')[1].replaceAll('cap_APP_VERSION', 'core_version').replaceAll('cap_version', 'core_version')
|
|
||||||
}
|
|
||||||
|
|
||||||
const CMD = serviceTemplate.caproverExtra?.dockerfileLines?.find((line) => line.startsWith('CMD'))
|
|
||||||
if (serviceTemplate.command) {
|
|
||||||
newService.command = serviceTemplate.command
|
|
||||||
} else if (CMD) {
|
|
||||||
newService.command = CMD.replace('CMD ', '').replaceAll('"', '').replaceAll('[', '').replaceAll(']', '').replaceAll(',', ' ').replace(/\s+/g, ' ')
|
|
||||||
} else {
|
|
||||||
delete newService.command
|
|
||||||
}
|
|
||||||
const ENTRYPOINT = serviceTemplate.caproverExtra?.dockerfileLines?.find((line) => line.startsWith('ENTRYPOINT'))
|
|
||||||
|
|
||||||
if (serviceTemplate.entrypoint) {
|
|
||||||
newService.command = serviceTemplate.entrypoint
|
|
||||||
|
|
||||||
} else if (ENTRYPOINT) {
|
|
||||||
newService.entrypoint = ENTRYPOINT.replace('ENTRYPOINT ', '').replaceAll('"', '').replaceAll('[', '').replaceAll(']', '').replaceAll(',', ' ').replace(/\s+/g, ' ')
|
|
||||||
} else {
|
|
||||||
delete newService.entrypoint
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serviceTemplate.environment && Object.keys(serviceTemplate.environment).length > 0) {
|
|
||||||
for (const env of Object.keys(serviceTemplate.environment)) {
|
|
||||||
const foundCaproverVariable = caproverVariables.find((item) => item.id === serviceTemplate.environment[env])
|
|
||||||
|
|
||||||
let value = null;
|
|
||||||
let defaultValue = foundCaproverVariable?.defaultValue ? foundCaproverVariable?.defaultValue.toString()?.replace('$$cap_gen_random_hex', '$$$generate_hex') : ''
|
|
||||||
|
|
||||||
if (serviceTemplate.environment[env].startsWith('srv-captain--$$cap_appname')) {
|
|
||||||
value = `$$config_${env}`.toLowerCase()
|
|
||||||
defaultValue = serviceTemplate.environment[env].replaceAll('srv-captain--$$cap_appname', '$$$id').replace('$$cap_', '').replaceAll('captain-overlay-network', `$$$config_${env}`).toLowerCase()
|
|
||||||
} else {
|
|
||||||
value = '$$config_' + serviceTemplate.environment[env].replaceAll('srv-captain--$$cap_appname', '$$$id').replace('$$cap_', '').replaceAll('captain-overlay-network', `$$$config_${env}`).toLowerCase()
|
|
||||||
}
|
|
||||||
newService.environment.push(`${env}=${value}`)
|
|
||||||
const foundVariable = varSet.has(env)
|
|
||||||
if (!foundVariable) {
|
|
||||||
newTemplate.variables.push({
|
|
||||||
"id": value,
|
|
||||||
"name": env,
|
|
||||||
"label": foundCaproverVariable?.label || '',
|
|
||||||
"defaultValue": defaultValue,
|
|
||||||
"description": foundCaproverVariable?.description || '',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
varSet.add(env)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serviceTemplate.volumes && serviceTemplate.volumes.length > 0) {
|
|
||||||
for (const volume of serviceTemplate.volumes) {
|
|
||||||
const [source, target] = volume.split(':')
|
|
||||||
if (source === '/var/run/docker.sock' || source === '/tmp') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
newService.volumes.push(`${source.replaceAll('$$cap_appname-', '$$$id-')}:${target}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newTemplate.services[newServiceName] = newService
|
|
||||||
const services = { ...newTemplate.services }
|
|
||||||
newTemplate.services = {}
|
|
||||||
for (const key of Object.keys(services).sort()) {
|
|
||||||
newTemplate.services[key] = services[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await fs.writeFile('./caprover_new.yml', yaml.dump([{ ...newTemplate }]))
|
|
||||||
await fs.writeFile('./caprover_new.json', JSON.stringify([{ ...newTemplate }], null, 2))
|
|
@@ -3,7 +3,7 @@ import yaml from 'js-yaml';
|
|||||||
import got from 'got';
|
import got from 'got';
|
||||||
|
|
||||||
const repositories = [];
|
const repositories = [];
|
||||||
const templates = await fs.readFile('../devTemplates.yaml', 'utf8');
|
const templates = await fs.readFile('./apps/api/devTemplates.yaml', 'utf8');
|
||||||
const devTemplates = yaml.load(templates);
|
const devTemplates = yaml.load(templates);
|
||||||
for (const template of devTemplates) {
|
for (const template of devTemplates) {
|
||||||
let image = template.services['$$id'].image.replaceAll(':$$core_version', '');
|
let image = template.services['$$id'].image.replaceAll(':$$core_version', '');
|
||||||
@@ -64,4 +64,4 @@ for (const repository of repositories) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await fs.writeFile('./tags.json', JSON.stringify(services));
|
await fs.writeFile('./apps/api/devTags.json', JSON.stringify(services));
|
@@ -175,7 +175,7 @@ const host = '0.0.0.0';
|
|||||||
await refreshTags()
|
await refreshTags()
|
||||||
await migrateServicesToNewTemplate()
|
await migrateServicesToNewTemplate()
|
||||||
}, 60000)
|
}, 60000)
|
||||||
|
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
await copySSLCertificates();
|
await copySSLCertificates();
|
||||||
}, 10000)
|
}, 10000)
|
||||||
@@ -215,13 +215,14 @@ async function getIPAddress() {
|
|||||||
async function getTagsTemplates() {
|
async function getTagsTemplates() {
|
||||||
const { default: got } = await import('got')
|
const { default: got } = await import('got')
|
||||||
try {
|
try {
|
||||||
const tags = await got.get('https://get.coollabs.io/coolify/service-tags.json').text()
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
const templates = await fs.readFile('./devTemplates.yaml', 'utf8')
|
const templates = await fs.readFile('./devTemplates.yaml', 'utf8')
|
||||||
|
const tags = await fs.readFile('./devTags.json', 'utf8')
|
||||||
await fs.writeFile('./templates.json', JSON.stringify(yaml.load(templates)))
|
await fs.writeFile('./templates.json', JSON.stringify(yaml.load(templates)))
|
||||||
await fs.writeFile('./tags.json', tags)
|
await fs.writeFile('./tags.json', tags)
|
||||||
console.log('Tags and templates loaded in dev mode...')
|
console.log('Tags and templates loaded in dev mode...')
|
||||||
} else {
|
} else {
|
||||||
|
const tags = await got.get('https://get.coollabs.io/coolify/service-tags.json').text()
|
||||||
const response = await got.get('https://get.coollabs.io/coolify/service-templates.yaml').text()
|
const response = await got.get('https://get.coollabs.io/coolify/service-templates.yaml').text()
|
||||||
await fs.writeFile('/app/templates.json', JSON.stringify(yaml.load(response)))
|
await fs.writeFile('/app/templates.json', JSON.stringify(yaml.load(response)))
|
||||||
await fs.writeFile('/app/tags.json', tags)
|
await fs.writeFile('/app/tags.json', tags)
|
||||||
@@ -387,17 +388,17 @@ async function checkProxies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HTTP Proxies
|
// HTTP Proxies
|
||||||
const minioInstances = await prisma.minio.findMany({
|
// const minioInstances = await prisma.minio.findMany({
|
||||||
where: { publicPort: { not: null } },
|
// where: { publicPort: { not: null } },
|
||||||
include: { service: { include: { destinationDocker: true } } }
|
// include: { service: { include: { destinationDocker: true } } }
|
||||||
});
|
// });
|
||||||
for (const minio of minioInstances) {
|
// for (const minio of minioInstances) {
|
||||||
const { service, publicPort } = minio;
|
// const { service, publicPort } = minio;
|
||||||
const { destinationDockerId, destinationDocker, id } = service;
|
// const { destinationDockerId, destinationDocker, id } = service;
|
||||||
if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
// if (destinationDockerId && destinationDocker.isCoolifyProxyUsed) {
|
||||||
await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
// await startTraefikTCPProxy(destinationDocker, id, publicPort, 9000);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -35,9 +35,7 @@ async function applicationConfiguration(traefik: any, remoteId: string | null =
|
|||||||
const { network, id: dockerId } = destinationDocker;
|
const { network, id: dockerId } = destinationDocker;
|
||||||
const isRunning = true;
|
const isRunning = true;
|
||||||
if (buildPack === 'compose') {
|
if (buildPack === 'compose') {
|
||||||
console.log(dockerComposeConfiguration)
|
|
||||||
const services = Object.entries(JSON.parse(dockerComposeConfiguration))
|
const services = Object.entries(JSON.parse(dockerComposeConfiguration))
|
||||||
console.log(services)
|
|
||||||
if (services.length > 0) {
|
if (services.length > 0) {
|
||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
const [key, value] = service
|
const [key, value] = service
|
||||||
@@ -637,80 +635,40 @@ export async function traefikOtherConfiguration(request: FastifyRequest<TraefikO
|
|||||||
};
|
};
|
||||||
} else if (type === 'http') {
|
} else if (type === 'http') {
|
||||||
const service = await prisma.service.findFirst({
|
const service = await prisma.service.findFirst({
|
||||||
where: { id },
|
where: { id }
|
||||||
include: { serviceSetting: true }
|
|
||||||
});
|
});
|
||||||
if (service) {
|
if (service && service?.fqdn) {
|
||||||
if (service.type === 'minio') {
|
const domain = getDomain(service.fqdn);
|
||||||
const domainSetting = service.serviceSetting.find((a) => a.name === 'MINIO_SERVER_URL')?.value
|
const isHttps = service.fqdn.startsWith('https://');
|
||||||
const domain = getDomain(domainSetting);
|
traefik = {
|
||||||
const isHttps = domainSetting.startsWith('https://');
|
[type]: {
|
||||||
traefik = {
|
routers: {
|
||||||
[type]: {
|
[id]: {
|
||||||
routers: {
|
entrypoints: [type],
|
||||||
[id]: {
|
rule: `Host(\`${domain}:${privatePort}\`)`,
|
||||||
entrypoints: [type],
|
service: id
|
||||||
rule: `Host(\`${domain}\`)`,
|
}
|
||||||
service: id
|
},
|
||||||
}
|
services: {
|
||||||
},
|
[id]: {
|
||||||
services: {
|
loadbalancer: {
|
||||||
[id]: {
|
servers: [{ url: `http://${id}:${privatePort}` }]
|
||||||
loadbalancer: {
|
|
||||||
servers: [{ url: `http://${id}:${privatePort}` }]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
if (isHttps) {
|
|
||||||
if (isDev) {
|
|
||||||
traefik[type].routers[id].tls = {
|
|
||||||
domains: {
|
|
||||||
main: `${domain}`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
traefik[type].routers[id].tls = {
|
|
||||||
certresolver: 'letsencrypt'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
};
|
||||||
if (service?.fqdn) {
|
if (isHttps) {
|
||||||
const domain = getDomain(service.fqdn);
|
if (isDev) {
|
||||||
const isHttps = service.fqdn.startsWith('https://');
|
traefik[type].routers[id].tls = {
|
||||||
traefik = {
|
domains: {
|
||||||
[type]: {
|
main: `${domain}`
|
||||||
routers: {
|
|
||||||
[id]: {
|
|
||||||
entrypoints: [type],
|
|
||||||
rule: `Host(\`${domain}:${privatePort}\`)`,
|
|
||||||
service: id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
services: {
|
|
||||||
[id]: {
|
|
||||||
loadbalancer: {
|
|
||||||
servers: [{ url: `http://${id}:${privatePort}` }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (isHttps) {
|
} else {
|
||||||
if (isDev) {
|
traefik[type].routers[id].tls = {
|
||||||
traefik[type].routers[id].tls = {
|
certresolver: 'letsencrypt'
|
||||||
domains: {
|
};
|
||||||
main: `${domain}`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
traefik[type].routers[id].tls = {
|
|
||||||
certresolver: 'letsencrypt'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -6,7 +6,6 @@ import { TraefikOtherConfiguration } from './types';
|
|||||||
const root: FastifyPluginAsync = async (fastify): Promise<void> => {
|
const root: FastifyPluginAsync = async (fastify): Promise<void> => {
|
||||||
fastify.get<OnlyId>('/main.json', async (request, reply) => traefikConfiguration(request, false));
|
fastify.get<OnlyId>('/main.json', async (request, reply) => traefikConfiguration(request, false));
|
||||||
fastify.get<OnlyId>('/remote/:id', async (request) => traefikConfiguration(request, true));
|
fastify.get<OnlyId>('/remote/:id', async (request) => traefikConfiguration(request, true));
|
||||||
|
|
||||||
fastify.get<TraefikOtherConfiguration>('/other.json', async (request, reply) => traefikOtherConfiguration(request));
|
fastify.get<TraefikOtherConfiguration>('/other.json', async (request, reply) => traefikOtherConfiguration(request));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user