File tree 5 files changed +26
-3
lines changed
5 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,13 @@ services:
3
3
image : redis
4
4
ports :
5
5
- 6379:6379
6
+ labels :
7
+ - com.packtpub.compose.app=task-manager
6
8
gorest :
7
- build : .
9
+ build :
10
+ context : .
11
+ labels :
12
+ - com.packtpub.compose.app=task-manager
8
13
image : task-manager:0.1
9
14
ports :
10
15
- 8080:8080
@@ -17,4 +22,16 @@ services:
17
22
retries : 5
18
23
start_period : 5s
19
24
depends_on :
20
- - redis
25
+ - redis
26
+ redis-populate :
27
+ image : redis
28
+ entrypoint : [ "/redis-populate.sh","/redis-populate.txt" ]
29
+ depends_on :
30
+ - redis
31
+ env_file :
32
+ - ./env.redis-populate
33
+ volumes :
34
+ - ./redis-populate.txt:/redis-populate.txt
35
+ - ./redis-populate.sh:/redis-populate.sh
36
+ labels :
37
+ - com.packtpub.compose.app=task-manager
Original file line number Diff line number Diff line change
1
+ HOST=redis
2
+ PORT=6379
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ func setupRouter() *gin.Engine {
30
30
31
31
// Health Check
32
32
r .GET ("/ping" , func (c * gin.Context ) {
33
- c .String (500 , "pong" )
33
+ c .String (http . StatusOK , "pong" )
34
34
})
35
35
36
36
// Get tasks
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ cat $1 | redis-cli -h $HOST -p $PORT
Original file line number Diff line number Diff line change
1
+ HMSET task:a3a597d1-26f8-43e5-be05-81373f2c0dc3 Id a3a597d1-26f8-43e5-be05-81373f2c0dc3 Name "Existing Task" Description "A task that was here before" Timestamp 1645393434000
2
+ ZADD tasks 1645393434000 "a3a597d1-26f8-43e5-be05-81373f2c0dc3"
You can’t perform that action at this time.
0 commit comments