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'
|
version: '3.8'
|
||||||
volumes:
|
volumes:
|
||||||
mongo-data: {}
|
mongo-data: { }
|
||||||
redis-data: {}
|
redis-data: { }
|
||||||
tmp-data: {}
|
typesense-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:
|
services:
|
||||||
jikan_rest: &jikan_rest
|
jikan_rest: &jikan_rest
|
||||||
build:
|
image: jikanme/jikan-rest:latest
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
user: "${APP_UID:-10001}:${APP_GID:-10001}"
|
user: "${APP_UID:-10001}:${APP_GID:-10001}"
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
- typesense_api_key
|
||||||
environment:
|
environment:
|
||||||
PS1: '\[\033[1;32m\]\[\033[1;36m\][\u@\h] \[\033[1;34m\]\w\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'
|
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: 'false'
|
||||||
APP_DEBUG: 'true'
|
APP_ENV: production
|
||||||
APP_ENV: local
|
CACHING: 'true'
|
||||||
|
CACHE_DRIVER: redis
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
REDIS_PASSWORD: "${REDIS_PASSWORD:-null}"
|
REDIS_PASSWORD__FILE: /run/secrets/redis_password
|
||||||
DB_CONNECTION: mongodb
|
DB_CONNECTION: mongodb
|
||||||
DB_HOST: mongodb
|
DB_HOST: mongodb
|
||||||
DB_DATABASE: jikan
|
DB_DATABASE: jikan
|
||||||
DB_PORT: 27017
|
DB_PORT: 27017
|
||||||
DB_ADMIN: jikan
|
DB_ADMIN: "${DB_USERNAME:-root}"
|
||||||
DB_USERNAME: "${DB_USERNAME}"
|
DB_USERNAME: "${DB_USERNAME:-root}"
|
||||||
DB_PASSWORD: "${DB_PASSWORD}"
|
SCOUT_DRIVER: typesense
|
||||||
volumes:
|
SCOUT_QUEUE: 'false'
|
||||||
- /etc/passwd:/etc/passwd:ro
|
DB_PASSWORD__FILE: /run/secrets/db_password
|
||||||
- /etc/group:/etc/group:ro
|
TYPESENSE_HOST: typesense
|
||||||
- tmp-data:/tmp:rw
|
TYPESENSE_PORT: 8108
|
||||||
- .:/app:rw
|
TYPESENSE_API_KEY__FILE: /run/secrets/typesense_api_key
|
||||||
|
CORS_MIDDLEWARE: 'true'
|
||||||
|
MICROCACHING: 'true'
|
||||||
|
MICROCACHING_EXPIRE: 60
|
||||||
depends_on:
|
depends_on:
|
||||||
mongodb: {condition: service_healthy}
|
mongodb: { condition: service_healthy }
|
||||||
redis: {condition: service_healthy}
|
redis: { condition: service_healthy }
|
||||||
typesense: {condition: service_healthy}
|
typesense: { condition: service_healthy }
|
||||||
|
|
||||||
web:
|
web:
|
||||||
<<: *jikan_rest
|
<<: *jikan_rest
|
||||||
@ -45,20 +56,18 @@ services:
|
|||||||
interval: 2s
|
interval: 2s
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
|
|
||||||
cron:
|
|
||||||
<<: *jikan_rest
|
|
||||||
command: supercronic /etc/supercronic/laravel # it runs artisan schedule:run
|
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
image: mongo:focal
|
image: mongo:focal
|
||||||
volumes:
|
volumes:
|
||||||
- mongo-data:/data/db
|
- mongo-data:/data/db
|
||||||
ports:
|
ports:
|
||||||
- '27017/tcp'
|
- '27017/tcp'
|
||||||
command: --wiredTigerCacheSizeGB 1
|
command: --wiredTigerCacheSizeGB ${MONGO_CACHE_SIZE_GB:1}
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
environment:
|
environment:
|
||||||
MONGO_INITDB_ROOT_USERNAME: "${DB_USERNAME:-root}"
|
MONGO_INITDB_ROOT_USERNAME: "${DB_USERNAME:-root}"
|
||||||
MONGO_INITDB_ROOT_PASSWORD: "${DB_PASSWORD}"
|
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: echo 'db.runCommand("ping").ok' | mongo mongodb://localhost:27017 --quiet
|
test: echo 'db.runCommand("ping").ok' | mongo mongodb://localhost:27017 --quiet
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@ -67,10 +76,14 @@ services:
|
|||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
|
secrets:
|
||||||
|
- redis_password
|
||||||
|
environment:
|
||||||
|
REDIS_PASSWORD: "${REDIS_PASSWORD:-null}"
|
||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}"
|
- redis-server --requirepass "$${cat /run/secrets/redis_password}"
|
||||||
volumes:
|
volumes:
|
||||||
- redis-data:/data:rw
|
- redis-data:/data:rw
|
||||||
ports:
|
ports:
|
||||||
@ -81,11 +94,13 @@ services:
|
|||||||
timeout: 1s
|
timeout: 1s
|
||||||
|
|
||||||
typesense:
|
typesense:
|
||||||
image: typesense/typesense:0.23.1
|
image: typesense/typesense:0.24.1
|
||||||
entrypoint: /bin/sh
|
entrypoint: /bin/sh
|
||||||
|
secrets:
|
||||||
|
- typesense_api_key
|
||||||
command:
|
command:
|
||||||
- -c
|
- -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
|
restart: no
|
||||||
volumes:
|
volumes:
|
||||||
- typesense-data:/data
|
- typesense-data:/data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user