mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
111 lines
2.8 KiB
YAML
111 lines
2.8 KiB
YAML
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
|
|
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
|
|
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
|
|
ports:
|
|
- '27017/tcp'
|
|
command: "--wiredTigerCacheSizeGB ${MONGO_CACHE_SIZE_GB:1}"
|
|
networks:
|
|
- jikan_network
|
|
secrets:
|
|
- db_username
|
|
- db_password
|
|
environment:
|
|
MONGO_INITDB_ROOT_USERNAME_FILE: /run/secrets/db_username
|
|
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
|
healthcheck:
|
|
test: echo 'db.runCommand("ping").ok' | mongo mongodb://localhost:27017 --quiet
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: docker.io/redis:7-alpine
|
|
hostname: redis
|
|
secrets:
|
|
- redis_password
|
|
environment:
|
|
REDIS_PASSWORD: "${REDIS_PASSWORD:-null}"
|
|
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
|
|
restart: no
|
|
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
|