forked from jikan-me/jikan-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
122 lines (116 loc) · 3.15 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
version: '3.8'
volumes:
mongo-data: { }
redis-data: { }
typesense-data: { }
networks:
jikan_network: { }
secrets:
db_username:
file: db_username.txt
db_password:
file: db_password.txt
db_admin_username:
file: db_admin_username.txt
db_admin_password:
file: db_admin_password.txt
redis_password:
file: redis_password.txt
typesense_api_key:
file: typesense_api_key.txt
services:
jikan_rest:
image: "jikanme/jikan-rest:${_JIKAN_API_VERSION:-latest}"
user: "${APP_UID:-10001}:${APP_GID:-10001}"
networks:
- jikan_network
secrets:
- db_username
- db_password
- typesense_api_key
- redis_password
environment:
PS1: '\[\033[1;32m\]\[\033[1;36m\][\u@\h] \[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'
env_file:
- ./docker/config/.env.compose
ports:
- '8080:8080/tcp'
hostname: jikan-rest-api
healthcheck:
test: [ 'CMD-SHELL', 'wget --spider -q "http://127.0.0.1:2114/health?plugin=http"' ]
interval: 2s
timeout: 2s
links:
- mongodb:mongodb
- redis:redis
- typesense:typesense
depends_on:
mongodb: { condition: service_healthy }
redis: { condition: service_healthy }
typesense: { condition: service_healthy }
mongodb:
image: docker.io/mongo:focal
hostname: mongodb
volumes:
- mongo-data:/data/db
- ./docker/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
ports:
- 27017/tcp
command: "--wiredTigerCacheSizeGB ${MONGO_CACHE_SIZE_GB:-1.0}"
networks:
- jikan_network
secrets:
- db_username
- db_password
- db_admin_username
- db_admin_password
environment:
MONGO_INITDB_ROOT_USERNAME_FILE: /run/secrets/db_admin_username
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/db_admin_password
MONGO_INITDB_DATABASE: jikan_admin
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh mongodb://localhost:27017 --quiet
interval: 30s
timeout: 10s
retries: 5
redis:
image: docker.io/redis:6-alpine
hostname: redis
secrets:
- redis_password
networks:
- jikan_network
command:
- /bin/sh
- -c
- redis-server --requirepass "$$(cat /run/secrets/redis_password)"
volumes:
- redis-data:/data:rw
ports:
- '6379/tcp'
healthcheck:
test: [ 'CMD', 'redis-cli', 'ping' ]
interval: 500ms
timeout: 1s
typesense:
image: docker.io/typesense/typesense:0.24.1
hostname: typesense
entrypoint: /bin/sh
secrets:
- typesense_api_key
networks:
- jikan_network
command:
- -c
- TYPESENSE_API_KEY="$$(cat /run/secrets/typesense_api_key)" /opt/typesense-server --data-dir /data
deploy:
restart_policy:
condition: none
volumes:
- typesense-data:/data
ports:
- "8108/tcp"
healthcheck:
test: [ 'CMD-SHELL', '{ ! [ -f "curl_created" ] && apt -qq update -y && apt -qq install -y curl && touch curl_created && curl -s -f http://localhost:8108/health; } || { curl -s -f http://localhost:8108/health; }' ]
interval: 5s
timeout: 2s