Skip to content

Commit

Permalink
Merge pull request #376 from shu-unifra/scroll-sdk-init-monitor
Browse files Browse the repository at this point in the history
add section monitoring
  • Loading branch information
dghelm authored Oct 26, 2024
2 parents 598b638 + c39b815 commit c59a439
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 10 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 64 additions & 9 deletions src/content/docs/en/sdk/guides/aws-deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import ToggleElement from "../../../../../components/ToggleElement.astro";
import AWSCloudflareDNSWildcards from "./_images/aws-cloudflare-dns-wildcards.png";
import AWSCloudflareDNS from "./_images/aws-cloudflare-dns.png";
import AWSEBSDriver from "./_images/aws-ebs-driver.png";
import CreateSlackApp from "./_images/CreateSlackApp.png"
import AddNewWebhookToWorkspace from "./_images/AddNewWebhookToWorkspace.png"
import CopyWebhookURL from "./_images/CopyWebhookURL.png"
import GrafanaDashboard from "./_images/grafana.png"

This guide demonstrates how to deploy a Scroll SDK on Amazon Web Services (AWS) using Elastic Kubernetes Service (EKS) and other managed services.

Expand Down Expand Up @@ -187,14 +191,7 @@ helm repo update
helm install nginx-ingress nginx-stable/ingress-nginx --namespace kube-system
```

2. Prometheus Stack:
```bash
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack --namespace kube-system
```

3. Cert-Manager:
2. Cert-Manager:
```bash
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.0/cert-manager.yaml
```
Expand Down Expand Up @@ -807,4 +804,62 @@ controller:

Some services do not support this without additional configurations (for example, `l2-sequencer` and `l2-bootnode`). We are working on additional info on how to properly run multiple services for load balancing between or for having redundant backups available.

{/* TODO: Fix this comment once we add this documentation */}
{/* TODO: Fix this comment once we add this documentation */}


### Monitoring
You can monitor the cluster's running status through Grafana.
Additionally, you can send alerts via email and Slack using Alertmanager.
If you have configured a domain for Grafana in the previous steps, you can access it by opening http://grafana.yourdomain, where you will see two sets of dashboards. The defalt password of user `admin` is `scroll-sdk`.
<ClickToZoom src={GrafanaDashboard} alt="Copy Webhook URL" />

#### send alert to slack
1. **Create a Slack App**

Open [https://api.slack.com/apps](https://api.slack.com/apps) and click **`Create New App`** if you don't have one already. Select **`From scratch`**, enter a name, and select the workspace.

2. **Activate Incoming Webhooks**

Click the **`Incoming Webhooks`** label on the right side of the page, then turn on **`Activate Incoming Webhooks`**.
<ClickToZoom src={CreateSlackApp} alt="Create Slack App" />

Click the **`Add New Webhook to Workspace`** button.
<ClickToZoom src={AddNewWebhookToWorkspace} alt="Add New Webhook to Workspace" />

Select the channel you want to send alerts to, then copy the Webhook URL.
<ClickToZoom src={CopyWebhookURL} alt="Copy Webhook URL" />


3. **Edit the Config File**

Edit `./values/alert-manager.yaml` to replace it with your webhook URL and your Slack channel name.
```
kube-prometheus-stack:
alertmanager:
config:
global:
resolve_timeout: 5m
slack_api_url: 'https://hooks.slack.com/services/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx' # your webhook url
receivers:
- name: 'slack-alerts'
slack_configs:
- channel: '#scroll-webhook' #your channel name
send_resolved: true
text: '{{ .CommonAnnotations.description }}'
title: '{{ .CommonAnnotations.summary }}'
route:
group_by: ['alertname']
receiver: 'slack-alerts'
routes:
- matchers: []
receiver: 'slack-alerts'
```
This configuration file will send all alerts to your Slack channel. If you need more complex rules, refer to the [Prometheus Alerting Configuration Documentation](https://prometheus.io/docs/alerting/latest/configuration/).

4. **Update to alertmanager**

Use the following command to update Alertmanager:
```
helm upgrade --reuse-values -i scroll-monitor oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-monitor -n $(NAMESPACE) \
--values ./values/alert-manager.yaml
```
64 changes: 63 additions & 1 deletion src/content/docs/en/sdk/guides/digital-ocean-alt-gas-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import DOKubernetesConnect from "./_images/do-cluster-connection.png"
import DOConnectionPools from "./_images/do-connection-pools.png"
import DOConnectionInfo from "./_images/do-connection-info.png"
import DOVPCNetwork from "./_images/do-vpc-network.png"
import CreateSlackApp from "./_images/CreateSlackApp.png"
import AddNewWebhookToWorkspace from "./_images/AddNewWebhookToWorkspace.png"
import CopyWebhookURL from "./_images/CopyWebhookURL.png"
import GrafanaDashboard from "./_images/grafana.png"

This guide documents getting a Scroll SDK deployment working on Digital Ocean's Kubernetes and managed databases, using Cloudflare for DNS.

Expand Down Expand Up @@ -716,4 +720,62 @@ To quickly get started with Grafana, run the following command:
Now, visit the localhost URL in [your browser](http://localhost:3000/). The default password for the `admin` user is `prom-operator`.
Adding an ingress URL, changing the default password or adding LDAP login are all suggested if you use this stack in production. */}
Adding an ingress URL, changing the default password or adding LDAP login are all suggested if you use this stack in production. */}
### Monitoring
You can monitor the cluster's running status through Grafana.
Additionally, you can send alerts via email and Slack using Alertmanager.
If you have configured a domain for Grafana in the previous steps, you can access it by opening http://grafana.yourdomain, where you will see two sets of dashboards. The defalt password of user `admin` is `scroll-sdk`.
<ClickToZoom src={GrafanaDashboard} alt="Copy Webhook URL" />
#### send alert to slack
1. **Create a Slack App**
Open [https://api.slack.com/apps](https://api.slack.com/apps) and click **`Create New App`** if you don't have one already. Select **`From scratch`**, enter a name, and select the workspace.
2. **Activate Incoming Webhooks**
Click the **`Incoming Webhooks`** label on the right side of the page, then turn on **`Activate Incoming Webhooks`**.
<ClickToZoom src={CreateSlackApp} alt="Create Slack App" />
Click the **`Add New Webhook to Workspace`** button.
<ClickToZoom src={AddNewWebhookToWorkspace} alt="Add New Webhook to Workspace" />
Select the channel you want to send alerts to, then copy the Webhook URL.
<ClickToZoom src={CopyWebhookURL} alt="Copy Webhook URL" />
3. **Edit the Config File**
Edit `./values/alert-manager.yaml` to replace it with your webhook URL and your Slack channel name.
```
kube-prometheus-stack:
alertmanager:
config:
global:
resolve_timeout: 5m
slack_api_url: 'https://hooks.slack.com/services/xxxxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx' # your webhook url
receivers:
- name: 'slack-alerts'
slack_configs:
- channel: '#scroll-webhook' #your channel name
send_resolved: true
text: '{{ .CommonAnnotations.description }}'
title: '{{ .CommonAnnotations.summary }}'
route:
group_by: ['alertname']
receiver: 'slack-alerts'
routes:
- matchers: []
receiver: 'slack-alerts'
```
This configuration file will send all alerts to your Slack channel. If you need more complex rules, refer to the [Prometheus Alerting Configuration Documentation](https://prometheus.io/docs/alerting/latest/configuration/).

4. **Update to alertmanager**

Use the following command to update Alertmanager:
```
helm upgrade --reuse-values -i scroll-monitor oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-monitor -n $(NAMESPACE) \
--values ./values/alert-manager.yaml
```

0 comments on commit c59a439

Please sign in to comment.