#
# Cookbook Name:: irrigate-maxwells
# Attributes:: default
#
# Copyright (C) 2017 The Orchard

default['maxwell']['version']                  = '1.35.5'
default['maxwell']['source']                   =
  'https://github.com/zendesk/maxwell/releases/download/' \
  "v#{node['maxwell']['version']}/maxwell-#{node['maxwell']['version']}" \
  '.tar.gz'
default['maxwell']['user']                     = 'maxwell'
default['maxwell']['group']                    = 'maxwell'
default['maxwell']['download_dir']             = '/tmp'
default['maxwell']['home']                     = '/opt/maxwell'
default['maxwell']['service_name']             = 'maxwells_daemon'
default['maxwell']['tmp_cleanup_enabled']      = 'true'

# AWS settings for kinesis producer
# Can optionally be provided as encrypted data bags
default['maxwell']['aws']['credentials_data_bag'] = ''
default['maxwell']['aws']['access_key_id']        = 'access_key_id'
default['maxwell']['aws']['secret_access_key']    = 'secret_access_key'

# config.properties defaults
default['maxwell']['log_level']                           = 'info'
default['maxwell']['producer']                            = 'stdout'
default['maxwell']['output_file']                         = '/tmp/maxwell_file'
default['maxwell']['bootstrapper']                        = 'async'
default['maxwell']['encrypt_data']                        = 'false'
default['maxwell']['encrypt_all']                         = 'false'
# These can optionally be provided by encrypted data bags
default['maxwell']['encryption_data_bag']                 = ''
default['maxwell']['encryption_key']                      = 'encryption_key'
default['maxwell']['secret_key']                          = 'secret_key'

default['maxwell']['mysql']['host']                       = 'localhost'
default['maxwell']['mysql']['port']                       = '3306'
# These can optionally be provided by encrypted data bags
default['maxwell']['mysql']['user']                       = 'mysql_user'
default['maxwell']['mysql']['password']                   = 'mysql_password'
default['maxwell']['mysql']['schema_database']            = 'maxwell'
default['maxwell']['mysql']['jdbc_options']               =
  'zeroDateTimeBehavior=convertToNull&connectTimeout=5000'
default['maxwell']['mysql']['schema_jdbc_options']        =
  'zeroDateTimeBehavior=convertToNull&connectTimeout=5000'
default['maxwell']['mysql']['replication_jdbc_options']   =
  'zeroDateTimeBehavior=convertToNull&connectTimeout=5000'
default['maxwell']['mysql']['client_id']                  = 'maxwell_client'
default['maxwell']['mysql']['replica_server_id']          = '6379'
default['maxwell']['mysql']['gtid_mode']                  = 'false'
default['maxwell']['ignore_producer_error']               = 'false'

default['maxwell']['output']['output_binlog_position']    = 'false'
default['maxwell']['output']['output_nulls']              = 'true'
default['maxwell']['output']['output_server_id']          = 'false'
default['maxwell']['output']['output_thread_id']          = 'false'
default['maxwell']['output']['output_commit_info']        = 'true'
default['maxwell']['output']['output_ddl']                = 'false'

default['maxwell']['kafka']['bootstrap_servers']          = 'localhost:9092'
default['maxwell']['kafka']['topic']                      = 'maxwell'
default['maxwell']['kafka']['ddl_kafka_topic']            = 'maxwell_ddl'
default['maxwell']['kafka']['partition_hash']             = 'default'
default['maxwell']['kafka']['key_format']                 = 'hash'
default['maxwell']['kafka']['batch_size']                 = '16384'
default['maxwell']['kafka']['extended_options']           = {}
# Kafka 0.9-specific options
default['maxwell']['kafka']['compression_type']           = 'snappy'
default['maxwell']['kafka']['metadata_fetch_timeout']     = '5000'
default['maxwell']['kafka']['retries']                    = '0'
default['maxwell']['kafka']['acks']                       = '1'

default['maxwell']['partition']['partition_by']           = 'database'
default['maxwell']['partition']['partition_columns']      = 'column_name'
default['maxwell']['partition']['partition_by_fallback']  = 'database'

default['maxwell']['kinesis']['stream']                   = 'kinesis_stream'
default['maxwell']['kinesis']['md5_keys']                 = 'false'

