fix: template files

This commit is contained in:
Andras Bacsai 2022-11-07 10:44:50 +01:00
parent 2a9bd00a50
commit 85030ab804
3 changed files with 14 additions and 18 deletions

View File

@ -1312,8 +1312,7 @@
- SETUID
- DAC_OVERRIDE
files:
- source: $$workdir/settings.yml
destination: /etc/searxng/settings.yml
- location: /etc/searxng/settings.yml
content: |2-
# see https://docs.searxng.org/admin/engines/settings.html#use-default-settings
@ -1685,8 +1684,7 @@
- POSTGRES_DB=$$config_postgres_db
ports: []
files:
- source: $$workdir/schema.postgresql.sql
destination: /docker-entrypoint-initdb.d/schema.postgresql.sql
- location: /docker-entrypoint-initdb.d/schema.postgresql.sql
content: |2-
-- CreateTable
@ -2615,8 +2613,7 @@
soft: 262144
hard: 262144
files:
- source: $$workdir/clickhouse-config.xml
destination: /etc/clickhouse-server/users.d/logging.xml
- location: /etc/clickhouse-server/users.d/logging.xml
content: >-
<yandex><logger><level>warning</level><console>true</console></logger><query_thread_log
remove="remove"/><query_log remove="remove"/><text_log
@ -2624,15 +2621,12 @@
remove="remove"/><asynchronous_metric_log
remove="remove"/><session_log remove="remove"/><part_log
remove="remove"/></yandex>
- source: $$workdir/clickhouse-user-config.xml
destination: /etc/clickhouse-server/config.d/logging.xml
- location: /etc/clickhouse-server/config.d/logging.xml
content: >-
<yandex><profiles><default><log_queries>0</log_queries><log_query_threads>0</log_query_threads></default></profiles></yandex>
- source: $$workdir/init.query
destination: /docker-entrypoint-initdb.d/init.query
- location: /docker-entrypoint-initdb.d/init.query
content: CREATE DATABASE IF NOT EXISTS plausible;
- source: $$workdir/init-db.sh
destination: /docker-entrypoint-initdb.d/init-db.sh
- location: /docker-entrypoint-initdb.d/init-db.sh
content: >-
clickhouse client --queries-file
/docker-entrypoint-initdb.d/init.query

View File

@ -108,8 +108,8 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
// Generate files for builds
if (template.services[s]?.files?.length > 0) {
if (!template.services[s].build) {
template.services[s].build = {
if (!config[s].build) {
config[s].build = {
context: workdir,
dockerfile: `Dockerfile.${s}`
}
@ -117,12 +117,14 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
let Dockerfile = `
FROM ${template.services[s].image}`
for (const file of template.services[s].files) {
const { source, destination, content } = file;
const { location, content } = file;
const source = path.join(workdir, location);
await fs.mkdir(path.dirname(source), { recursive: true });
await fs.writeFile(source, content);
Dockerfile += `
COPY ./${path.basename(source)} ${destination}`
COPY .${location} ${location}`
}
await fs.writeFile(`${workdir}/Dockerfile.${service}`, Dockerfile);
await fs.writeFile(`${workdir}/Dockerfile.${s}`, Dockerfile);
}
}
const { volumeMounts } = persistentVolumes(id, persistentStorage, config)

File diff suppressed because one or more lines are too long