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
admin: | |
address: | |
socket_address: { address: 0.0.0.0, port_value: 9901 } | |
node: | |
id: default | |
cluster: echo | |
static_resources: |
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/bash | |
ansible -i hosts nodes -b -m copy -a "src=certs/registry.crt dest=/usr/local/share/ca-certificates/registry.crt" | |
ansible -i hosts nodes -b -m shell -a "update-ca-certificates" |
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/bash | |
# Find ClusterIPs of Redis nodes | |
export REDIS_NODES=$(kubectl get pods -l app=redis-cluster -n redis -o json | jq -r '.items | map(.status.podIP) | join(":6379 ")'):6379 | |
# Activate the Redis cluster | |
kubectl exec -it redis-cluster-0 -n redis -- redis-cli --cluster create --cluster-replicas 1 ${REDIS_NODES} | |
# Check if all went well | |
for x in $(seq 0 5); do echo "redis-cluster-$x"; kubectl exec redis-cluster-$x -n redis -- redis-cli role; echo; done |
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
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: redis-cluster | |
namespace: redis | |
spec: | |
serviceName: redis-cluster | |
replicas: 6 | |
selector: | |
matchLabels: |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: redis-cluster | |
namespace: redis | |
data: | |
update-node.sh: | | |
#!/bin/sh | |
REDIS_NODES="/data/nodes.conf" | |
sed -i -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" ${REDIS_NODES} |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: prometheus-server-conf | |
labels: | |
name: prometheus-server-conf | |
namespace: monitoring | |
data: | |
prometheus.yml: |- | |
global: |
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
use std::net::SocketAddr; | |
use std::str::FromStr; | |
use futures::StreamExt; | |
use tokio::task; | |
use tokio::sync::mpsc; | |
use tokio_stream::wrappers::UnboundedReceiverStream; | |
use uuid::Uuid; | |
use warp::*; |
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
// ... | |
impl Validator { | |
// ... | |
pub async fn is_valid(&self, key: String) -> bool { | |
let result: bool = self | |
.contract | |
.query("isValid", (key.clone(),), None, Options::default(), None) |
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
// ... | |
impl Validator { | |
pub fn new() -> Self { | |
let infura_project = | |
std::env::var("INFURA_PROJECT").expect("Please set the INFURA_PROJECT env variable"); | |
let network_url = format!("https://kovan.infura.io/v3/{}", infura_project); | |
let vault_address = { | |
let string = |
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
use web3::{ | |
contract::{Contract, Options}, | |
transports::Http, | |
types::H160, | |
}; | |
#[derive(Clone)] | |
pub struct Validator { | |
contract: Contract<Http>, | |
} |
NewerOlder