Skip to content

Commit fead4f1

Browse files
committed
add demo application readme
1 parent ad722e7 commit fead4f1

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

06-demo-application/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Demo Application
2+
3+
![](./readme-assets/screenshot.png)
4+
5+
## Minimal 3 tier web application
6+
7+
- **React frontend:** Uses react query to load data from the two apis and display the result
8+
- **Node.js and Go APIs:** Both have `/` and `/ping` endpoints. `/` queries the Database for the current time and the number of requests for each api recorded within the database, and `/ping` returns `pong`
9+
- **Postgres Database:** An empty PostgreSQL database with no tables or data. Used to show how to set up connectivity. The API applications execute `SELECT NOW() as now;` to determine the current time to return.
10+
- **Python Load Generator:** Queries one of either the Node.js or Go APIs at a configurable speed.
11+
12+
![](./readme-assets/request-diagram.png)
13+
14+
The demo application builds upon the one used in the [DevOps Directive Docker Course](https://github.com/sidpalas/devops-directive-docker-course/tree/main/05-example-web-application).
15+
16+
It adds a simple load generator written in python and adds a simple database schema to track requests to each API.
17+
18+
## Running the Application
19+
20+
While the whole point of this course is that you probably won't want/need to run the application locally, we can do so as a starting point.
21+
22+
The Taskfile contains the commands to start each application:
23+
24+
### Postgres
25+
26+
It's way more convenient to run postgres in a container, so we will do that.
27+
28+
`task postgresql:run-postgres` will start postgres in a container and publish port 5432 from the container to your localhost.
29+
30+
**🚨 NOTE:** After starting the database, you need to run the migration file in `./postgresql/migrations` to create the table that the APIs use. This can be done with `postgresql:run-psql-init-script`.
31+
32+
### api-node
33+
34+
To run the node api you will need to `task api-node:install` to install the dependencies.
35+
36+
After installing the dependencies, `task api-node:run` will run the api in development mode with nodemon for restarting the app when you make source code changes.
37+
38+
### api-golang
39+
40+
To run the golang api you will need to run `task api-golang:install`.
41+
42+
After installing the dependencies, `task api-golang:run` will build and run the api.
43+
44+
### client-react
45+
46+
Like api-node, you will first need to install the dependencies with `task client-react:install`.
47+
48+
After installing the dependencies, `task client-react:run` will use vite to run the react app in development mode.
49+
50+
### load-generator-python
51+
52+
This service uses poetry to manage dependencies. You will need to install the dependencies with `task load-generator-python:install`.
53+
54+
After installing the dependencies, `task load-generator-python:run` will run the application.
Loading
40.6 KB
Loading

0 commit comments

Comments
 (0)