Skip to content

Commit e6786ca

Browse files
committed
Make ScyllaDB replication factor configurable
1 parent 1082be6 commit e6786ca

File tree

23 files changed

+79
-21
lines changed

23 files changed

+79
-21
lines changed

CLI.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
165165
* `--wasm-runtime <WASM_RUNTIME>` — The WebAssembly runtime to use
166166
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
167167
* `--tokio-blocking-threads <TOKIO_BLOCKING_THREADS>` — The number of Tokio blocking threads to use
168+
* `--storage-replication-factor <STORAGE_REPLICATION_FACTOR>` — The replication factor for the keyspace
169+
170+
Default value: `1`
168171

169172

170173

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ COPY --from=binaries \
116116
COPY --chmod=755 \
117117
docker/server-entrypoint.sh \
118118
docker/server-init.sh \
119+
docker/proxy-entrypoint.sh \
119120
docker/proxy-init.sh \
120121
docker/compose-server-entrypoint.sh \
121122
docker/compose-proxy-entrypoint.sh \

docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242
shard-init:
4343
image: "${LINERA_IMAGE:-linera}"
4444
container_name: shard-init
45-
command: [ "./compose-server-init.sh", "scylladb:tcp:scylla:9042" ]
45+
command: [ "./compose-server-init.sh", "scylladb:tcp:scylla:9042", "1" ]
4646
volumes:
4747
- .:/config
4848
depends_on:

docker/proxy-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
storage_replication_factor=$1
4+
5+
exec ./linera-proxy \
6+
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
7+
--genesis /config/genesis.json \
8+
--storage-replication-factor $storage_replication_factor \
9+
/config/server.json

docker/server-entrypoint.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh
22

3+
storage_replication_factor=$1
4+
35
# Extract the ordinal number from the pod hostname
46
ORDINAL="${HOSTNAME##*-}"
57
storage=$1
@@ -8,4 +10,5 @@ exec ./linera-server run \
810
--storage $storage \
911
--server /config/server.json \
1012
--shard $ORDINAL \
11-
--genesis /config/genesis.json
13+
--genesis /config/genesis.json \
14+
--storage-replication-factor $storage_replication_factor

docker/server-init.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22

33
storage=$1
4+
storage_replication_factor=$2
45

56
while true; do
67
./linera storage check-existence --storage $storage
@@ -13,7 +14,8 @@ while true; do
1314
echo "Database does not exist, attempting to initialize..."
1415
if ./linera-server initialize \
1516
--storage $storage \
16-
--genesis /config/genesis.json; then
17+
--genesis /config/genesis.json \
18+
--storage-replication-factor $storage_replication_factor; then
1719
echo "Initialization successful."
1820
exit 0
1921
else

kubernetes/linera-validator/helmfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ releases:
6666
- scylla-manager/scylla-manager
6767
- scylla-operator/scylla-operator
6868
values:
69-
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml" }}
69+
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml.gotmpl" }}
7070
- name: scylla-manager
7171
version: v1.13.0
7272
namespace: scylla-manager

kubernetes/linera-validator/scylla.values.yaml renamed to kubernetes/linera-validator/scylla.values.yaml.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sysctls:
44
datacenter: validator
55
racks:
66
- name: rack
7-
members: 1
7+
members: {{ env "LINERA_HELMFILE_SET_SCYLLA_REPLICATION_FACTOR" | default 1 }}
88
scyllaConfig: "scylla-config"
99
storage:
1010
capacity: 2Gi

kubernetes/linera-validator/templates/proxy.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,7 @@ spec:
6969
name: linera-port
7070
- containerPort: 20100
7171
name: linera-port-int
72-
command:
73-
[
74-
"./linera-proxy",
75-
"--storage",
76-
"scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042",
77-
"--genesis",
78-
"/config/genesis.json",
79-
]
80-
args: ["/config/server.json"]
72+
command: ["./proxy-entrypoint.sh", {{ .Values.storageReplicationFactor | quote }}]
8173
env:
8274
- name: RUST_LOG
8375
value: {{ .Values.logLevel }}

kubernetes/linera-validator/templates/shards.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
- name: linera-server-initializer
3636
image: {{ .Values.lineraImage }}
3737
imagePullPolicy: {{ .Values.lineraImagePullPolicy }}
38-
command: ["./server-init.sh", {{ .Values.storage | quote }}]
38+
command: ["./server-init.sh", {{ .Values.storage | quote }}, {{ .Values.storageReplicationFactor | quote }}]
3939
env:
4040
- name: RUST_LOG
4141
value: {{ .Values.logLevel }}
@@ -53,7 +53,7 @@ spec:
5353
- name: linera-server
5454
image: {{ .Values.lineraImage }}
5555
imagePullPolicy: {{ .Values.lineraImagePullPolicy }}
56-
command: ["./server-entrypoint.sh", {{ .Values.storage | quote }}]
56+
command: ["./server-entrypoint.sh", {{ .Values.storage | quote }}, {{ .Values.storageReplicationFactor | quote }}]
5757
env:
5858
- name: RUST_LOG
5959
value: {{ .Values.logLevel }}

0 commit comments

Comments
 (0)