eBooru/docker-compose.yml
2023-02-25 15:14:48 +01:00

160 lines
3.7 KiB
YAML

version: "3"
x-environment: &common-env
DANBOORU_HOSTNAME: http://localhost:3000
DANBOORU_REDIS_URL: redis://redis
DANBOORU_ELASTICSEARCH_HOST: elastic
DANBOORU_MEMCACHED_SERVERS: memcached
DANBOORU_IQDBS_SERVER: http://iqdb:4567
# These are just development secrets, do not use them in production
SECRET_TOKEN: 1c58518a891eff4520cadc59afa9e378a9325f1247544ff258096e497f095f45
SESSION_SECRET_KEY: 44b4f44e9f253c406cbe727d403d500c1cecff943e4d2aea8f5447f28846fffe
x-depends-on: &common-depends-on
elastic:
condition: service_healthy
memcached:
condition: service_started
postgres:
condition: service_started
redis:
condition: service_started
services:
e621:
build:
context: ./
args:
COMPOSE_PROFILES: ${COMPOSE_PROFILES-}
image: e621
volumes:
- .:/app
- node_modules:/app/node_modules
- public_packs:/app/public/packs
- post_data:/app/public/data
- ./docker/cron_tasks/daily:/etc/periodic/daily
environment:
<<: *common-env
RAILS_ENV: development
depends_on:
<<: *common-depends-on
iqdb:
condition: service_started
tty: true
nginx:
image: nginx:stable-alpine
volumes:
- ./public:/app/public
- post_data:/app/public/data
- public_packs:/app/public/packs
- ./docker/default.conf.template:/etc/nginx/templates/default.conf.template
environment:
NGINX_HOST: localhost
NGINX_PORT: 3000
depends_on:
- e621
ports:
- "3000:3000"
postgres:
build: ./docker/postgres
environment:
- POSTGRES_USER=danbooru
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- db_data:/var/lib/postgresql/data
ports:
- "34517:5432"
redis:
image: redis:4.0.9-alpine
command: redis-server --save 10 1 --loglevel warning
volumes:
- redis_data_v2:/data
memcached:
image: memcached:1.5.6-alpine
elastic:
image: elasticsearch:7.14.2
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- logger.level=WARN
- ES_JAVA_OPTS=-Xms1g -Xmx1g
volumes:
- elastic_data:/usr/share/elasticsearch/data
healthcheck:
interval: 10s
timeout: 2s
test: nc -z elastic 9200
iqdb:
build: ./docker/iqdb
environment:
- IQDB_HOSTNAME=localhost
- IQDB_PORT=62125
# Hardcoded in iqdbs Procfile
- IQDB_DATABASE_FILE=/home/vagrant/iqdbs/e621.db
- SINATRA_PORT=4567
- IMAGES_FOLDER=/data
- REDIS_URL=redis://redis
# Sinatra only binds to localhost in development, but to 0.0.0.0 for anything else
- APP_ENV=docker
depends_on:
- redis
volumes:
- post_data:/data
- iqdb_data:/home/vagrant/iqdbs
# Useful for development
tests:
image: e621
environment:
<<: *common-env
RAILS_ENV: test
# Hide annoying output from libvips on corrupt files
VIPS_WARNING: "0"
volumes:
- .:/app
- ./docker/danbooru_local_config.rb:/app/config/danbooru_local_config.rb
- node_modules:/app/node_modules
depends_on:
<<: *common-depends-on
entrypoint: bundle exec rails test
profiles:
- tests
rubocop:
image: e621
volumes:
- .:/app
- rubocop_cache:/rubocop_cache
entrypoint: bundle exec rubocop --cache-root /rubocop_cache
profiles:
- rubocop
solargraph:
image: e621
entrypoint: solargraph socket -h 0.0.0.0
working_dir: $PWD
volumes:
- .:$PWD
ports:
- 7658:7658
profiles:
- solargraph
volumes:
post_data:
iqdb_data:
elastic_data:
db_data:
redis_data_v2:
node_modules:
public_packs:
public_packs_test:
rubocop_cache: