Commit 72054382 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Revert "Aplica modo de despliegue escalable"

This reverts commit fae45f9b.
parent c7fc5311
Loading
Loading
Loading
Loading
+0 −65
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@ server:

common:
  path_prefix: /loki
  compactor_address: http://loki-write:3100
  storage:
    filesystem:
      chunks_directory: /loki/chunks
@@ -32,44 +31,7 @@ schema_config:
        prefix: index_
        period: 24h

memberlist:
  join_members: ["loki-read", "loki-write"]
  dead_node_reclaim_time: 30s
  gossip_to_dead_nodes_time: 15s
  left_ingesters_timeout: 30s
  bind_addr: ['0.0.0.0']
  bind_port: 7946
  gossip_interval: 2s

ingester:
  lifecycler:
    join_after: 10s
    observe_period: 5s
    ring:
      replication_factor: 3
      kvstore:
        store: memberlist
    final_sleep: 0s
  chunk_idle_period: 1m
  wal:
    enabled: true
    dir: /loki/wal
  max_chunk_age: 1m
  chunk_retain_period: 30s
  chunk_encoding: snappy
  chunk_target_size: 1.572864e+06
  chunk_block_size: 262144
  flush_op_timeout: 10s

ruler:
  enable_api: true
  wal:
    dir: /tmp/ruler-wal
  storage:
    type: local
    local:
      directory: /loki/rules
  rule_path: /tmp/prom-rules
  alertmanager_url: http://alertmanager:9093
  external_url: ${LOKI_RULER_EXTERNAL_URL}

@@ -84,37 +46,10 @@ compactor:
limits_config:
  retention_period: ${LOKI_LIMITS_CONFIG_RETENTION_PERIOD}
  query_timeout: 5m
  max_cache_freshness_per_query: '10m'
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 30m
  ingestion_rate_mb: 10
  ingestion_burst_size_mb: 20
  split_queries_by_interval: 15m


chunk_store_config:
  max_look_back_period: 336h
  chunk_cache_config:
    embedded_cache:
      enabled: true
      max_size_mb: 50
      ttl: 1h

table_manager:
  retention_deletes_enabled: true
  retention_period: 336h

query_range:
  align_queries_with_step: true
  max_retries: 5
  parallelise_shardable_queries: true
  cache_results: true

frontend:
  log_queries_longer_than: 5s
  compress_responses: true
  max_outstanding_per_tenant: 2048

querier:
  query_ingesters_within: 2h

deploy/config/nginx.conf

deleted100644 → 0
+0 −69
Original line number Diff line number Diff line
error_log /dev/stderr;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192;

events {
	worker_connections 4096;
}

http {
	default_type application/octet-stream;
	log_format   main '$remote_addr - $remote_user [$time_local]  $status '
	'"$request" $body_bytes_sent "$http_referer" '
	'"$http_user_agent" "$http_x_forwarded_for"';
	access_log /dev/stderr  main;
	sendfile on;
	tcp_nopush on;

	upstream read {
		server loki-read:3100;
	}

	upstream write {
		server loki-write:3100;
	}

	upstream cluster {
		server loki-read:3100;
		server loki-write:3100;
	}

	server {
		listen 80;
		listen 3100;

		location = /ring {
			proxy_pass http://cluster$request_uri;
		}

		location = /memberlist {
			proxy_pass http://cluster$request_uri;
		}

		location = /config {
			proxy_pass http://cluster$request_uri;
		}

		location = /metrics {
			proxy_pass http://cluster$request_uri;
		}

		location = /ready {
			proxy_pass http://cluster$request_uri;
		}

		location = /loki/api/v1/push {
			proxy_pass http://write$request_uri;
		}

		location = /loki/api/v1/tail {
			proxy_pass http://read$request_uri;
			proxy_set_header Upgrade $http_upgrade;
			proxy_set_header Connection "upgrade";
		}

		location ~ /loki/api/.* {
			proxy_pass http://read$request_uri;
		}
	}
}
+4 −11
Original line number Diff line number Diff line
version: '3.9'

x-loki-deploy-prod: &loki-deploy-prod
services:
  loki:
    deploy:
      placement:
        constraints:
          - node.role == worker

