version: '3.8'

services:
  splash:
    image: scrapinghub/splash:3.5.0
    command: --maxrss 2048 --max-timeout 300 --disable-lua-sandbox --verbosity 1
    ports:
      - "8050:8050"
    volumes:
      - splash_filters:/etc/splash/filters
      - splash_js-profiles:/etc/splash/js-profiles
      - splash_lua_modules:/etc/splash/lua_modules
      - splash_proxy-profiles:/etc/splash/proxy-profiles
    deploy:
      resources:
        limits:
          memory: 2560M
      replicas: 8
      placement:
        constraints:
          - node.role == worker
      restart_policy:
        condition: on-failure

volumes:
  splash_filters:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=10.0.0.96,nolock,soft,ro"
      device: ":/export/splash/filters"
  splash_js-profiles:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=10.0.0.96,nolock,soft,ro"
      device: ":/export/splash/js-profiles"
  splash_lua_modules:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=10.0.0.96,nolock,soft,ro"
      device: ":/export/splash/lua_modules"
  splash_proxy-profiles:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=10.0.0.96,nolock,soft,ro"
      device: ":/export/splash/proxy-profiles"

networks:
  default:
    ipam:
      config:
        - subnet: 192.168.126.0/24