default['maxwell']['pubsub']['pubsub_project_id']         = 'maxwell'
default['maxwell']['pubsub']['pubsub_topic']              = 'maxwell'
default['maxwell']['pubsub']['ddl_pubsub_topic']          = 'maxwell_ddl'

default['maxwell']['rabbitmq']['host']                    = 'rabbitmq_hostname'
default['maxwell']['rabbitmq']['user']                    = 'guest'
default['maxwell']['rabbitmq']['pass']                    = 'guest'
default['maxwell']['rabbitmq']['virtual_host']            = '/'
default['maxwell']['rabbitmq']['exchange']                = 'maxwell'
default['maxwell']['rabbitmq']['exchange_type']           = 'fanout'
default['maxwell']['rabbitmq']['exchange_durable']        = 'false'
default['maxwell']['rabbitmq']['exchange_autodelete']     = 'false'
default['maxwell']['rabbitmq']['routing_key_template']    = '%db%.%table%'

default['maxwell']['redis']['host']                       = 'redis_host'
default['maxwell']['redis']['port']                       = '6379'
default['maxwell']['redis']['auth']                       = 'redis_auth'
default['maxwell']['redis']['database']                   = '0'
default['maxwell']['redis']['pub_channel']                = 'maxwell'

# These filters are lists, with items in the format db.table
default['maxwell']['filter']['exclude_expressions']       = ['*.*']
default['maxwell']['filter']['include_expressions']       = ['db.*']

default['maxwell']['monitor']['metrics_type']             = 'slf4j'
default['maxwell']['monitor']['metrics_prefix']           = 'MaxwellMetrics'
default['maxwell']['monitor']['metrics_slf4j_interval']   = '60'
default['maxwell']['monitor']['metrics_http_port']        = '8080'
default['maxwell']['monitor']['metrics_datadog_type']     = 'udp'
default['maxwell']['monitor']['metrics_datadog_tags']     = 'tag1:value1'
default['maxwell']['monitor']['metrics_datadog_interval'] = '60'
# These can optionally be provided by encrypted data bags
default['maxwell']['monitor']['metrics_datadog_apikey']   = 'API_KEY'
default['maxwell']['monitor']['metrics_datadog_data_bag'] = ''
default['maxwell']['monitor']['metrics_datadog_host']     = 'localhost'
default['maxwell']['monitor']['metrics_datadog_port']     = '8125'
default['maxwell']['monitor']['watchdog_enabled']         = 'false'
default['maxwell']['monitor']['mailhost']                 = 'smtp.domain.com'
default['maxwell']['monitor']['fromaddr']                 = 'from@domain.com'
default['maxwell']['monitor']['toaddrs ']                 = 'to@domain.com'

# kinesis-producer-library.properties defaults
default['maxwell']['kpl']['AggregationEnabled']       = 'true'
default['maxwell']['kpl']['AggregationMaxCount']      = '4294967295'
default['maxwell']['kpl']['AggregationMaxSize']       = '51200'
default['maxwell']['kpl']['CollectionMaxCount']       = '500'
default['maxwell']['kpl']['CollectionMaxSize']        = '5242880'
default['maxwell']['kpl']['ConnectTimeout']           = '6000'
default['maxwell']['kpl']['CustomEndpoint']           = ''
default['maxwell']['kpl']['FailIfThrottled']          = 'false'
default['maxwell']['kpl']['LogLevel']                 = 'info'
default['maxwell']['kpl']['MaxConnections']           = '24'
default['maxwell']['kpl']['MetricsGranularity']       = 'shard'
default['maxwell']['kpl']['MetricsLevel']             = 'detailed'
default['maxwell']['kpl']['MetricsNamespace']         = 'KinesisProducerLibrary'
default['maxwell']['kpl']['MetricsUploadDelay']       = '60000'
default['maxwell']['kpl']['MinConnections']           = '1'
default['maxwell']['kpl']['Port']                     = '443'
default['maxwell']['kpl']['RateLimit']                = '150'
default['maxwell']['kpl']['RecordMaxBufferedTime']    = '100'
default['maxwell']['kpl']['RecordTtl']                = '30000'
default['maxwell']['kpl']['Region']                   = 'us-east-1'
default['maxwell']['kpl']['RequestTimeout']           = '6000'
default['maxwell']['kpl']['VerifyCertificate']        = 'true'
