Skip to content

Commit d9f9858

Browse files
committed
Update README.md add architecture diagram
1 parent 3c79ac6 commit d9f9858

File tree

4 files changed

+83
-251
lines changed

4 files changed

+83
-251
lines changed

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,78 @@
2727
](./LICENSE)
2828

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

docs/images/deployment.dark.png

270 KB
Loading

ops/ecs/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Elastic Container Service (ECS) Stack
22

3-
![Architecture](./docs/architecture.svg)
4-
53
## Usage
64

75
1. Create a secret name `grafana-postgres-on-ecs` in AWS Secret Manager with the following secrets.
@@ -10,17 +8,18 @@
108
| --- | --- |
119
| `DATABASE_USERNAME` | Username for database (e.g. postgres) |
1210
| `DATABASE_PASSWORD` | Password for database (e.g. passw0rd) |
13-
| `DATABASE_HOST` | `database.service.local` |
14-
| `DATABASE_NAME` | Name of the database (e.g. sylla) |
11+
| `DATABASE_HOST` | `postgres.service.local` |
12+
| `DATABASE_NAME` | Name of the database (e.g. postgres) |
1513

16-
2. We need to have two ECR repositories `grafana` and `postgres`. Set the variables
17-
set the `repository_name` variable in `modules/grafana/variables.tf` and `modules/postgres/variables.tf`
18-
respectively. The subdirectory `repo/ops/repository` contains the
19-
terraform code to create the ECR repositories.
14+
2. We need to have two ECR repositories `grafana` and `postgres`. Set the variable
15+
`repository_name` in `modules/grafana/variables.tf` and `modules/postgres/variables.tf`.
16+
The subdirectory `repo/ops/repository` contains the
17+
terraform code to create the ECR repositories, and the subdirectory `repo/src/`
18+
contains the Dockerfile and the code for the services.
2019

2120

2221
3. Add your public key to `main.tf` to allow ssh access to the EC2 instances.
2322

2423

2524
## References
26-
* [How to Deploy an AWS ECS Cluster with Terraform](https://spacelift.io/blog/terraform-ecs)]
25+
* [Amazon Elastic Container Service (ECS)](https://aws.amazon.com/ecs/)

0 commit comments

Comments
 (0)