version: '2.2'

services:
#  mastodon:
#    image: tootsuite/mastodon:edge
#    hostname: mastodon
#    container_name: mastodon
#    restart: always
#    env_file: .env.production
#    entrypoint:
#      - /bin/bash
#      - entrypoint.sh
#    cpus: 3
##    mem_limit: 1g
##    mem_reservation: 512m
#    volumes:
#      - ./entrypoint.sh:/opt/mastodon/entrypoint.sh
#      - ./mastodon:/opt/mastodon/public/system
#      - ./application.rb:/mastodon/config/application.rb
#      - ./media_attachment.rb:/mastodon/app/models/media_attachment.rb
#      - ./base_controller.rb:/mastodon/app/controllers/api/base_controller.rb
#      - ./follow_limit_validator.rb:/mastodon/app/validators/follow_limit_validator.rb
#    expose:
#      - 3000
#      - 4000
#    networks:
#      mynet:
#        ipv4_address: 172.1.0.101
#      haraka:
#
#  postgres:
#    image: postgres
#    hostname: postgres-mastodon
#    container_name: postgres-mastodon
#    restart: always
#    shm_size: '1gb'
#    command: >
#      -c 'max_connections=150'
#      -c 'shared_buffers=512MB'
#      -c 'effective_cache_size=1536MB'
#      -c 'maintenance_work_mem=128MB'
#      -c 'checkpoint_completion_target=0.7'
#      -c 'wal_buffers=16MB'
#      -c 'default_statistics_target=100'
#      -c 'random_page_cost=1.1'
#      -c 'effective_io_concurrency=200'
#      -c 'work_mem=1747kB'
#      -c 'min_wal_size=1GB'
#      -c 'max_wal_size=2GB'
#      -c 'max_worker_processes=4'
#      -c 'max_parallel_workers_per_gather=2'
#      -c 'max_parallel_workers=4'
#      -c 'autovacuum_max_workers=1'
#      -c 'autovacuum_work_mem=128MB'
#      -h '*'
##      -c 'statement_timeout=60000'
#    environment:
#      - POSTGRES_USER=postgres
#      - POSTGRES_DB=mastodon
#      - POSTGRES_PASSWORD=m4st0d0n.
#    volumes:
#      - ./data:/var/lib/postgresql/data
#    expose:
#      - 5432
#    networks:
#      mynet:
#        ipv4_address: 172.1.0.102
#
#  redis:
#    image: redis
#    hostname: redis-mastodon
#    container_name: redis-mastodon
#    restart: always
#    sysctls:
#      - net.core.somaxconn=1024
#    volumes:
#      - ./redis:/data
#      - ./redis.conf:/usr/local/etc/redis/redis.conf
#      - ./redis-enabled:/sys/kernel/mm/transparent_hugepage/enabled
#    networks:
#      mynet:
#        ipv4_address: 172.1.0.103

  elastic:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.8.6
    hostname: elastic-mastodon
    container_name: elastic-mastodon
    restart: always
    environment:
      - node.name=mastodon
      - cluster.name=cluster01
#      - bootstrap.memory_lock=true
      - ES_JAVA_OPTS=-Xms1g -Xmx1g
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./elastic:/usr/share/elasticsearch/data
      - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    expose:
      - 9200
      - 9300
    networks:
      mynet:
        ipv4_address: 172.1.0.104

#  kibana:
#    image: docker.elastic.co/kibana/kibana:6.8.6
#    hostname: kibana-mastodon
#    container_name: kibana-mastodon
#    restart: always
#    environment:
#      SERVER_NAME: kibana.hatthieves.es
#      ELASTICSEARCH_HOSTS: http://elastic-mastodon
#      XPACK_MONITORING_ENABLED: 'false'
#      NODE_OPTIONS: '--max-old-space-size=512'
#    expose:
#      - 5601
#    volumes:
#      - ./base_optimizer.js:/usr/share/kibana/src/optimize/base_optimizer.js
##    mem_limit: 1024m
##    mem_reservation: 512m
#    cpus: 1
##    cpu_percent: 50
##    cpu_shares: 256
#    networks:
#      mynet:
#        ipv4_address: 172.1.0.105
    
networks:
  mynet:
    driver: bridge
    ipam:
      config:
      - subnet: 172.1.0.0/24

  haraka:
    external:
      name: harakawildduck_mynet
