Skip to content

Commit c7623e3

Browse files
authored
Update default config in EC2 construct for Restate 1.3.0 (#73)
This change updates the default baseline restate-server config deployed by the EC2 construct. Fixes: #72
1 parent 00126b4 commit c7623e3

File tree

2 files changed

+26
-131
lines changed

2 files changed

+26
-131
lines changed

lib/restate-constructs/single-node-restate-deployment.ts

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export interface SingleNodeRestateProps {
5959
/** Prefix for resources created by this construct that require unique names. */
6060
prefix?: string;
6161

62-
/** Restate Docker image name. Defaults to `latest`. */
62+
/** Restate Docker image name. Defaults to `docker.restate.dev/restatedev/restate`. */
6363
restateImage?: string;
6464

6565
/** Restate Docker image tag. Defaults to `latest`. */
@@ -231,7 +231,7 @@ export class SingleNodeRestateDeployment extends Construct implements IRestateEn
231231
const initScript = ec2.UserData.forLinux();
232232
initScript.addCommands(
233233
"set -euf -o pipefail",
234-
`yum install -y npm && npm install -gq @restatedev/restate@${restateTag}`,
234+
`yum install -y npm && npm install -gq @restatedev/restate@${restateTag} @restatedev/restatectl@${restateTag}`,
235235
"yum install -y docker",
236236
this.mountDataVolumeScript(),
237237

@@ -242,13 +242,13 @@ export class SingleNodeRestateDeployment extends Construct implements IRestateEn
242242

243243
// Start the ADOT collector - needed for X-ray trace forwarding
244244
`if [ "$(docker ps -qa -f name=adot)" ]; then docker stop adot || true; docker rm adot; fi`,
245-
"docker run --name adot --restart on-failure --detach" +
245+
"docker run --name adot --restart on-failure --detach --pull always" +
246246
" -p 4317:4317 -p 55680:55680 -p 8889:8888" +
247247
` public.ecr.aws/aws-observability/aws-otel-collector:${adotTag}`,
248248

249249
// Start the Restate server container
250250
`if [ "$(docker ps -qa -f name=restate)" ]; then docker stop restate || true; docker rm restate; fi`,
251-
"docker run --name restate --restart on-failure --detach" +
251+
"docker run --name restate --restart on-failure --detach --pull always" +
252252
" --volume /etc/restate:/etc/restate" +
253253
" --volume /var/restate:/restate-data" +
254254
" --network=host" +
@@ -356,44 +356,22 @@ export class SingleNodeRestateDeployment extends Construct implements IRestateEn
356356
`roles = [`,
357357
` "worker",`,
358358
` "admin",`,
359-
` "metadata-store",`,
359+
` "metadata-server",`,
360+
` "log-server",`,
360361
`]`,
361362
`node-name = "restate-0"`,
362363
`cluster-name = "${props.restateConfig?.clusterName ?? id}"`,
363-
`allow-bootstrap = true`,
364-
`bootstrap-num-partitions = ${props.restateConfig?.bootstrapNumPartitions ?? 4}`,
365-
`default-thread-pool-size = 3`,
366-
`storage-high-priority-bg-threads = 3`,
367-
`storage-low-priority-bg-threads = 3`,
364+
`default-num-partitions = ${props.restateConfig?.bootstrapNumPartitions ?? 4}`,
368365
`rocksdb-total-memory-size = "${props.restateConfig?.rocksdb?.totalMemorySize?.toMebibytes() ?? 512.0 + " MB"}"`,
369-
`rocksdb-total-memtables-ratio = 0.60`,
370-
`rocksdb-bg-threads = 3`,
371-
`rocksdb-high-priority-bg-threads = 3`,
372-
``,
373-
`[worker]`,
374-
`internal-queue-length = 1000`,
375-
``,
376-
`[worker.storage]`,
377-
`rocksdb-max-background-jobs = 3`,
378-
`rocksdb-statistics-level = "except-detailed-timers"`,
379-
`num-partitions-to-share-memory-budget = 4`,
380366
``,
381367
`[admin]`,
382368
`bind-address = "${this.tlsEnabled ? "127.0.0.1" : "0.0.0.0"}:${RESTATE_ADMIN_PORT}"`,
383369
``,
384370
`[admin.query-engine]`,
385-
`memory-size = "50.0 MB"`,
386-
`query-parallelism = 4`,
371+
`memory-size = "256.0 MiB"`,
387372
``,
388373
`[ingress]`,
389374
`bind-address = "${this.tlsEnabled ? "127.0.0.1" : "0.0.0.0"}:${RESTATE_INGRESS_PORT}"`,
390-
`rocksdb-max-background-jobs = 3`,
391-
`rocksdb-statistics-level = "except-detailed-timers"`,
392-
`writer-batch-commit-count = 1000`,
393-
``,
394-
`[metadata-store.rocksdb]`,
395-
`rocksdb-max-background-jobs = 1`,
396-
`rocksdb-statistics-level = "except-detailed-timers"`,
397375
].join("\n")
398376
);
399377
}

test/__snapshots__/restate-constructs.test.ts.snap

Lines changed: 18 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
657657
set -euf -o pipefail
658658
659659
yum install -y npm && npm install -gq
660-
@restatedev/restate@latest
660+
@restatedev/restate@latest @restatedev/restatectl@latest
661661
662662
yum install -y docker
663663
@@ -693,45 +693,18 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
693693
roles = [
694694
"worker",
695695
"admin",
696-
"metadata-store",
696+
"metadata-server",
697+
"log-server",
697698
]
698699
699700
node-name = "restate-0"
700701
701702
cluster-name = "Restate"
702703
703-
allow-bootstrap = true
704-
705-
bootstrap-num-partitions = 4
706-
707-
default-thread-pool-size = 3
708-
709-
storage-high-priority-bg-threads = 3
710-
711-
storage-low-priority-bg-threads = 3
704+
default-num-partitions = 4
712705
713706
rocksdb-total-memory-size = "512 MB"
714707
715-
rocksdb-total-memtables-ratio = 0.60
716-
717-
rocksdb-bg-threads = 3
718-
719-
rocksdb-high-priority-bg-threads = 3
720-
721-
722-
[worker]
723-
724-
internal-queue-length = 1000
725-
726-
727-
[worker.storage]
728-
729-
rocksdb-max-background-jobs = 3
730-
731-
rocksdb-statistics-level = "except-detailed-timers"
732-
733-
num-partitions-to-share-memory-budget = 4
734-
735708
736709
[admin]
737710
@@ -740,45 +713,30 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
740713
741714
[admin.query-engine]
742715
743-
memory-size = "50.0 MB"
744-
745-
query-parallelism = 4
716+
memory-size = "256.0 MiB"
746717
747718
748719
[ingress]
749720
750721
bind-address = "127.0.0.1:8080"
751722
752-
rocksdb-max-background-jobs = 3
753-
754-
rocksdb-statistics-level = "except-detailed-timers"
755-
756-
writer-batch-commit-count = 1000
757-
758-
759-
[metadata-store.rocksdb]
760-
761-
rocksdb-max-background-jobs = 1
762-
763-
rocksdb-statistics-level = "except-detailed-timers"
764-
765723
EOF
766724
767725
systemctl start docker.service
768726
769727
if [ "$(docker ps -qa -f name=adot)" ]; then docker stop
770728
adot || true; docker rm adot; fi
771729
772-
docker run --name adot --restart on-failure --detach -p
773-
4317:4317 -p 55680:55680 -p 8889:8888
730+
docker run --name adot --restart on-failure --detach
731+
--pull always -p 4317:4317 -p 55680:55680 -p 8889:8888
774732
public.ecr.aws/aws-observability/aws-otel-collector:latest
775733
776734
if [ "$(docker ps -qa -f name=restate)" ]; then docker
777735
stop restate || true; docker rm restate; fi
778736
779737
docker run --name restate --restart on-failure --detach
780-
--volume /etc/restate:/etc/restate --volume
781-
/var/restate:/restate-data --network=host -e
738+
--pull always --volume /etc/restate:/etc/restate
739+
--volume /var/restate:/restate-data --network=host -e
782740
RESTATE_LOG_FORMAT="json" -e RUST_LOG="info" -e
783741
RESTATE_TRACING_ENDPOINT="http://localhost:4317"
784742
--log-driver=awslogs --log-opt awslogs-group=
@@ -996,6 +954,7 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
996954
997955
yum install -y npm && npm install -gq
998956
@restatedev/restate@custom-version
957+
@restatedev/restatectl@custom-version
999958
1000959
yum install -y docker
1001960
@@ -1031,45 +990,18 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
1031990
roles = [
1032991
"worker",
1033992
"admin",
1034-
"metadata-store",
993+
"metadata-server",
994+
"log-server",
1035995
]
1036996
1037997
node-name = "restate-0"
1038998
1039999
cluster-name = "Restate"
10401000
1041-
allow-bootstrap = true
1042-
1043-
bootstrap-num-partitions = 4
1044-
1045-
default-thread-pool-size = 3
1046-
1047-
storage-high-priority-bg-threads = 3
1048-
1049-
storage-low-priority-bg-threads = 3
1001+
default-num-partitions = 4
10501002
10511003
rocksdb-total-memory-size = "512 MB"
10521004
1053-
rocksdb-total-memtables-ratio = 0.60
1054-
1055-
rocksdb-bg-threads = 3
1056-
1057-
rocksdb-high-priority-bg-threads = 3
1058-
1059-
1060-
[worker]
1061-
1062-
internal-queue-length = 1000
1063-
1064-
1065-
[worker.storage]
1066-
1067-
rocksdb-max-background-jobs = 3
1068-
1069-
rocksdb-statistics-level = "except-detailed-timers"
1070-
1071-
num-partitions-to-share-memory-budget = 4
1072-
10731005
10741006
[admin]
10751007
@@ -1078,45 +1010,30 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
10781010
10791011
[admin.query-engine]
10801012
1081-
memory-size = "50.0 MB"
1082-
1083-
query-parallelism = 4
1013+
memory-size = "256.0 MiB"
10841014
10851015
10861016
[ingress]
10871017
10881018
bind-address = "0.0.0.0:8080"
10891019
1090-
rocksdb-max-background-jobs = 3
1091-
1092-
rocksdb-statistics-level = "except-detailed-timers"
1093-
1094-
writer-batch-commit-count = 1000
1095-
1096-
1097-
[metadata-store.rocksdb]
1098-
1099-
rocksdb-max-background-jobs = 1
1100-
1101-
rocksdb-statistics-level = "except-detailed-timers"
1102-
11031020
EOF
11041021
11051022
systemctl start docker.service
11061023
11071024
if [ "$(docker ps -qa -f name=adot)" ]; then docker stop
11081025
adot || true; docker rm adot; fi
11091026
1110-
docker run --name adot --restart on-failure --detach -p
1111-
4317:4317 -p 55680:55680 -p 8889:8888
1027+
docker run --name adot --restart on-failure --detach
1028+
--pull always -p 4317:4317 -p 55680:55680 -p 8889:8888
11121029
public.ecr.aws/aws-observability/aws-otel-collector:latest
11131030
11141031
if [ "$(docker ps -qa -f name=restate)" ]; then docker
11151032
stop restate || true; docker rm restate; fi
11161033
11171034
docker run --name restate --restart on-failure --detach
1118-
--volume /etc/restate:/etc/restate --volume
1119-
/var/restate:/restate-data --network=host -e
1035+
--pull always --volume /etc/restate:/etc/restate
1036+
--volume /var/restate:/restate-data --network=host -e
11201037
RESTATE_LOG_FORMAT="json" -e RUST_LOG="info" -e
11211038
RESTATE_TRACING_ENDPOINT="http://localhost:4317" -e
11221039
RESTATE_INGRESS__ADVERTISED_INGRESS_ENDPOINT="http://restate-ingress"

0 commit comments

Comments
 (0)