-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sd
committed
Jun 23, 2023
1 parent
517abf8
commit 98f00d6
Showing
23 changed files
with
6,827 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# If the cache should start in HA mode or standalone | ||
# accepts 'true|false', defaults to 'false' | ||
HA_MODE=true | ||
|
||
# The connection strings (with hostnames) of the HA instances as a CSV | ||
# Format: 'scheme://hostname:port' | ||
#HA_HOSTS="http://redhac.redhac:8080, http://redhac.redhac:8180 ,http://redhac.redhac:8280" | ||
#HA_HOSTS="https://redhac.redhac.local:8080, https://redhac.redhac.local:8180 ,https://redhac.redhac.local:8280" | ||
HA_HOSTS="https://127.0.0.1:8001, https://127.0.0.1:8002 ,https://127.0.0.1:8003" | ||
|
||
# This can overwrite the hostname which is used to identify each cache member. | ||
# Useful in scenarios, where all members are on the same host or for testing. | ||
#HOSTNAME_OVERWRITE="127.0.0.1:8080" | ||
|
||
# Secret token, which is used to authenticate the cache members | ||
CACHE_AUTH_TOKEN=SuperSafeSecretToken1337 | ||
|
||
# Enable / disable TLS for the cache communication (default: true) | ||
CACHE_TLS=true | ||
|
||
# The path to the server TLS certificate PEM file (default: tls/certs/redhac.local.cert.pem) | ||
CACHE_TLS_SERVER_CERT=tls/redhac.local.cert.pem | ||
# The path to the server TLS key PEM file (default: tls/certs/redhac.local.key.pem) | ||
CACHE_TLS_SERVER_KEY=tls/redhac.local.key.pem | ||
|
||
# The path to the client mTLS certificate PEM file (default: tls/certs/redhac.local.cert.pem) | ||
CACHE_TLS_CLIENT_CERT=tls/redhac.local.cert.pem | ||
# The path to the client mTLS key PEM file (default: tls/certs/redhac.local.key.pem) | ||
CACHE_TLS_CLIENT_KEY=tls/redhac.local.key.pem | ||
|
||
# If not empty, the PEM file from the specified location will be added as the CA certificate chain for validating | ||
# the servers TLS certificate (default: tls/certs/ca-chain.cert.pem) | ||
CACHE_TLS_CA_SERVER=tls/ca-chain.cert.pem | ||
|
||
# If not empty, the PEM file from the specified location will be added as the CA certificate chain for validating | ||
# the clients mTLS certificate (default: tls/certs/ca-chain.cert.pem) | ||
CACHE_TLS_CA_CLIENT=tls/ca-chain.cert.pem | ||
# The domain / CN the client should validate the certificate against. This domain MUST be inside the | ||
# 'X509v3 Subject Alternative Name' when you take a look at the servers certificate with the openssl tool. | ||
# default: redhac.local | ||
CACHE_TLS_CLIENT_VALIDATE_DOMAIN=redhac.local | ||
|
||
# Can be used if you need to overwrite the SNI when the client connects to the server, for instance if you are behind | ||
# a loadbalancer which combines multiple certificates. (default: "") | ||
#CACHE_TLS_SNI_OVERWRITE= | ||
|
||
# Define different buffer sizes for channels between the components | ||
# Buffer for client request on the incoming stream - server side (default: 128) | ||
# Make sense to have the CACHE_BUF_SERVER set to: `(number of total HA cache hosts - 1) * CACHE_BUF_CLIENT` | ||
CACHE_BUF_SERVER=128 | ||
# Buffer for client requests to remote servers for all cache operations (default: 64) | ||
CACHE_BUF_CLIENT=64 | ||
|
||
# Connections Timeouts | ||
# The Server sends out keepalive pings with configured timeouts | ||
|
||
# The keepalive ping interval in seconds (default: 5) | ||
CACHE_KEEPALIVE_INTERVAL=5 | ||
|
||
# The keepalive ping timeout in seconds (default: 5) | ||
CACHE_KEEPALIVE_TIMEOUT=5 | ||
|
||
# The timeout for the leader election. If a newly saved leader request has not reached quorum after the timeout, the | ||
# leader will be reset and a new request will be sent out. | ||
# CAUTION: This should not be below CACHE_RECONNECT_TIMEOUT_UPPER, since cold starts and elections will be problematic in that case. | ||
# value in seconds, default: 5 | ||
CACHE_ELECTION_TIMEOUT=5 | ||
|
||
# These 2 values define the reconnect timeout for the HA Cache Clients. | ||
# The values are in ms and a random between these 2 will be chosen each time to avoid conflicts and race conditions | ||
# (default: 2500) | ||
CACHE_RECONNECT_TIMEOUT_LOWER=2500 | ||
# (default: 5000) | ||
CACHE_RECONNECT_TIMEOUT_UPPER=5000 | ||
|
||
RUST_LOG=info |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea | ||
target | ||
Cargo.lock | ||
tls/ca/ca | ||
tls/ca/intermediate | ||
tls/*.pem |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[package] | ||
name = "redhac" | ||
version = "0.5.0" | ||
edition = "2021" | ||
license = "Apache-2.0 OR MIT" | ||
authors = ["Sebastian Dobe <[email protected]"] | ||
categories = ["caching"] | ||
keywords = ["async", "tokio", "cache", "embedded", "distributed"] | ||
description = "redhac - Rust Embedded Distributed HA Cache" | ||
readme = "README.md" | ||
#repository = "" | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
async-stream = "0.3" | ||
bincode = "1" | ||
cached = { version = "0.44", features = ["async", "async_tokio_rt_multi_thread"] } | ||
chrono = { version = "0.4", default-features = false, features = ["clock", "serde", "std"] } | ||
ctrlc = { version = "3", features = ["termination"] } | ||
dotenvy = "0.15" | ||
flume = "0.10.14" | ||
futures-core = "0.3" | ||
futures-util = "0.3" | ||
gethostname = "0.4" | ||
lazy_static = "1" | ||
nanoid = "0.4" | ||
prost = "0.11" | ||
rand = "0.8" | ||
serde = { version = "1", features = ["derive"] } | ||
tokio = { version = "1.18.6", features = ["full"] } | ||
tokio-stream = "0.1.5" | ||
tonic = { version = "0.9.1", features = ["gzip", "prost", "tls", "transport", "tls-webpki-roots"] } | ||
tower = "0.4" | ||
tracing = "0.1" | ||
|
||
# make minimal versions happy | ||
flate2 = "1.0.6" | ||
|
||
[dev-dependencies] | ||
criterion = "0.5" | ||
pretty_assertions = "1" | ||
tokio-test = "*" | ||
tracing-subscriber = { version = "0.3", features = ["env-filter", "tracing"] } | ||
|
||
[build-dependencies] | ||
tonic-build = "0.9" |
This file contains 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
Oops, something went wrong.