Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the docker-compose deployment #331

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ $ build/bin/easeprobe -f config.yaml

# 3. Deployment

EaseProbe can be deployed by Systemd, Docker, & Kubernetes.
EaseProbe can be deployed by Systemd, Docker, Docker-Compose, & Kubernetes.

You can find the details in [Deployment Guide](./docs/Deployment.md)

Expand Down
49 changes: 37 additions & 12 deletions docs/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
- [2.2 Configure EaseProbe](#22-configure-easeprobe)
- [2.3 Run EaseProbe](#23-run-easeprobe)
- [3. Docker Deployment](#3-docker-deployment)
- [4. Kubernetes Deployment](#4-kubernetes-deployment)
- [4.1 Creating the ConfigMap for EaseProbe Configuration file](#41-creating-the-configmap-for-easeprobe-configuration-file)
- [4.2 Creating a PV/PVC for EaseProbe SLA data persistent.](#42-creating-a-pvpvc-for-easeprobe-sla-data-persistent)
- [4.3 Deploy EaseProbe](#43-deploy-easeprobe)
- [4.4 Create the EaseProbe Service](#44-create-the-easeprobe-service)
- [5. Kubernetes Deployment Using Helm](#5-kubernetes-deployment-using-helm)
- [4. Docker-Compose Deployment](#4-docker-compose-deployment)
- [5. Kubernetes Deployment](#5-kubernetes-deployment)
- [5.1 Creating the ConfigMap for EaseProbe Configuration file](#51-creating-the-configmap-for-easeprobe-configuration-file)
- [5.2 Creating a PV/PVC for EaseProbe SLA data persistent.](#52-creating-a-pvpvc-for-easeprobe-sla-data-persistent)
- [5.3 Deploy EaseProbe](#53-deploy-easeprobe)
- [5.4 Create the EaseProbe Service](#54-create-the-easeprobe-service)
- [6. Kubernetes Deployment Using Helm](#6-kubernetes-deployment-using-helm)


## 1. Overview
Expand All @@ -23,7 +24,9 @@ This document describes how to deploy EaseProbe on the following ways:

- **Standalone Deployment** - run EaseProbe as a systemd service.
- **Docker Deployment** - run EaseProbe as a container.
- **Docker-Compose Deployment** - run EaseProbe as a docker-compose service which includes a Prometheus and a Grafana.
- **Kubernetes Deployment** - run EaseProbe as a kubernetes pod.
- **Helm Deployment** - run EaseProbe as a kubernetes pod using helm.


## 2. Standalone Deployment
Expand Down Expand Up @@ -161,9 +164,31 @@ docker run -d --name easeprobe \
> - `/opt/data/` is the data file default directory in the container.


## 4. Docker-Compose Deployment

The docker-compose deployment is a simple way to deploy EaseProbe with Prometheus and Grafana.

## 4. Kubernetes Deployment
You can visit [Docker-Compose](../resources/docker-compose/) directory to find the docker-compose file and the configuration files.

```bash
resources/docker-compose
├── compose.yaml # <-- the docker-compose file
├── easeprobe
│ └── config.yaml # <-- the EaseProbe configuration file
├── grafana
│ └── datasource.yaml # <-- the Grafana datasource configuration file
└── prometheus
└── prometheus.yaml # <-- the Prometheus configuration file
```

To start the EaseProbe, Prometheus and Grafana, run the following command.

```bash
cd resources/docker-compose
docker-compose up -d
```

## 5. Kubernetes Deployment

Because EaseProbe needs to persist data, we have to deploy the EaseProbe as Stateful-Set in Kubernetes, this would lead a bit complex deployment process.

Expand All @@ -172,7 +197,7 @@ Because EaseProbe needs to persist data, we have to deploy the EaseProbe as Sta
3. Deploy EaseProbe
4. Create the EaseProbe Service

### 4.1 Creating the ConfigMap for EaseProbe Configuration file
### 5.1 Creating the ConfigMap for EaseProbe Configuration file

The following is an example of a configuration file - `config.yaml`.

Expand Down Expand Up @@ -218,7 +243,7 @@ data:
level: "info"
```

### 4.2 Creating a PV/PVC for EaseProbe SLA data persistent.
### 5.2 Creating a PV/PVC for EaseProbe SLA data persistent.

To be simple, we use the NFS as an example

Expand Down Expand Up @@ -272,7 +297,7 @@ status:
storage: 10Gi
```

### 4.3 Deploy EaseProbe
### 5.3 Deploy EaseProbe

This is the deployment file for EaseProbe.

Expand Down Expand Up @@ -319,7 +344,7 @@ spec:
> - The `configmap-volume-0` is the ConfigMap for `config.yaml`, which is mounted as volume under `/opt/config.yaml` in the container.
> - The `pvc-volume-easeprobe-pvc` is the PVC for SLA data persistent, which is mounted as a volume under `/opt/data` in the container.

### 4.4 Create the EaseProbe Service
### 5.4 Create the EaseProbe Service

The service is used to expose the HTTP port of EaseProbe.

Expand All @@ -342,7 +367,7 @@ spec:
type: ClusterIP
```

## 5 Kubernetes Deployment Using Helm
## 6. Kubernetes Deployment Using Helm

**Add repository**
```
Expand Down
42 changes: 42 additions & 0 deletions resources/docker-compose/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
# Prometheus Service
prometheus:
image: prom/prometheus
container_name: prometheus
command:
- '--config.file=/etc/prometheus/config.yaml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- ./prometheus:/etc/prometheus
- prom_data:/prometheus

# Grafana Service
grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
- ./grafana:/etc/grafana/provisioning/datasources

# EaseProbe Service
easeprobe:
image: megaease/easeprobe
container_name: easeprobe
ports:
- 8181:8181
restart: unless-stopped
volumes:
- ./easeprobe/config.yaml:/opt/config.yaml
- easeprobe_data:/opt/data

# Docker Volumes
volumes:
prom_data:
easeprobe_data:
13 changes: 13 additions & 0 deletions resources/docker-compose/easeprobe/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
http:
- name: Promethus
url: http://prometheus:9090
- name: Grafana
url: http://grafana:3000
notify:
# slack:
# - name: "SLACK_NAME"
# webhook: "https://hooks.slack.com/services/XXXX"
settings:
sla:
schedule: daily
time: "10:00"
9 changes: 9 additions & 0 deletions resources/docker-compose/grafana/datasource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: 1

datasources:
- name: Prometheus
type: prometheus
url: http://prometheus:9090
isDefault: true
access: proxy
editable: true
11 changes: 11 additions & 0 deletions resources/docker-compose/prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
honor_timestamps: true
static_configs:
- targets:
- easeprobe:8181
- prometheus:9090