mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
wip docker-compose
This commit is contained in:
parent
317906cdf9
commit
d489226473
@ -1,40 +1,51 @@
|
||||
# For now this is just for local development. This is not production ready.
|
||||
version: '3.8'
|
||||
volumes:
|
||||
mongo-data: {}
|
||||
redis-data: {}
|
||||
tmp-data: {}
|
||||
typesense-data: {}
|
||||
mongo-data: { }
|
||||
redis-data: { }
|
||||
typesense-data: { }
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
file: db_password.txt
|
||||
redis_password:
|
||||
file: redis_password.txt
|
||||
typesense_api_key:
|
||||
file: typesense_api_key.txt
|
||||
|
||||
services:
|
||||
jikan_rest: &jikan_rest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: jikanme/jikan-rest:latest
|
||||
user: "${APP_UID:-10001}:${APP_GID:-10001}"
|
||||
secrets:
|
||||
- db_password
|
||||
- typesense_api_key
|
||||
environment:
|
||||
PS1: '\[\033[1;32m\]\[\033[1;36m\][\u@\h] \[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'
|
||||
HOME: /tmp
|
||||
APP_DEBUG: 'true'
|
||||
APP_ENV: local
|
||||
APP_DEBUG: 'false'
|
||||
APP_ENV: production
|
||||
CACHING: 'true'
|
||||
CACHE_DRIVER: redis
|
||||
REDIS_HOST: redis
|
||||
REDIS_PASSWORD: "${REDIS_PASSWORD:-null}"
|
||||
REDIS_PASSWORD__FILE: /run/secrets/redis_password
|
||||
DB_CONNECTION: mongodb
|
||||
DB_HOST: mongodb
|
||||
DB_DATABASE: jikan
|
||||
DB_PORT: 27017
|
||||
DB_ADMIN: jikan
|
||||
DB_USERNAME: "${DB_USERNAME}"
|
||||
DB_PASSWORD: "${DB_PASSWORD}"
|
||||
volumes:
|
||||
- /etc/passwd:/etc/passwd:ro
|
||||
- /etc/group:/etc/group:ro
|
||||
- tmp-data:/tmp:rw
|
||||
- .:/app:rw
|
||||
DB_ADMIN: "${DB_USERNAME:-root}"
|
||||
DB_USERNAME: "${DB_USERNAME:-root}"
|
||||
SCOUT_DRIVER: typesense
|
||||
SCOUT_QUEUE: 'false'
|
||||
DB_PASSWORD__FILE: /run/secrets/db_password
|
||||
TYPESENSE_HOST: typesense
|
||||
TYPESENSE_PORT: 8108
|
||||
TYPESENSE_API_KEY__FILE: /run/secrets/typesense_api_key
|
||||
CORS_MIDDLEWARE: 'true'
|
||||
MICROCACHING: 'true'
|
||||
MICROCACHING_EXPIRE: 60
|
||||
depends_on:
|
||||
mongodb: {condition: service_healthy}
|
||||
redis: {condition: service_healthy}
|
||||
typesense: {condition: service_healthy}
|
||||
mongodb: { condition: service_healthy }
|
||||
redis: { condition: service_healthy }
|
||||
typesense: { condition: service_healthy }
|
||||
|
||||
web:
|
||||
<<: *jikan_rest
|
||||
@ -45,20 +56,18 @@ services:
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
|
||||
cron:
|
||||
<<: *jikan_rest
|
||||
command: supercronic /etc/supercronic/laravel # it runs artisan schedule:run
|
||||
|
||||
mongodb:
|
||||
image: mongo:focal
|
||||
volumes:
|
||||
- mongo-data:/data/db
|
||||
ports:
|
||||
- '27017/tcp'
|
||||
command: --wiredTigerCacheSizeGB 1
|
||||
command: --wiredTigerCacheSizeGB ${MONGO_CACHE_SIZE_GB:1}
|
||||
secrets:
|
||||
- db_password
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: "${DB_USERNAME:-root}"
|
||||
MONGO_INITDB_ROOT_PASSWORD: "${DB_PASSWORD}"
|
||||
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
||||
healthcheck:
|
||||
test: echo 'db.runCommand("ping").ok' | mongo mongodb://localhost:27017 --quiet
|
||||
interval: 30s
|
||||
@ -67,10 +76,14 @@ services:
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
secrets:
|
||||
- redis_password
|
||||
environment:
|
||||
REDIS_PASSWORD: "${REDIS_PASSWORD:-null}"
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}"
|
||||
- redis-server --requirepass "$${cat /run/secrets/redis_password}"
|
||||
volumes:
|
||||
- redis-data:/data:rw
|
||||
ports:
|
||||
@ -81,11 +94,13 @@ services:
|
||||
timeout: 1s
|
||||
|
||||
typesense:
|
||||
image: typesense/typesense:0.23.1
|
||||
image: typesense/typesense:0.24.1
|
||||
entrypoint: /bin/sh
|
||||
secrets:
|
||||
- typesense_api_key
|
||||
command:
|
||||
- -c
|
||||
- /opt/typesense-server --data-dir /data --api-key "$${TYPESENSE_API_KEY:?TYPESENSE_API_KEY variable is not set}"
|
||||
- TYPESENSE_API_KEY="$$(cat /run/secrets/typesense_api_key)" /opt/typesense-server --data-dir /data
|
||||
restart: no
|
||||
volumes:
|
||||
- typesense-data:/data
|
||||
|
Loading…
x
Reference in New Issue
Block a user