Last active
September 4, 2025 12:48
-
-
Save muhamadazmy/9b8cccff2ac7ac1f5df0ba8d5b61b25d to your computer and use it in GitHub Desktop.
A development util script to start a restate server
This file contains hidden or 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
| #!/bin/sh | |
| # Parse command line arguments | |
| node_id="" | |
| restate_ver="" | |
| args="" | |
| while [ $# -gt 0 ]; do | |
| case $1 in | |
| -i) | |
| if [ -n "$2" ] && [ "${2#-}" = "$2" ]; then | |
| node_id="$2" | |
| shift 2 | |
| else | |
| echo "Error: -i requires a node ID argument" | |
| exit 1 | |
| fi | |
| ;; | |
| -v) | |
| if [ -n "$2" ] && [ "${2#-}" = "$2" ]; then | |
| restate_ver="$2" | |
| shift 2 | |
| else | |
| echo "Error: -v requires a version argument" | |
| exit 1 | |
| fi | |
| ;; | |
| *) | |
| args="$args $1" | |
| shift | |
| ;; | |
| esac | |
| done | |
| export AWS_DEFAULT_REGION=eu-central-1 | |
| export RESTATE_LOG_FORMAT="compact" | |
| export RESTATE_LOG_FILTER="warn,restate=info" | |
| if [ -n "${restate_ver}" ]; then | |
| restate_bin=restate-server-${restate_ver} | |
| else | |
| restate_bin=restate-server | |
| fi | |
| single=0 | |
| if [ -z "${node_id}" ]; then | |
| # not specified | |
| single=1 | |
| node_id=1 | |
| fi | |
| if [ "${node_id}" -eq 1 ]; then | |
| prefix="" | |
| else | |
| prefix=${node_id} | |
| fi | |
| if [ "${single}" -eq 1 ]; then | |
| # not single | |
| export RESTATE_NODE_NAME=single | |
| else | |
| export RESTATE_NODE_NAME=node-${node_id} | |
| export RESTATE_AUTO_PROVISION=false | |
| export RESTATE_DEFAULT_REPLICATION=2 | |
| fi | |
| export RESTATE_FORCE_NODE_ID=${node_id} | |
| export RESTATE_BIND_ADDRESS=0.0.0.0:${prefix}5122 | |
| export RESTATE_ADVERTISED_ADDRESS=http://127.0.0.1:${prefix}5122 | |
| export RESTATE_ADMIN__BIND_ADDRESS=0.0.0.0:${prefix}9070 | |
| export RESTATE_ADMIN__ADVERTISED_ADDRESS_ENDPOINT=http://127.0.0.1:${prefix}9070 | |
| export RESTATE_INGRESS__BIND_ADDRESS=0.0.0.0:${prefix}8080 | |
| export RESTATE_INGRESS__ADVERTISED_INGRESS_ENDPOINT=http://127.0.0.1:${prefix}8080/ | |
| exec $restate_bin $args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment