|
22 | 22 | [ |
23 | 23 |  |
24 | 24 | ](https://discord.gg/WkA4PM2dna) |
| 25 | +[ |
| 26 | +  |
| 27 | +](https://optiop.org/blog/content/visualize-postgres-data-using-grafana-ecs/index.html) |
25 | 28 | [ |
26 | 29 |  |
27 | 30 | ](./LICENSE) |
28 | 31 |
|
29 | 32 | </div> |
| 33 | + |
| 34 | +The repository contains the terraform code to deploy Grafana and PostgreSql |
| 35 | +on Amazon Elastic Container Service (ECS). |
| 36 | + |
| 37 | +## Table of Contents |
| 38 | +* [Architecture](#architecture) |
| 39 | +* [Code Structure](#code-structure) |
| 40 | +* [Usage](#usage) |
| 41 | +* [References](#references) |
| 42 | + |
| 43 | + |
| 44 | +## Cloud Architecture |
| 45 | + |
| 46 | +The following diagram shows the architecture of the deployment. It consists of |
| 47 | +two services `grafana` and `postgres` running on ECS. The `grafana` service |
| 48 | +is connected to the `postgres` service using the official Grafana PostgreSql |
| 49 | +plugin. Through this connection, Grafana can visualize the data stored in the |
| 50 | +PostgreSql database. Furthermore, the `grafana` service is exposed to the |
| 51 | +internet using an Elastic Load Balancer (ELB). |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +## Code Structure |
| 56 | + |
| 57 | +The repository contains the following files and directories: |
| 58 | + |
| 59 | +```plaintext |
| 60 | +├── LICENSE |
| 61 | +├── README.md |
| 62 | +├── docs |
| 63 | +├── ops |
| 64 | +│ ├── ecs |
| 65 | +│ │ ├── README.md |
| 66 | +│ │ ├── main.tf |
| 67 | +│ │ ├── modules |
| 68 | +│ │ │ ├── cluster |
| 69 | +│ │ │ ├── grafana |
| 70 | +│ │ │ ├── postgres |
| 71 | +│ │ │ └── vpc |
| 72 | +│ │ ├── provider.tf |
| 73 | +│ │ └── variables.tf |
| 74 | +│ └── repository |
| 75 | +│ └── ecr.tf |
| 76 | +└── src |
| 77 | + ├── docker-compose.yaml |
| 78 | + ├── grafana |
| 79 | + │ ├── Dockerfile |
| 80 | + │ ├── grafana.ini |
| 81 | + │ └── provisioning |
| 82 | + │ ├── dashboards |
| 83 | + │ │ └── dashboards.yaml |
| 84 | + │ └── datasources |
| 85 | + │ └── postgres.yaml |
| 86 | + └── postgres |
| 87 | + ├── Dockerfile |
| 88 | + └── init.sql |
| 89 | +``` |
| 90 | + |
| 91 | +* `src` contains the source code for the `grafana` and `postgres` services. |
| 92 | +* `ops/repository` contains the terraform code to create the Elastic Container |
| 93 | + Registry (ECR) repository, and required IAM roles. |
| 94 | +* `ops/ecs` contains the terraform code to create the ECS cluster, services, |
| 95 | + |
| 96 | +## Usage |
| 97 | + |
| 98 | +1. Follow the instructions in the [ops/repository/README.md](./ops/repository/README.md) |
| 99 | + to create the Elastic Container Registry (ECR) repository and required IAM roles. |
| 100 | +2. Follow the instruction in the [ops/ecs/README.md](./ops/ecs/README.md) to deploy |
| 101 | + the `grafana` and `postgres` services on Amazon Elastic Container Service (ECS). |
| 102 | + |
| 103 | + |
| 104 | +## References |
| 105 | +* [Grafana](https://grafana.com/) |
| 106 | +* [PostgreSql](https://www.postgresql.org/) |
| 107 | +* [Amazon Elastic Container Service](https://aws.amazon.com/ecs/) |
0 commit comments