services:
  loki-read:
    deploy:
      << : *loki-deploy-prod

  loki-write:
    deploy:
      << : *loki-deploy-prod

volumes:
  data-vol:
    name: ${DATA_VOL_NAME}
+28 −78
Original line number Diff line number Diff line
version: '3.9'

x-loki-common: &loki-common
services:
  loki:
    image: ${IMAGE_NAME:-grafana/loki}:${IMAGE_TAG:-latest}
    command: -config.file=${LOKI_CONFIG_FILE_PATH} -config.expand-env=true -target=all
    environment:
      LOKI_AUTH_ENABLED:
      LOKI_ANALYTICS_REPORTING_ENABLED:
@@ -21,68 +23,20 @@ x-loki-common: &loki-common
        target: /loki/rules/fake/rules.yaml
    logging:
      driver: local

x-loki-deploy: &loki-deploy
    deploy:
      mode: replicated
  placement:
    max_replicas_per_node: 1
      replicas: ${REPLICAS:-1}
      restart_policy:
        delay: ${RESTART_DELAY:-5s}
      update_config:
        delay: ${UPDATE_DELAY:-1m}

services:
  loki-read:
    << : *loki-common
    command: -config.file=${LOKI_CONFIG_FILE_PATH} -config.expand-env=true -target=read
    deploy:
      << : *loki-deploy
      replicas: ${LOKI_READ_REPLICAS:-2}
      resources:
        limits:
          cpus: '${LOKI_READ_RESOURCES_LIMITS_CPUS:-2}'
          memory: ${LOKI_READ_RESOURCES_LIMITS_MEMORY:-512M}
        reservations:
          cpus: '${LOKI_READ_RESOURCES_RESERVATIONS_CPUS:-0.1}'
          memory: ${LOKI_READ_RESOURCES_RESERVATIONS_MEMORY:-256M}

  loki-write:
    << : *loki-common
    command: -config.file=${LOKI_CONFIG_FILE_PATH} -config.expand-env=true -target=write
    deploy:
      << : *loki-deploy
      replicas: ${LOKI_WRITE_REPLICAS:-1}
      resources:
        limits:
          cpus: '${LOKI_WRITE_RESOURCES_LIMITS_CPUS:-1}'
          memory: ${LOKI_WRITE_RESOURCES_LIMITS_MEMORY:-256M}
          cpus: '${RESOURCES_LIMITS_CPUS:-2}'
          memory: ${RESOURCES_LIMITS_MEMORY:-512M}
        reservations:
          cpus: '${LOKI_WRITE_RESOURCES_RESERVATIONS_CPUS:-0.1}'
          memory: ${LOKI_WRITE_RESOURCES_RESERVATIONS_MEMORY:-128M}

  loki-gateway:
    image: nginx:${NGINX_IMAGE_TAG:-alpine}
    networks:
      log-net:
        aliases:
          - loki
      metric-net:
        aliases:
          - loki
    configs:
      - source: nginx-conf
        target: /etc/nginx/nginx.conf
    deploy:
      << : *loki-deploy
      replicas: ${LOKI_GATEWAY_REPLICAS:-1}
      resources:
        limits:
          cpus: '${LOKI_GATEWAY_RESOURCES_LIMITS_CPUS:-1}'
          memory: ${LOKI_GATEWAY_RESOURCES_LIMITS_MEMORY:-128M}
        reservations:
          cpus: '${LOKI_GATEWAY_RESOURCES_RESERVATIONS_CPUS:-0.1}'
          memory: ${LOKI_GATEWAY_RESOURCES_RESERVATIONS_MEMORY:-64M}

          cpus: '${RESOURCES_RESERVATIONS_CPUS:-0.1}'
          memory: ${RESOURCES_RESERVATIONS_MEMORY:-256M}

networks:
  log-net:
@@ -103,7 +57,3 @@ configs:
  rules-file:
    name: ${RULES_FILE_NAME:-loki-rules-yaml}
    file: ./rules/rules.yaml

  nginx-conf:
    name: ${NGINX_CONF_NAME:-loki-nginx-conf}
    file: ./config/nginx.conf