Skip to content

Commit 9653948

Browse files
authored
chore: bootstrap updates (#30)
1 parent 1e77606 commit 9653948

File tree

7 files changed

+258
-14
lines changed

7 files changed

+258
-14
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"ByronGenesisFile": "/genesis/vector-testnet/byron.json",
3+
"ShelleyGenesisFile": "/genesis/vector-testnet/shelley.json",
4+
"AlonzoGenesisFile": "/genesis/vector-testnet/alonzo.json",
5+
"ConwayGenesisFile": "/genesis/vector-testnet/conway.json",
6+
"SocketPath": "db/node.socket",
7+
"PBftSignatureThreshold": 0.6,
8+
"MaxConcurrencyBulkSync": 1,
9+
"MaxConcurrencyDeadline": 2,
10+
"Protocol": "Cardano",
11+
"RequiresNetworkMagic": "RequiresMagic",
12+
"LastKnownBlockVersion-Major": 6,
13+
"LastKnownBlockVersion-Minor": 0,
14+
"LastKnownBlockVersion-Alt": 0,
15+
"TurnOnLogging": true,
16+
"TurnOnLogMetrics": true,
17+
"minSeverity": "Debug",
18+
"TracingVerbosity": "NormalVerbosity",
19+
"setupBackends": ["KatipBK"],
20+
"defaultBackends": ["KatipBK"],
21+
"hasEKG": 12788,
22+
"hasPrometheus": [
23+
"0.0.0.0",
24+
12798
25+
],
26+
"setupScribes": [
27+
{
28+
"scKind": "FileSK",
29+
"scName": "logs/mainnet.log",
30+
"scFormat": "ScText"
31+
},
32+
{
33+
"scKind": "StdoutSK",
34+
"scName": "stdout",
35+
"scFormat": "ScText"
36+
}
37+
],
38+
"defaultScribes": [
39+
["FileSK", "logs/mainnet.log"],
40+
["StdoutSK", "stdout"]
41+
],
42+
"rotation": {
43+
"rpLogLimitBytes": 5000000,
44+
"rpKeepFilesNum": 3,
45+
"rpMaxAgeHours": 24
46+
},
47+
"TraceBlockFetchClient": false,
48+
"TraceBlockFetchDecisions": false,
49+
"TraceBlockFetchProtocol": false,
50+
"TraceBlockFetchProtocolSerialised": false,
51+
"TraceBlockFetchServer": false,
52+
"TraceBlockchainTime": false,
53+
"TraceChainDb": true,
54+
"TraceChainSyncClient": false,
55+
"TraceChainSyncBlockServer": false,
56+
"TraceChainSyncHeaderServer": false,
57+
"TraceChainSyncProtocol": false,
58+
"TraceDNSResolver": true,
59+
"TraceDNSSubscription": true,
60+
"TraceErrorPolicy": true,
61+
"TraceLocalErrorPolicy": true,
62+
"TraceForge": true,
63+
"TraceHandshake": false,
64+
"TraceIpSubscription": true,
65+
"TraceLocalRootPeers": true,
66+
"TracePublicRootPeers": true,
67+
"TracePeerSelection": true,
68+
"TraceDebugPeerSelection": false,
69+
"TracePeerSelectionActions": true,
70+
"TraceConnectionManager": true,
71+
"TraceServer": true,
72+
"TraceLocalConnectionManager": false,
73+
"TraceLocalServer": false,
74+
"TraceLocalChainSyncProtocol": false,
75+
"TraceLocalHandshake": false,
76+
"TraceLocalTxSubmissionProtocol": false,
77+
"TraceLocalTxSubmissionServer": false,
78+
"TraceMempool": true,
79+
"TraceMux": false,
80+
"TraceTxInbound": false,
81+
"TraceTxOutbound": false,
82+
"TraceTxSubmissionProtocol": false,
83+
"options": {
84+
"mapBackends": {
85+
"cardano.node.metrics": ["EKGViewBK"]
86+
},
87+
"mapScribes": {
88+
"cardano.node.metrics": ["FileSK::logs/mainnet.log"]
89+
},
90+
"mapSeverity": {
91+
"cardano.node.ChainDB": "Notice",
92+
"cardano.node.DnsSubscription": "Debug"
93+
}
94+
},
95+
"TestShelleyHardForkAtEpoch": 0,
96+
"TestAllegraHardForkAtEpoch": 0,
97+
"TestMaryHardForkAtEpoch": 0,
98+
"TestAlonzoHardForkAtEpoch": 0,
99+
"TestBabbageHardForkAtEpoch": 0,
100+
"ExperimentalProtocolsEnabled": true,
101+
"ApplicationName":"cardano-sl",
102+
"ApplicationVersion":0,
103+
"ByronGenesisHash":"abc5e260bf7c5d7008eab849705fc0eae911b638dd6687b1f10cef2e2bc8a713",
104+
"ShelleyGenesisHash":"fb2ca1cc879a9a7600103c2170c9d58e366cd77e17edf39a0e7bc1504f573e88",
105+
"AlonzoGenesisHash":"1cd94b66eade0670885744a858accdb2c3249e43e247db2c66b158050ec6a3e4",
106+
"ConwayGenesisHash":"d43d3f38e01848bddf67e66fe29fbd236aca252de58c7f2c1904c67107c17842"
107+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"EnableLogMetrics":false,
3+
"EnableLogging":true,
4+
"NetworkName":"testnet",
5+
"NodeConfigFile":"config.json",
6+
"PrometheusPort":8080,
7+
"RequiresNetworkMagic":"RequiresMagic",
8+
"defaultBackends":[
9+
"KatipBK"
10+
],
11+
"defaultScribes":[
12+
[
13+
"StdoutSK",
14+
"stdout"
15+
]
16+
],
17+
"minSeverity":"Info",
18+
"options":{
19+
"cfokey":{
20+
"value":"Release-1.0.0"
21+
},
22+
"mapBackends":{
23+
24+
},
25+
"mapSeverity":{
26+
"db-sync-node":"Info",
27+
"db-sync-node.Mux":"Error",
28+
"db-sync-node.Subscription":"Error"
29+
},
30+
"mapSubtrace":{
31+
"#ekgview":{
32+
"contents":[
33+
[
34+
{
35+
"contents":"cardano.epoch-validation.benchmark",
36+
"tag":"Contains"
37+
},
38+
[
39+
{
40+
"contents":".monoclock.basic.",
41+
"tag":"Contains"
42+
}
43+
]
44+
],
45+
[
46+
{
47+
"contents":"cardano.epoch-validation.benchmark",
48+
"tag":"Contains"
49+
},
50+
[
51+
{
52+
"contents":"diff.RTS.cpuNs.timed.",
53+
"tag":"Contains"
54+
}
55+
]
56+
],
57+
[
58+
{
59+
"contents":"#ekgview.#aggregation.cardano.epoch-validation.benchmark",
60+
"tag":"StartsWith"
61+
},
62+
[
63+
{
64+
"contents":"diff.RTS.gcNum.timed.",
65+
"tag":"Contains"
66+
}
67+
]
68+
]
69+
],
70+
"subtrace":"FilterTrace"
71+
},
72+
"#messagecounters.aggregation":{
73+
"subtrace":"NoTrace"
74+
},
75+
"#messagecounters.ekgview":{
76+
"subtrace":"NoTrace"
77+
},
78+
"#messagecounters.katip":{
79+
"subtrace":"NoTrace"
80+
},
81+
"#messagecounters.monitoring":{
82+
"subtrace":"NoTrace"
83+
},
84+
"#messagecounters.switchboard":{
85+
"subtrace":"NoTrace"
86+
},
87+
"benchmark":{
88+
"contents":[
89+
"GhcRtsStats",
90+
"MonotonicClock"
91+
],
92+
"subtrace":"ObservableTrace"
93+
},
94+
"cardano.epoch-validation.utxo-stats":{
95+
"subtrace":"NoTrace"
96+
}
97+
}
98+
},
99+
"rotation":{
100+
"rpKeepFilesNum":10,
101+
"rpLogLimitBytes":5000000,
102+
"rpMaxAgeHours":24
103+
},
104+
"setupBackends":[
105+
"AggregationBK",
106+
"KatipBK"
107+
],
108+
"setupScribes":[
109+
{
110+
"scFormat":"ScText",
111+
"scKind":"StdoutSK",
112+
"scName":"stdout",
113+
"scRotation":null
114+
}
115+
]
116+
}

