-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a deployment flavor for NixOS. It contains lots of duplicated config structs, which will get cleaned up in a later change. Change-Id: I58c94b3f911ae02b57af9ea3e3ff3a7b09687dc7
- Loading branch information
Showing
11 changed files
with
401 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package clickhouse | ||
|
||
import ( | ||
schema "github.com/monogon-dev/NetMeta/deploy/single-node/schema" | ||
"netmeta.monogon.tech/xml" | ||
) | ||
|
||
// A stripped down version of the #SamplerConfig found in deploy/single-node/config.cue | ||
#SamplerConfig: [string]: { | ||
device: string | ||
samplingRate: int | ||
anonymizeAddresses: bool | ||
description: string | ||
interface: [string]: { | ||
id: int | ||
description: string | ||
} | ||
vlan: [string]: { | ||
id: int | ||
description: string | ||
} | ||
host: [string]: { | ||
device: string | ||
description: string | ||
} | ||
... | ||
} | ||
|
||
#UserData: autnums: [string]: { | ||
asn: int | ||
name: string | ||
country: string | ||
} | ||
|
||
#Config: { | ||
sampler: #SamplerConfig | ||
userData: #UserData | ||
|
||
dataPath: string | ||
risinfoURL: string | ||
} | ||
|
||
files: { | ||
// Iterate over our required files from schema, e.g. the protobuf files | ||
for k, v in schema.file { | ||
"\(k)": v | ||
} | ||
|
||
// Iterate over all defined files in _files and generate the config files for clickhouse | ||
for k, v in _files { | ||
"\(k).conf": (xml.#Marshal & {in: v._cfg}).out | ||
"\(k).tsv": v.data | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package clickhouse | ||
|
||
import ( | ||
"netmeta.monogon.tech/xml" | ||
) | ||
|
||
files: "risinfo.conf": (xml.#Marshal & {in: yandex: dictionary: { | ||
name: "risinfo" | ||
source: http: { | ||
url: "\(#Config.risinfoURL)/rib.tsv" | ||
format: "TabSeparated" | ||
} | ||
lifetime: 3600 | ||
layout: ip_trie: access_to_key_from_attributes: true | ||
structure: key: attribute: { | ||
name: "prefix" | ||
type: "String" | ||
} | ||
structure: attribute: { | ||
name: "asnum" | ||
type: "UInt32" | ||
null_value: 0 | ||
} | ||
}}).out | ||
|
||
files: "autnums.conf": (xml.#Marshal & {in: yandex: dictionary: { | ||
name: "autnums" | ||
source: clickhouse: query: | ||
#""" | ||
SELECT * FROM dictionaries.risinfo_autnums | ||
UNION ALL | ||
SELECT * FROM dictionaries.user_autnums | ||
"""# | ||
lifetime: 3600 | ||
layout: flat: null | ||
structure: [{ | ||
id: name: "asnum" | ||
}, { | ||
attribute: { | ||
name: "name" | ||
type: "String" | ||
null_value: null | ||
} | ||
}, { | ||
attribute: { | ||
name: "country" | ||
type: "String" | ||
null_value: null | ||
} | ||
}] | ||
}}).out | ||
|
||
files: "risinfo_autnums.conf": (xml.#Marshal & {in: yandex: dictionary: { | ||
name: "risinfo_autnums" | ||
source: http: { | ||
url: "\(#Config.risinfoURL)/autnums.tsv" | ||
format: "TabSeparated" | ||
} | ||
lifetime: 86400 | ||
layout: flat: null | ||
structure: [{ | ||
id: name: "asnum" | ||
}, { | ||
attribute: { | ||
name: "name" | ||
type: "String" | ||
null_value: null | ||
} | ||
}, { | ||
attribute: { | ||
name: "country" | ||
type: "String" | ||
null_value: null | ||
} | ||
}] | ||
}}).out | ||
|
||
files: "format_function.xml": (xml.#Marshal & {in: yandex: functions: { | ||
type: "executable" | ||
name: "formatQuery" | ||
return_type: "String" | ||
argument: [{ | ||
type: "String" | ||
name: "query" | ||
}] | ||
format: "LineAsString" | ||
command: "clickhouse format --oneline" | ||
execute_direct: "0" | ||
}}).out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.