-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add testdrive example for Elasticsearch setup (#54)
- Loading branch information
Showing
7 changed files
with
440 additions
and
0 deletions.
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 @@ | ||
*.env |
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,43 @@ | ||
# Cardano => Elasticsearch Testdrive | ||
|
||
## Introduction | ||
|
||
This is a reference implementation to show how _Oura_ can be leveradged to build read from a Cardano relay node into an Elasticsearch cluster. | ||
|
||
## Prerequisites | ||
|
||
- K8s Cluster | ||
- kubectl | ||
- Skaffold | ||
|
||
## Deployment | ||
|
||
Install Elasticsearch official Kubernetes operator: | ||
|
||
``` | ||
kubectl create -f https://download.elastic.co/downloads/eck/1.9.1/crds.yaml | ||
kubectl apply -f https://download.elastic.co/downloads/eck/1.9.1/operator.yaml | ||
``` | ||
|
||
Create a k8s namespace for the testdrive: | ||
|
||
``` | ||
kubectl create namespace cardano2elastic | ||
``` | ||
|
||
Deploy the Elasticsearch + Kibana resources: | ||
|
||
``` | ||
skaffold run --module elastic --namespace cardano2elastic | ||
``` | ||
|
||
Setup an index template to store _Oura_ events: | ||
|
||
``` | ||
export ELASTIC_AUTH=user:pass | ||
cd scripts && ./setup-index.sh | ||
``` | ||
|
||
``` | ||
skaffold run --namespace cardano2elastic | ||
``` |
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,41 @@ | ||
apiVersion: elasticsearch.k8s.elastic.co/v1 | ||
kind: Elasticsearch | ||
metadata: | ||
name: sink | ||
spec: | ||
version: 7.16.1 | ||
nodeSets: | ||
- name: default | ||
count: 1 | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: elasticsearch-data # Do not change this name unless you set up a volume mount for the data path. | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 50Gi | ||
podTemplate: | ||
spec: | ||
containers: | ||
- name: elasticsearch | ||
env: | ||
- name: ES_JAVA_OPTS | ||
value: -Xms2g -Xmx2g | ||
resources: | ||
requests: | ||
memory: 4Gi | ||
cpu: 1 | ||
limits: | ||
memory: 4Gi | ||
--- | ||
apiVersion: kibana.k8s.elastic.co/v1 | ||
kind: Kibana | ||
metadata: | ||
name: sink | ||
spec: | ||
version: 7.16.1 | ||
count: 1 | ||
elasticsearchRef: | ||
name: sink |
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,71 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: oura | ||
data: | ||
daemon.toml: |- | ||
[source] | ||
type = "N2N" | ||
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"] | ||
magic = "mainnet" | ||
# it will start from way back, so we get a lot of data | ||
since = [4492799, "f8084c61b6a238acec985b59310b6ecec49c0ab8352249afd7268da5cff2a457"] | ||
[[filters]] | ||
type = "Fingerprint" | ||
[sink] | ||
type = "Elastic" | ||
url = "https://sink-es-http:9200" | ||
index = "oura.sink.v0.mainnet" | ||
idempotency = true | ||
[sink.credentials] | ||
type = "Basic" | ||
username = "elastic" | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: oura | ||
labels: | ||
app: oura | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: oura | ||
template: | ||
metadata: | ||
labels: | ||
app: oura | ||
spec: | ||
containers: | ||
- name: main | ||
image: ghcr.io/txpipe/oura:v0.3.10 | ||
env: | ||
- name: "RUST_LOG" | ||
value: "info" | ||
- name: "OURA_SINK_CREDENTIALS_PASSWORD" | ||
valueFrom: | ||
secretKeyRef: | ||
key: elastic | ||
name: sink-es-elastic-user | ||
resources: | ||
requests: | ||
memory: 100Mi | ||
cpu: 50m | ||
limits: | ||
memory: 500Mi | ||
cpu: 200m | ||
args: | ||
- "daemon" | ||
volumeMounts: | ||
- mountPath: /etc/oura | ||
name: oura-config | ||
volumes: | ||
- name: oura-config | ||
configMap: | ||
name: oura |
Oops, something went wrong.