bootstrap/feature/configs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ resource "kubernetes_config_map" "pgbouncer_certs" {
66

77
data = {
88
"server.crt" = var.pgbouncer_server_crt
9-
"key.crt" = var.pgbouncer_server_key
9+
"server.key" = var.pgbouncer_server_key
1010
}
1111
}

bootstrap/feature/main.tf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ variable "dcu_per_second" {
2323
}
2424
}
2525

26-
variable "postgres_host_1" {
27-
type = string
28-
}
2926

30-
variable "postgres_host_2" {
31-
type = string
27+
variable "postgres_hosts" {
28+
type = list(string)
3229
}
3330

3431
variable "postgres_secret_name" {
@@ -45,4 +42,4 @@ variable "pgbouncer_server_crt" {
4542

4643
variable "pgbouncer_server_key" {
4744
type = string
48-
}
45+
}

bootstrap/feature/operator.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
locals {
2+
postgres_urls = [for host in var.postgres_hosts : "postgres://postgres:$(POSTGRES_PASSWORD)@${host}:5432"]
3+
combined_postgres_urls = join(",", local.postgres_urls)
4+
}
5+
16
resource "kubernetes_deployment_v1" "operator" {
27
wait_for_rollout = false
38

@@ -57,17 +62,17 @@ resource "kubernetes_deployment_v1" "operator" {
5762

5863
env {
5964
name = "DCU_PER_SECOND"
60-
value = "mainnet=${var.dcu_per_second["mainnet"]},preprod=${var.dcu_per_second["preprod"]},preview=${var.dcu_per_second["preview"]}"
65+
value = "mainnet=${var.dcu_per_second["mainnet"]},preprod=${var.dcu_per_second["preprod"]},preview=${var.dcu_per_second["preview"]},vector-testnet=${var.dcu_per_second["vector-testnet"]}"
6166
}
6267

6368
env {
6469
name = "DB_URLS"
65-
value = "postgres://postgres:$(POSTGRES_PASSWORD)@${var.postgres_host_1}:5432,postgres://postgres:$(POSTGRES_PASSWORD)@${var.postgres_host_2}:5432"
70+
value = local.combined_postgres_urls
6671
}
6772

6873
env {
6974
name = "DB_NAMES"
70-
value = "mainnet=dbsync-mainnet,preprod=dbsync-preprod,preview=dbsync-preview"
75+
value = "mainnet=dbsync-mainnet,preprod=dbsync-preprod,preview=dbsync-preview,vector-testnet=dbsync-vector-testnet"
7176
}
7277

7378
env {

bootstrap/pgbouncer/pgbouncer.ini.tftpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[databases]
22
*=host=${db_host} port=5432 auth_user=pgbouncer
3-
mainnet=host=${db_host} port=5432 dbname=dbsync-mainnet auth_user=pgbouncer
4-
preview=host=${db_host} port=5432 dbname=dbsync-preview auth_user=pgbouncer
5-
preprod=host=${db_host} port=5432 dbname=dbsync-preprod auth_user=pgbouncer
3+
dbsync-mainnet=host=${db_host} port=5432 dbname=dbsync-mainnet auth_user=pgbouncer pool_size=60 max_db_connections=70
4+
dbsync-preview=host=${db_host} port=5432 dbname=dbsync-preview auth_user=pgbouncer max_db_connections=10
5+
dbsync-preprod=host=${db_host} port=5432 dbname=dbsync-preprod auth_user=pgbouncer max_db_connections=10
66
cardanodbsync=host=${db_host} port=5432 dbname=dbsync-mainnet auth_user=pgbouncer
77

88
[pgbouncer]
@@ -27,7 +27,7 @@ tcp_keepcnt=9
2727
tcp_keepidle=300
2828
tcp_keepintvl=75
2929
admin_users=pgbouncer
30-
max_db_connections=40
30+
max_db_connections=80
3131
[users]
3232
%{ for user in users ~}
3333
${user.name} = max_user_connections=${user.max_connections}

scripts/reload-pgbouncer-configs.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
echo "updating pgbouncer userlist.txt"
4+
# Combine the files and sort them
5+
cat /etc/pgbouncer/users.txt /opt/bitnami/pgbouncer/conf/userlist.txt | sort > combined_sorted.txt
6+
7+
# Use awk to remove duplicates, keeping the last occurrence
8+
awk '!seen[$1]++' combined_sorted.txt > /opt/bitnami/pgbouncer/conf/userlist.txt
9+
10+
# Clean up intermediate file
11+
rm combined_sorted.txt
12+
13+
echo "updating pgbouncer.ini"
14+
15+
cp /bitnami/pgbouncer/conf/pgbouncer.ini /opt/bitnami/pgbouncer/conf/pgbouncer.ini
16+
17+
echo "reloading pgbouncer"
18+
19+
psql -p 6432 -U pgbouncer -c "RELOAD" pgbouncer

0 commit comments

Comments
 (0)