Skip to content

Commit

Permalink
improved README.md, added docker-compose-shipper example
Browse files Browse the repository at this point in the history
  • Loading branch information
opaolini committed Jun 24, 2019
1 parent 5a130e9 commit da99637
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 6 deletions.
53 changes: 47 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,35 @@ helm install stable/grafana \
--set service.type=LoadBalancer
```

Access it via port-forward:
After installing the chart, you can grab the pod name:

```
kubectl get pods -n grafana
.
.
.
NAME READY STATUS RESTARTS AGE
grafana-9995876cc-j2kdz 1/1 Running 1 1m
```

Access it via port-forwarding `3000`, which in the above case is `grafana-9995876cc`:
```
k port-forward -n grafana grafana-9995876cc-j2kdz 3000
kubectl port-forward -n grafana POD_NAME 3000
```

You can import a custom dashboard that will display basic cluster health: https://grafana.com/dashboards/6417

To do so navigate to http://localhost:3000, on the hover menu import a dashboard:
![Importing Dashboard](resources/images/dashboard_import.png)

Fill in the `ID` and the datasource:
![ID](resources/images/dashboard_id.png)


![ID](resources/images/dashboard_datasource.png)


### Elasticsearch

More info: [env/elastic](env/elastic/README.md)
Expand All @@ -94,9 +116,9 @@ After that you should see, that the [CustomResourceDefinition](https://kubernete
➜ bootstrap-infra git:(master) ✗ kubectl get CustomResourceDefinitions
NAME CREATED AT
elasticsearchclusters.enterprises.upmc.com 2019-06-22T11:44:46Z
➜ bootstrap-infra git:(master) ✗ k get elasticsearchclusters
➜ bootstrap-infra git:(master) ✗ kubectl get elasticsearchclusters
No resources found.
➜ bootstrap-infra git:(master) ✗ k get foo
➜ bootstrap-infra git:(master) ✗ kubectl get foo
error: the server doesn't have a resource type "foo"
```

Expand All @@ -121,19 +143,38 @@ fluent-bit-wlv62 1/1 Running 0

This also deploys an elasticsearch-curator which purges the indices every 7 days. This is configurable in `values.yaml`.

You can access the deployed kibana like so:
You can access the deployed kibana by grabbing the name and port-forwarding like in the case of grafana like so:
```
kubectl port-forward efk-kibana-d7b549b5c-n7b82 5601 -n logging
```

After that, you will be asked to create an index pattern and select a time filter. You can use `kube*` to match across all indices (which come in as `kubernetes_cluster-YYYY.MM.DD`) and `@timestamp` for the filter:

![Indices](resources/images/kibana_indices.png)

For local development, once you install all the requests

![Filter](resources/images/kibana_time.png)


### Cleaning Up

To stop the `minikube` cluster:
```
minikube stop
```

And to clean it up and delete the artifacts:
```
minikube delete
```

## Production Setup (AWS EKS Example)

Setup the cluster using the provided terraform configs from the major cloud providers (or add your own). All the outputs from the terraform configs include the guide on how to setup `kubectl` for the deployed cluster.

### Terraform
From

### Helm Initialization
```bash
$ kubectl create serviceaccount tiller --namespace kube-system
Expand Down
17 changes: 17 additions & 0 deletions examples/docker-compose-shipper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
About
===

This `docker-compose` file spins up a [0x-mesh](https://github.com/0xProject/0x-mesh) with a preconfigured logging driver as well as a `fluentbit` logger which ships the logs to a ES-cluster running on minikube.

To enable this example, we need to first port-forward the `elasticsearch-client` for it to be available

## dockerhost container

If running on MacOS you [cannot use the host network](https://docs.docker.com/network/network-tutorial-host/#prerequisites) hence a workaround using a forwarder.

Refer to: https://github.com/qoomon/docker-host


## TODOs

- [ ] Add a remote and authenticated log-shipping example to the produciton cluster.
1 change: 1 addition & 0 deletions examples/docker-compose-shipper/data/key/privkey
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CAISIEi81s34n6VngHf7OsZs/YeWXXAKfj4VMdAcnJ5EPVxi
38 changes: 38 additions & 0 deletions examples/docker-compose-shipper/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

services:
ganache:
image: 0xorg/mesh-ganache-cli
ports:
- "8545:8545"
mesh:
image: 0xorg/mesh:latest
logging:
driver: fluentd
options:
fluentd-address: localhost:24224
volumes:
- ./data:/usr/mesh/0x_mesh
links:
- ganache
- fluentbit
ports:
- "8080:60557"
- "3000:3000"
environment:
- ETHEREUM_NETWORK_ID=50
- ETHEREUM_RPC_URL=http://ganache:8545
- VERBOSITY=5
- RUN_TELEMETRY=true
- BLOCK_POLLING_INTERVAL=5s
fluentbit:
image: fluent/fluent-bit:1.0.4
ports:
- "24224:24224"
command: /fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit.conf
volumes:
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
dockerhost:
image: qoomon/docker-host
cap_add: [ 'NET_ADMIN', 'NET_RAW' ]
restart: on-failure
17 changes: 17 additions & 0 deletions examples/docker-compose-shipper/fluent-bit.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[SERVICE]
Flush 5
Daemon Off
Log_Level debug

[INPUT]
Name forward
Listen fluentbit
Port 24224

[OUTPUT]
Name es
Match *
Host dockerhost
Port 9200
Index mesh_outside
Type docker
Binary file added resources/images/dashboard_datasource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/dashboard_id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/dashboard_import.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/kibana_indices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/kibana_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit da99637

Please sign in to comment.