Skip to content

Commit c0d90cd

Browse files
committed
Add local run instructions to readme file
Add filter examples to readme file
1 parent 57fb38f commit c0d90cd

File tree

1 file changed

+91
-19
lines changed

1 file changed

+91
-19
lines changed

Readme.md

Lines changed: 91 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,121 @@ If you like this repo or found it helpful, please give it a star. Thanks!
3434

3535
## How to run
3636

37-
### Docker start
37+
### Run on local system
3838

39+
#### Start dependencies on docker
40+
```bash
41+
docker compose -f "docker/docker-compose.yml" up -d setup elasticsearch kibana filebeat postgres pgadmin redis prometheus node-exporter alertmanager grafana
3942
```
40-
docker compose -f "docker/docker-compose.yml" up -d --build
43+
44+
#### Install swagger and run app
45+
```bash
46+
cd src
47+
go install github.com/swaggo/swag/cmd/swag@latest
48+
cd src/cmd
49+
go run main.go
50+
```
51+
52+
##### Address: [http://localhost:5005](http://localhost:5005)
53+
54+
#### Stop
55+
```
56+
docker compose -f "docker/docker-compose.yml" down
57+
```
58+
59+
#### Examples
60+
61+
##### Login
4162
```
63+
curl -X 'POST' \
64+
'http://localhost:5005/api/v1/users/login-by-username' \
65+
-H 'accept: application/json' \
66+
-H 'Content-Type: application/json' \
67+
-d '{
68+
"password": "12345678",
69+
"username": "admin"
70+
}'
71+
```
72+
73+
##### Sample filters request body
4274

43-
#### Web API
75+
###### City filter and sort
76+
77+
```
78+
{
79+
"filter": {
80+
"Name": {
81+
"filterType": "text",
82+
"from": "t",
83+
"type": "contains"
84+
}
85+
},
86+
"pageNumber": 1,
87+
"pageSize": 10,
88+
"sort": [
89+
{
90+
"colId": "name",
91+
"sort": "desc"
92+
}
93+
]
94+
}
95+
```
4496

45-
##### Run local manually [http://localhost:5005](http://localhost:5005)
4697

47-
##### Run in docker [http://localhost:9001](http://localhost:9001)
98+
###### City in range filter
4899

49100
```
50-
Token Url: http://localhost:5005/api/v1/users/login-by-username
101+
{
102+
"filter": {
103+
"Id": { // Column name
104+
"filterType": "number", // number, text,...
105+
"from": "1",
106+
"to": "7",
107+
"type": "inRange" // contains, equals,...
108+
}
109+
},
110+
"pageNumber": 1,
111+
"pageSize": 10,
112+
"sort": [
113+
{
114+
"colId": "name",
115+
"sort": "desc"
116+
}
117+
]
118+
}
119+
```
120+
121+
### Run project with dependencies on Docker
122+
123+
```
124+
docker compose -f "docker/docker-compose.yml" up -d --build
125+
```
126+
127+
#### Web API Run in docker [http://localhost:9001](http://localhost:9001)
128+
129+
```
130+
Token Url: http://localhost:9001/api/v1/users/login-by-username
51131
Username: admin
52132
Password: 12345678
53133
```
54134

55-
#### Kibana
56-
57-
##### [http://localhost:5601](http://localhost:5601)
135+
#### Kibana [http://localhost:5601](http://localhost:5601)
58136

59137
```
60138
Username: elastic
61139
Password: @aA123456
62140
```
63141

64-
#### Grafana
142+
#### Prometheus [http://localhost:9090](http://localhost:9090)
65143

66-
##### [http://localhost:3000](http://localhost:3000)
144+
#### Grafana [http://localhost:3000](http://localhost:3000)
67145

68146
```
69147
Username: admin
70148
Password: foobar
71149
```
72150

73-
#### PgAdmin
74-
75-
##### [http://localhost:8090](http://localhost:8090)
151+
#### PgAdmin [http://localhost:8090](http://localhost:8090)
76152

77153
```
78154
Username: h.naimaei@gmail.com
@@ -88,14 +164,10 @@ Username: postgres
88164
Password: admin
89165
```
90166

91-
#### Prometheus
92-
93-
##### [http://localhost:9090](http://localhost:9090)
94-
95167
### Docker Stop
96168

97169
```
98-
docker compose --file 'docker/docker-compose.yml' --project-name 'docker' down
170+
docker compose -f 'docker/docker-compose.yml' --project-name 'docker' down
99171
```
100172

101173
### Linux

0 commit comments

Comments
 (0)