Create New Pricing Log Stack

h1. Request Details
h2. Background
Some Hotels (usually chain hotels like Accor) doesn’t allow us to make modification to their price. If we do, they would complaint and close down their inventory in Traveloka, and could reduce our GBV by USD 38,000 per day (with revenue 7% ~ USD 2,660). Usually there are ~20 complaints per day that Pricing Ops need to check.

Sometimes the error comes from the provider, and we need to be able to proof it when hotel / provider asks us. Sometimes the error comes from us. So we need to track what price we gave to our customers and why, and also provide a tool for Pricing Ops to check the case themselves without engineer’s and PM’s help.

Design Doc: https://docs.google.com/document/d/1uVhzVe7HVvMDnV3Wqo6RwIUNa9Z7KVUnHsSpLAdAjJo/edit#

h2. Purpose
To provide pricing ops with the tool needed to handle dispute on why we give certain price to customers.

h2. Impact
If we're not able to handle the dispute, Hotel can close-down their inventory in Traveloka. Both from direct contract (TERA) and from our providers. This will reduce our inventory completeness and revenue. More over if the hotel is part of a bigger group like Accor, they can close down all their hotels.

h2. Risk

h2. Resources
h3. EC2
h4. Configuration
{code}
count = "4"
instance_type = "m4.large"
ebs_optimized = "false"
disable_api_termination = "false"

root_block_device = {
volume_type = "gp2"
volume_size = "8"
delete_on_termination = "true"
}

tags = {
Service = "ainlog"
Cluster = "ainlog"
ProductDomain = "ain"
Application = "java-7"
Environment = "production"
Description = "Logging service for ain domain"
}
{code}

h3. ALB
h4. Configuration
{code}
name = "ainlog-lbint-<random-id>"
security_groups = "ainlog-lbint"
internal = "true"
idle_timeout = "60"
enable_deletion_protection = "false"

tags = {
Name = "ainlog-lbint-<random-id>"
Service = "ainlog"
ProductDomain = "ain"
Environment = "production"
Description = "Internal load balancer for ainlog-app"
}
{code}

h4. Listener
{code}
port = "443"
protocol = "HTTPS"

default_action {
target_group_arn = "ainlog-app"
type = "forward"
}
{code}

h4. Target Group
{code}
name = "ainlog-app"
port = "61205"
protocol = "HTTP"
deregistration_delay = "300"

tags = {
Name = "ainlog-app"
Service = "ainlog"
ProductDomain = "ain"
Environment = "production"
Description = "Target group for ainlog-app"
}

health_check = {
interval = "10"
path = "/healthcheck"
port = "traffic-port"
protocol = "HTTP"
timeout = "5"
healthy_threshold = "5"
unhealthy_threshold = "2"
matcher = "200"
}
{code}

h4. DNS Record
ainlog.main.tvlk.cloud

h3. Elasticsearch
h4. Configuration
{code}
domain_name = "ainlog-log-<random-id>"
elasticsearch_version = "6.2"

cluster_config {
instance_type = "m4.large.elasticsearch"
instance_count = "4"
dedicated_master_enabled = "false"
zone_awareness_enabled = "true"
}

// Required by some instance type.
ebs_options = {
ebs_enabled = "true"
volume_type = "gp2"
volume_size = "200"
}

tags = {
Name = "ainlog-log-<random-id>"
Service = "ainlog"
ProductDomain = "ain"
Environment = "production"
Description = "Elastic Search for querying log"
}
{code}

h4. Domain Policy
{code}
read_write = ["ainlog-app"]
allowed_actions = [
"es:ESHttpGet",
"es:ESHttpHead",
"es:ESHttpPost",
"es:ESHttpDelete",
"es:ESHttpPut",
]
{code}

h3. SQS Queue
h4. Configuration
{code}
name = "ainlog-log-<random-id>"
visibility_timeout_seconds = "30"
message_retention_seconds = "345600"
max_message_size = "262144"
delay_seconds = "0"
receive_wait_time_seconds = "0"

tags = {
Name = "ainlog-log-<random-id>"
Service = "ainlog"
ProductDomain = "ain"
Environment = "production"
Description = "Queue for logging"
}
{code}

h4. SQS Policy
{code}
producers = ["aingine-app","hinv-app"]
allowed_actions = [
"sqs:SendMessage",
"sqs:SendMessageBatch",
"sqs:ChangeMessageVisibility",
"sqs:ChangeMessageVisibilityBatch",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl",
"sqs:PurgeQueue"
]
{code}

{code}
consumers = ["ainlog-app"]
allowed_actions = [
"sqs:ReceiveMessage",
"sqs:DeleteMessage",
"sqs:DeleteMessageBatch",
"sqs:ChangeMessageVisibility",
"sqs:ChangeMessageVisibilityBatch",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl"
]
{code}

h3. Connectivity
h4. Rules
{code}
SourceId, Destination, from_port, to_port, protocol
hinv-app, ainlog-lbint, 443, 443, TCP
aingine-app, ainlog-lbint, 443, 443, TCP
ainops-app, ainlog-lbint, 443, 443, TCP
ainlog-lbint, ainlog-app, 61205, 61205, TCP
{code}

https://29022131.atlassian.net/browse/ACT-9517