Skip to content

Commit 6a012a8

Browse files
authored
Merge pull request #17 from optiop/feature/update-readme
Update README file
2 parents 3c79ac6 + dcab2cd commit 6a012a8

File tree

4 files changed

+86
-251
lines changed

4 files changed

+86
-251
lines changed

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,86 @@
2222
[
2323
![Discord](https://img.shields.io/discord/1216332587778179072)
2424
](https://discord.gg/WkA4PM2dna)
25+
[
26+
![Blog](https://img.shields.io/badge/blog-optiop-blue)
27+
](https://optiop.org/blog/content/visualize-postgres-data-using-grafana-ecs/index.html)
2528
[
2629
![license](https://img.shields.io/github/license/optiop/postgres-grafana-on-ecs)
2730
](./LICENSE)
2831

2932
</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+
![Architecture](./docs/images/deployment.dark.png)
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/)

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)