add searxng

This commit is contained in:
Andras Bacsai 2022-10-20 09:44:08 +02:00
parent 22cbbec960
commit 978e35d335
3 changed files with 18 additions and 13 deletions

View File

@ -716,10 +716,10 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
// ...(exposePort ? { ports: [`${exposePort}:${port}`] } : {}),
volumes: template.services[service].volumes,
environment: newEnviroments,
depends_on: template.services[service].depends_on,
ulimits: template.services[service].ulimits,
cap_drop: template.services[service].cap_drop,
cap_add: template.services[service].cap_add,
depends_on: template.services[service]?.depends_on,
ulimits: template.services[service]?.ulimits,
cap_drop: template.services[service]?.cap_drop,
cap_add: template.services[service]?.cap_add,
labels: makeLabelForServices(type),
...defaultComposeConfiguration(network),
}
@ -752,6 +752,7 @@ export async function startService(request: FastifyRequest<ServiceStartStop>) {
}
const composeFileDestination = `${workdir}/docker-compose.yaml`;
await fs.writeFile(composeFileDestination, yaml.dump(composeFile));
console.log(composeFileDestination)
await startServiceContainers(destinationDocker.id, composeFileDestination)
return {}
} catch ({ status, message }) {

View File

@ -8,12 +8,16 @@ export default [
"services": {
"$$id": {
"name": "SearXNG",
"build": {
context: "$$workdir",
dockerfile: "Dockerfile.$$id"
},
"depends_on": [
"$$id-redis"
],
"image": "searxng/searxng:$$core_version",
"volumes": [
"$$id-postgresql-searxng:/etc/searxng",
"$$id-searxng:/etc/searxng",
],
"environment": [
"SEARXNG_BASE_URL=$$config_searxng_base_url",
@ -22,11 +26,13 @@ export default [
"ports": [
"8080"
],
"cap_drop": ['ALL'],
"cap_add": ['CHOWN', 'SETGID', 'SETUID', 'DAC_OVERRIDE'],
"extras": {
"files": [
{
source: "$$workdir/schema.postgresql.sql",
destination: "/docker-entrypoint-initdb.d/schema.postgresql.sql",
source: "$$workdir/settings.yml",
destination: "/etc/searxng/settings.yml",
content: `
# see https://docs.searxng.org/admin/engines/settings.html#use-default-settings
use_default_settings: true

View File

@ -157,23 +157,21 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
const { name, value } = setting
const regex = new RegExp(`\\$\\$config_${name}\\"`, 'gi')
if (service.fqdn && value === '$$generate_fqdn') {
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(regex, service.fqdn + "\""))
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(regex, service.fqdn+ "\""))
} else if (service.fqdn && value === '$$generate_domain') {
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(regex, getDomain(service.fqdn) + "\""))
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(regex, getDomain(service.fqdn)+ "\""))
} else {
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(regex, value + "\""))
}
}
}
// replace $$secret
if (service.serviceSecret.length > 0) {
for (const secret of service.serviceSecret) {
const { name, value } = secret
const regex = new RegExp(`\\$\\$secret_${name}\\"`, 'gi')
const regexHashed = new RegExp(`\\$\\$hashed\\$\\$secret_${name}\\"`, 'gi')
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(regexHashed, bcrypt.hashSync(value, 10)).replaceAll(regex, value))
parsedTemplate = JSON.parse(JSON.stringify(parsedTemplate).replaceAll(`$$hashed$$secret_${name.toLowerCase()}`, bcrypt.hashSync(value, 10)).replaceAll(`$$secret_${name.toLowerCase()}`, value))
}
}
}