Skip to content

Commit

Permalink
Merge pull request #191 from FalkorDB/190-add-aws-support-for-pro-and…
Browse files Browse the repository at this point in the history
…-enterprise-tiers

190 add aws support for pro and enterprise tiers
  • Loading branch information
dudizimber authored Nov 25, 2024
2 parents 0258faa + e095654 commit ebd0086
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
10 changes: 7 additions & 3 deletions falkordb-cluster/cluster-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ create_user() {
redis-cli -p $NODE_PORT $AUTH_CONNECTION_STRING $TLS_CONNECTION_STRING ACL SETUSER $FALKORDB_USER on ">$FALKORDB_PASSWORD" ~* +INFO +PING +HELLO +AUTH +RESTORE +DUMP +DEL +EXISTS +UNLINK +TYPE +FLUSHALL +TOUCH +EXPIRE +PEXPIREAT +TTL +PTTL +EXPIRETIME +RENAME +RENAMENX +SCAN +DISCARD +EXEC +MULTI +UNWATCH +WATCH +ECHO +SLOWLOG +WAIT +WAITAOF +GRAPH.INFO +GRAPH.LIST +GRAPH.QUERY +GRAPH.RO_QUERY +GRAPH.EXPLAIN +GRAPH.PROFILE +GRAPH.DELETE +GRAPH.CONSTRAINT +GRAPH.SLOWLOG +GRAPH.BULK +GRAPH.CONFIG +CLUSTER +COMMAND
}

get_default_memory_limit() {
echo "$(awk '/MemTotal/ {printf "%d\n", (($2 / 1024 - 2330) > 100 ? ($2 / 1024 - 2330) : 100)}' /proc/meminfo)MB"
}

set_memory_limit() {
declare -A memory_limit_instance_type_map
memory_limit_instance_type_map=(
Expand All @@ -164,16 +168,16 @@ set_memory_limit() {
)
if [[ -z $INSTANCE_TYPE ]]; then
echo "INSTANCE_TYPE is not set"
return
MEMORY_LIMIT=$(get_default_memory_limit)
fi

instance_size_in_map=${memory_limit_instance_type_map[$INSTANCE_TYPE]}

if [[ -n $instance_size_in_map && -z $MEMORY_LIMIT ]];then
MEMORY_LIMIT=$instance_size_in_map
elif [[ -z $instance_size_in_map && -z $MEMORY_LIMIT ]];then
echo "INSTANCE_TYPE is not set. Setting 100MB"
MEMORY_LIMIT="100MB"
MEMORY_LIMIT=$(get_default_memory_limit)
echo "INSTANCE_TYPE is not set. Setting to default memory limit"
fi

echo "Setting maxmemory to $MEMORY_LIMIT"
Expand Down
10 changes: 7 additions & 3 deletions falkordb-node/node-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ get_self_host_ip() {
fi
}

get_default_memory_limit() {
echo "$(awk '/MemTotal/ {printf "%d\n", (($2 / 1024 - 2330) > 100 ? ($2 / 1024 - 2330) : 100)}' /proc/meminfo)MB"
}

get_memory_limit() {

declare -A memory_limit_instance_type_map
Expand All @@ -213,16 +217,16 @@ get_memory_limit() {

if [[ -z $INSTANCE_TYPE ]]; then
echo "INSTANCE_TYPE is not set"
return
MEMORY_LIMIT=$(get_default_memory_limit)
fi

instance_size_in_map=${memory_limit_instance_type_map[$INSTANCE_TYPE]}

if [[ -n $instance_size_in_map && -z $MEMORY_LIMIT ]];then
MEMORY_LIMIT=$instance_size_in_map
elif [[ -z $instance_size_in_map && -z $MEMORY_LIMIT ]];then
echo "INSTANCE_TYPE is not set. Setting 100MB"
MEMORY_LIMIT="100MB"
MEMORY_LIMIT=$(get_default_memory_limit)
echo "INSTANCE_TYPE is not set. Setting to default memory limit"
fi

echo "Memory Limit: $MEMORY_LIMIT"
Expand Down
32 changes: 22 additions & 10 deletions omnistrate.enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ services:
node-s: maxMemory
x-omnistrate-capabilities:
backupConfiguration:
backupRetentionInDays: 7
backupPeriodInHours: 12
backupRetentionInDays: 2
backupPeriodInHours: 2
depends_on:
- node-s

Expand All @@ -497,6 +497,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
x-omnistrate-api-params:
- key: nodeInstanceType
description: The size of the node instance. Check the documentation for more information.
Expand Down Expand Up @@ -873,8 +875,8 @@ services:

x-omnistrate-capabilities:
backupConfiguration:
backupRetentionInDays: 7
backupPeriodInHours: 12
backupRetentionInDays: 2
backupPeriodInHours: 2
depends_on:
- node-sz

Expand All @@ -886,6 +888,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
x-omnistrate-api-params:
- key: nodeInstanceType
description: The size of the node instance. Check the documentation for more information.
Expand Down Expand Up @@ -1373,8 +1377,8 @@ services:
node-mz: maxMemory
x-omnistrate-capabilities:
backupConfiguration:
backupRetentionInDays: 7
backupPeriodInHours: 12
backupRetentionInDays: 2
backupPeriodInHours: 2
depends_on:
- node-mz

Expand All @@ -1386,6 +1390,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
x-omnistrate-api-params:
- key: nodeInstanceType
description: The size of the node instance. Check the documentation for more information.
Expand Down Expand Up @@ -1859,8 +1865,8 @@ services:
cluster-sz: maxMemory
x-omnistrate-capabilities:
backupConfiguration:
backupRetentionInDays: 7
backupPeriodInHours: 12
backupRetentionInDays: 2
backupPeriodInHours: 2
depends_on:
- cluster-sz
- cluster-sz-rebalance
Expand All @@ -1873,6 +1879,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
<<: *clusterparam
volumes:
- source: ./data
Expand Down Expand Up @@ -2167,8 +2175,8 @@ services:
cluster-mz: maxMemory
x-omnistrate-capabilities:
backupConfiguration:
backupRetentionInDays: 7
backupPeriodInHours: 12
backupRetentionInDays: 2
backupPeriodInHours: 2
depends_on:
- cluster-mz
- cluster-mz-rebalance
Expand All @@ -2181,6 +2189,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
<<: *clusterparam
volumes:
- source: ./data
Expand Down Expand Up @@ -2299,6 +2309,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
x-omnistrate-api-params:
- key: nodeInstanceType
description: The instance type.
Expand Down
4 changes: 4 additions & 0 deletions omnistrate.pro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
<<: *clusterparam
volumes:
- source: ./data
Expand Down Expand Up @@ -2270,6 +2272,8 @@ services:
instanceTypes:
- cloudProvider: gcp
apiParam: nodeInstanceType
- cloudProvider: aws
apiParam: nodeInstanceType
<<: *clusterparam
volumes:
- source: ./data
Expand Down

0 comments on commit ebd0086

Please sign in to comment.