Skip to content

Instantly share code, notes, and snippets.

@berkesayin
Last active December 31, 2023 16:00
Show Gist options
  • Save berkesayin/6225a24649a2096bd4b7c94d2936a87a to your computer and use it in GitHub Desktop.
Save berkesayin/6225a24649a2096bd4b7c94d2936a87a to your computer and use it in GitHub Desktop.
docker-compose
version: '3'
networks:
graynet:
driver: bridge
# This is how you persist data between container restarts
volumes:
mongo_data:
driver: local
log_data:
driver: local
graylog_data:
driver: local
services:
# Graylog stores configuration in MongoDB
mongo:
image: mongo:6.0.5-jammy
container_name: mongodb
volumes:
- "mongo_data:/data/db"
networks:
- graynet
restart: unless-stopped
# The logs are stored in Opensearch
opensearch:
image: opensearchproject/opensearch:2
container_name: opensearch
environment:
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- "bootstrap.memory_lock=true"
- "discovery.type=single-node"
- "action.auto_create_index=false"
- "plugins.security.ssl.http.enabled=false"
- "plugins.security.disabled=true"
volumes:
- "log_data:/usr/share/opensearch/data"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- 9200:9200/tcp
networks:
- graynet
restart: unless-stopped
graylog:
image: graylog/graylog:5.1
container_name: graylog
environment:
# CHANGE THIS (must be at least 16 characters)
GRAYLOG_PASSWORD_SECRET: "somesamplepassword"
# Password: admin
GRAYLOG_ROOT_PASSWORD_SHA2: "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918"
GRAYLOG_HTTP_BIND_ADDRESS: "0.0.0.0:9000"
GRAYLOG_HTTP_EXTERNAL_URI: "http://localhost:9000/"
GRAYLOG_ELASTICSEARCH_HOSTS: "http://opensearch:9200"
GRAYLOG_MONGODB_URI: "mongodb://mongodb:27017/graylog"
GRAYLOG_TIMEZONE: "Europe/Istanbul"
TZ: "Europe/Istanbul"
entrypoint: /usr/bin/tini -- wait-for-it opensearch:9200 -- /docker-entrypoint.sh
volumes:
- "${PWD}/config/graylog/graylog.conf:/usr/share/graylog/config/graylog.conf"
- "graylog_data:/usr/share/graylog/data"
networks:
- graynet
restart: always
depends_on:
opensearch:
condition: "service_started"
mongo:
condition: "service_started"
ports:
- 9000:9000/tcp # Graylog web interface and REST API
- 1514:1514/tcp # Syslog
- 1514:1514/udp # Syslog
- 12201:12201/tcp # GELF
- 12201:12201/udp # GELF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment