Skip to content

Commit 6fd307a

Browse files
committed
Make ScyllaDB replication factor configurable
1 parent f476e61 commit 6fd307a

File tree

16 files changed

+85
-31
lines changed

16 files changed

+85
-31
lines changed

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ COPY --from=binaries \
115115
COPY --chmod=755 \
116116
docker/server-entrypoint.sh \
117117
docker/server-init.sh \
118+
docker/proxy-entrypoint.sh \
118119
docker/proxy-init.sh \
119120
docker/compose-server-entrypoint.sh \
120121
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" ]
45+
command: [ "./compose-server-init.sh", "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,10 +1,13 @@
11
#!/bin/sh
22

3+
storage_replication_factor=$1
4+
35
# Extract the ordinal number from the pod hostname
46
ORDINAL="${HOSTNAME##*-}"
57

68
exec ./linera-server run \
79
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
810
--server /config/server.json \
911
--shard $ORDINAL \
10-
--genesis /config/genesis.json
12+
--genesis /config/genesis.json \
13+
--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,5 +1,6 @@
11
#!/bin/sh
22

3+
storage_replication_factor=$1
34
while true; do
45
./linera storage check-existence --storage "scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042"
56
status=$?
@@ -11,7 +12,8 @@ while true; do
1112
echo "Database does not exist, attempting to initialize..."
1213
if ./linera-server initialize \
1314
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
14-
--genesis /config/genesis.json; then
15+
--genesis /config/genesis.json \
16+
--storage-replication-factor $storage_replication_factor; then
1517
echo "Initialization successful."
1618
exit 0
1719
else

kubernetes/linera-validator/helmfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ releases:
4242
- scylla-manager/scylla-manager
4343
- scylla-operator/scylla-operator
4444
values:
45-
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml" }}
45+
- {{ env "LINERA_HELMFILE_VALUES_SCYLLA" | default "scylla.values.yaml.gotmpl" }}
4646
- name: scylla-manager
4747
version: v1.13.0
4848
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-1
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"]
38+
command: ["./server-init.sh", {{ .Values.storageReplicationFactor | quote }}]
3939
env:
4040
- name: RUST_LOG
4141
value: {{ .Values.logLevel }}
@@ -49,7 +49,7 @@ spec:
4949
- name: linera-server
5050
image: {{ .Values.lineraImage }}
5151
imagePullPolicy: {{ .Values.lineraImagePullPolicy }}
52-
command: ["./server-entrypoint.sh"]
52+
command: ["./server-entrypoint.sh", {{ .Values.storageReplicationFactor | quote }}]
5353
env:
5454
- name: RUST_LOG
5555
value: {{ .Values.logLevel }}

kubernetes/linera-validator/values-local.yaml.gotmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ logLevel: "debug"
77
proxyPort: 19100
88
metricsPort: 21100
99
numShards: {{ env "LINERA_HELMFILE_SET_NUM_SHARDS" | default 10 }}
10+
storageReplicationFactor: {{ env "LINERA_HELMFILE_SET_STORAGE_REPLICATION_FACTOR" | default 1 }}
1011

1112
# Loki
1213
loki-stack:

0 commit comments

Comments
 (0)