File tree Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 3
3
4
4
This is a GitHub Score Application to rank repositories based on forks and starts.
5
5
6
+ More info (Issues):
7
+
8
+ * https://github.com/omidraha/score/issues
6
9
7
10
Stack
8
11
=====
@@ -12,7 +15,7 @@ In this application we used:
12
15
* Python 3.9.7
13
16
* FastAPI 0.68.1
14
17
* Docker 20.10.8
15
- * Docker-compose 1.26.0
18
+ * Docker-compose 1.29.2
16
19
* Docker-compose file version: 3.1
17
20
* Gunicorn 20.1.0
18
21
* uvicorn 0.15.0
@@ -76,6 +79,29 @@ Set `Environments` as previous section and then:
76
79
$ docker-compose -p test run --rm web pytest
77
80
```
78
81
82
+
83
+ Health check
84
+ ============
85
+
86
+ To see health check of service, use this command:
87
+
88
+ ```
89
+ $ docker-compose -p score ps
90
+ ```
91
+
92
+ Sample output:
93
+
94
+ ```
95
+ score_web_1 /start.sh Up (healthy) 0.0.0.0:80->80/tcp,:::80->80/tcp
96
+ ```
97
+
98
+ To see logs of health check:
99
+
100
+ ```
101
+ docker inspect --format='{{json .State.Health}}' score_web_1
102
+ ```
103
+
104
+
79
105
Browse
80
106
======
81
107
@@ -94,9 +120,11 @@ $ curl -X 'POST' 'http://127.0.0.1/score/' -H 'accept: application/json' -H 'Con
94
120
TODO
95
121
====
96
122
97
- Cache external service API response for some short period of time for example for 1 hour in the Redis,
123
+ * Cache external ` GitHub ` service API response for some short period of the time for example for 1 hour in the Redis,
98
124
And maybe provide a new cache option for example ` Cache-Control: no-cache ` header to the ` score ` API
99
125
126
+ * Use async library for communicate with ` Github ` service API
127
+
100
128
101
129
Extra useful links
102
130
==================
Original file line number Diff line number Diff line change 1
- version : ' 3.1 '
1
+ version : ' 3.4 '
2
2
3
3
services :
4
4
web :
@@ -8,3 +8,9 @@ services:
8
8
ports :
9
9
- ' 80:80'
10
10
env_file : .env
11
+ healthcheck :
12
+ test : ./health_check.sh
13
+ interval : 1m30s
14
+ start_period : 10s
15
+ timeout : 3s
16
+ retries : 3
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ curl --fail -s -X ' POST' ' http://127.0.0.1/score/' -H ' accept: application/json' -H ' Content-Type: application/json' -d ' {"repo":"python/cpython"}' || exit 1
You can’t perform that action at this time.
0 commit comments