<commit_before>---

wimpy_project_name: "{{ wimpy_project | regex_replace('[^a-zA-Z0-9]', '-') }}"

wimpy_docker_image_name: "{{ wimpy_project_name }}" # Name of the docker image that will be created
wimpy_docker_image_version: "{{ (wimpy_release_version == 'master') | ternary('latest',wimpy_release_version) | string }}" # Version of the docker image to push.
wimpy_docker_build_command: "docker build --tag {{ wimpy_docker_image_name }}:{{ wimpy_docker_image_version }} \"{{ lookup('env','PWD') }}\""
wimpy_dockerfile: "{{ playbook_dir }}/../docker-compose-{{ wimpy_deployment_environment }}.yml" # docker-compose file to use to start the app

wimpy_aws_ami_name: "CoreOS-stable-*" # The latest version of this AMI name will be used
wimpy_docker_compose_version: "1.11.1"

wimpy_aws_dns_name: "{{ wimpy_project_name }}" # DNS record for the deployed instance

wimpy_aws_region: "eu-west-1"

# Auto Scaling Group parameters
wimpy_aws_autoscalinggroup_min_size: 1
wimpy_aws_autoscalinggroup_max_size: 2
wimpy_aws_autoscalinggroup_desired_capacity: 1
wimpy_aws_asg_vpc_subnets: "{{ wimpy_vpc_subnets }}"
wimpy_asg_healthcheck_grace_period: 300
wimpy_high_cpu_threshold: 85
wimpy_low_cpu_threshold: 20
wimpy_asg_signal_count: 1
wimpy_asg_signal_timeout: PT3M
wimpy_asg_min_successful_instances_percent: 100

wimpy_scaling_policies:
  - name: "{{ wimpy_project_name }}-cpu-high"
    scaling_adjustment: 1
    cooldown: 300
    adjustment_type: "ChangeInCapacity"

  - name: "{{ wimpy_project_name }}-cpu-low"
    scaling_adjustment: -1
    cooldown: 300
    adjustment_type: "ChangeInCapacity"

wimpy_alarm_metrics:
  - name: "{{ wimpy_project_name }}-cpu-high"
    metric: "CPUUtilization"
    statistics: Average
    comparison: ">="
    threshold: "{{ wimpy_high_cpu_threshold }}"
    period: 300
    evaluation_periods: 2
    unit: "Percent"
    description: "CPU utilization is >= {{ wimpy_high_cpu_threshold }}% for two periods of 5 minutes."
    dimensions:
      AutoScalingGroupName: "{{ wimpy_project_name }}"
    scaling_policy_name: "{{ wimpy_project_name }}-cpu-high"

  - name: "{{ wimpy_project_name }}-cpu-low"
    metric: "CPUUtilization"
    statistics: Average
    comparison: "<"
    threshold: "{{ wimpy_low_cpu_threshold }}"
    period: 300
    evaluation_periods: 2
    unit: "Percent"
    description: "CPU utilization is < {{ wimpy_low_cpu_threshold }}% for two periods of 5 minutes"
    dimensions:
      AutoScalingGroupName: "{{ wimpy_project_name }}"
    scaling_policy_name: "{{ wimpy_project_name }}-cpu-low"

  - name: "{{ wimpy_project_name }}-healthy-nodes-low"
    metric: "HealthyHostCount"
    statistics: Average
    comparison: "<"
    threshold: "1"
    period: 300
    evaluation_periods: 1
    unit: "Count"
    description: "No healthy instances behind the ELB for 5 minutes"
    dimensions:
      ElasticLoadBalancerName: "GroupELB"
    scaling_policy_name: "{{ wimpy_project_name }}-healthy-nodes-low"

# There are two different strategies:
# - rolling_asg: old instances will be replaced by new instances with the new launch configuration
# - new_asg: old instances stay alive, new stack is created
wimpy_deploy_strategy: "rolling_asg"

wimpy_dns_ttl: 300 # DNS record Time To Live
wimpy_new_dns_weight: 100 # DNS record weight

wimpy_needs_elb: false # Whether or not to assign an ELB in front of the ASG instances

wimpy_app_port: 8000 # Port where app will be listening for requests

# ELB Basic Configuration
wimpy_aws_elb_scheme: "internal" # Private or public ip's for instances behind. Possible values: 'internal' or 'internet-facing'
wimpy_aws_elb_draining_timeout: 10 # Wait a specified timeout allowing connections to drain before terminating an instance
wimpy_cross_az_load_balancing: "no" # Distribute load across all configured Availability Zones
wimpy_aws_elb_vpc_subnets: "{{ wimpy_vpc_subnets }}"
wimpy_aws_elb_enable_draining: True

# ELB Healthcheck
wimpy_aws_elb_health_check:
  ping_protocol: http
  ping_port: "{{ wimpy_app_port }}"
  ping_path: /healthcheck
  response_timeout: 5
  interval: 10
  unhealthy_threshold: 2
  healthy_threshold: 3

# ELB Listeners. By default ELB listens on port 80 and forward requests to {{app_port}} using HTTP
wimpy_aws_elb_listeners:
  - protocol: "http"
    load_balancer_port: "80"
    instance_port: "{{ wimpy_app_port }}"

wimpy_aws_elb_stickiness:
  enabled: no
  type: loadbalancer

wimpy_aws_instance_type: t2.small # EC2 instance type

#role_instance_profile: "ansible-deploy" # When commented out, role set to instances. Role needs to exists

# User data executed when the instance is started. We basically do:
# - Install docker-compose
# - Create systemd units to start our service
#
# Systemd unit executes docker-compose up
wimpy_user_data: |-
  #cloud-config
  write_files:
    - path: /home/core/install_docker_compose
      owner: core:core
      permissions: 0744
      content: |
        #!/bin/sh
        mkdir -p /opt/bin
        curl -L https://github.com/docker/compose/releases/download/{{ wimpy_docker_compose_version }}/docker-compose-Linux-x86_64 > /opt/bin/docker-compose
        chmod +x /opt/bin/docker-compose
    - path: /home/core/docker-compose.yml
      owner: core:core
      permissions: 0644
      content: |
        {{ lookup('file', wimpy_dockerfile) | replace('image: ' + wimpy_docker_image_name, 'image: ' + wimpy_docker_image_name + ':' + wimpy_docker_image_version) | indent(6, False) }}
    - path: /home/core/healthcheck.sh
      owner: core:core
      permissions: 0744
      content: |
        {{ lookup('file', role_path + '/files/healthcheck.sh') | indent(6, False) }}
  coreos:
    units:
      - name: "{{ wimpy_project_name }}.service"
        command: "start"
        content: |
          [Unit]
          Description={{ wimpy_project_name }} container
          After=install_docker_compose.service
          Requires=install_docker_compose.service
          [Service]
          User=core
          Restart=always
          ExecStartPre=/usr/bin/docker pull {{ wimpy_docker_image_name }}:{{ wimpy_release_version }}
          ExecStart=/opt/bin/docker-compose -f /home/core/docker-compose.yml up
          ExecStartPost=/home/core/healthcheck.sh "{{ wimpy_asg_name }}" AutoscalingGroup "{{ wimpy_aws_region }}"
          ExecStop=/opt/bin/docker-compose -f /home/core/docker-compose.yml down
          [Install]
          WantedBy=multi-user.target
      - name: install_docker_compose.service
        command: "start"
        content: |
          [Unit]
          Description=Install docker-compose
          After=docker.service
          Requires=docker.service

          [Service]
          Type=oneshot
          ExecStart=/home/core/install_docker_compose<commit_msg>Using lower values for DNS weight<commit_after>---

wimpy_project_name: "{{ wimpy_project | regex_replace('[^a-zA-Z0-9]', '-') }}"

wimpy_docker_image_name: "{{ wimpy_project_name }}" # Name of the docker image that will be created
wimpy_docker_image_version: "{{ (wimpy_release_version == 'master') | ternary('latest',wimpy_release_version) | string }}" # Version of the docker image to push.
wimpy_docker_build_command: "docker build --tag {{ wimpy_docker_image_name }}:{{ wimpy_docker_image_version }} \"{{ lookup('env','PWD') }}\""
wimpy_dockerfile: "{{ playbook_dir }}/../docker-compose-{{ wimpy_deployment_environment }}.yml" # docker-compose file to use to start the app

wimpy_aws_ami_name: "CoreOS-stable-*" # The latest version of this AMI name will be used
wimpy_docker_compose_version: "1.11.1"

wimpy_aws_dns_name: "{{ wimpy_project_name }}" # DNS record for the deployed instance

wimpy_aws_region: "eu-west-1"

# Auto Scaling Group parameters
wimpy_aws_autoscalinggroup_min_size: 1
wimpy_aws_autoscalinggroup_max_size: 2
wimpy_aws_autoscalinggroup_desired_capacity: 1
wimpy_aws_asg_vpc_subnets: "{{ wimpy_vpc_subnets }}"
wimpy_asg_healthcheck_grace_period: 300
wimpy_high_cpu_threshold: 85
wimpy_low_cpu_threshold: 20
wimpy_asg_signal_count: 1
wimpy_asg_signal_timeout: PT3M
wimpy_asg_min_successful_instances_percent: 100

wimpy_scaling_policies:
  - name: "{{ wimpy_project_name }}-cpu-high"
    scaling_adjustment: 1
    cooldown: 300
    adjustment_type: "ChangeInCapacity"

  - name: "{{ wimpy_project_name }}-cpu-low"
    scaling_adjustment: -1
    cooldown: 300
    adjustment_type: "ChangeInCapacity"

wimpy_alarm_metrics:
  - name: "{{ wimpy_project_name }}-cpu-high"
    metric: "CPUUtilization"
    statistics: Average
    comparison: ">="
    threshold: "{{ wimpy_high_cpu_threshold }}"
    period: 300
    evaluation_periods: 2
    unit: "Percent"
    description: "CPU utilization is >= {{ wimpy_high_cpu_threshold }}% for two periods of 5 minutes."
    dimensions:
      AutoScalingGroupName: "{{ wimpy_project_name }}"
    scaling_policy_name: "{{ wimpy_project_name }}-cpu-high"

  - name: "{{ wimpy_project_name }}-cpu-low"
    metric: "CPUUtilization"
    statistics: Average
    comparison: "<"
    threshold: "{{ wimpy_low_cpu_threshold }}"
    period: 300
    evaluation_periods: 2
    unit: "Percent"
    description: "CPU utilization is < {{ wimpy_low_cpu_threshold }}% for two periods of 5 minutes"
    dimensions:
      AutoScalingGroupName: "{{ wimpy_project_name }}"
    scaling_policy_name: "{{ wimpy_project_name }}-cpu-low"

  - name: "{{ wimpy_project_name }}-healthy-nodes-low"
    metric: "HealthyHostCount"
    statistics: Average
    comparison: "<"
    threshold: "1"
    period: 300
    evaluation_periods: 1
    unit: "Count"
    description: "No healthy instances behind the ELB for 5 minutes"
    dimensions:
      ElasticLoadBalancerName: "GroupELB"
    scaling_policy_name: "{{ wimpy_project_name }}-healthy-nodes-low"

# There are two different strategies:
# - rolling_asg: old instances will be replaced by new instances with the new launch configuration
# - new_asg: old instances stay alive, new stack is created
wimpy_deploy_strategy: "rolling_asg"

wimpy_dns_ttl: 300 # DNS record Time To Live
wimpy_new_dns_weight: 10 # DNS record weight

wimpy_needs_elb: false # Whether or not to assign an ELB in front of the ASG instances

wimpy_app_port: 8000 # Port where app will be listening for requests

# ELB Basic Configuration
wimpy_aws_elb_scheme: "internal" # Private or public ip's for instances behind. Possible values: 'internal' or 'internet-facing'
wimpy_aws_elb_draining_timeout: 10 # Wait a specified timeout allowing connections to drain before terminating an instance
wimpy_cross_az_load_balancing: "no" # Distribute load across all configured Availability Zones
wimpy_aws_elb_vpc_subnets: "{{ wimpy_vpc_subnets }}"
wimpy_aws_elb_enable_draining: True

# ELB Healthcheck
wimpy_aws_elb_health_check:
  ping_protocol: http
  ping_port: "{{ wimpy_app_port }}"
  ping_path: /healthcheck
  response_timeout: 5
  interval: 10
  unhealthy_threshold: 2
  healthy_threshold: 3

# ELB Listeners. By default ELB listens on port 80 and forward requests to {{app_port}} using HTTP
wimpy_aws_elb_listeners:
  - protocol: "http"
    load_balancer_port: "80"
    instance_port: "{{ wimpy_app_port }}"

wimpy_aws_elb_stickiness:
  enabled: no
  type: loadbalancer

wimpy_aws_instance_type: t2.small # EC2 instance type

#role_instance_profile: "ansible-deploy" # When commented out, role set to instances. Role needs to exists

# User data executed when the instance is started. We basically do:
# - Install docker-compose
# - Create systemd units to start our service
#
# Systemd unit executes docker-compose up
wimpy_user_data: |-
  #cloud-config
  write_files:
    - path: /home/core/install_docker_compose
      owner: core:core
      permissions: 0744
      content: |
        #!/bin/sh
        mkdir -p /opt/bin
        curl -L https://github.com/docker/compose/releases/download/{{ wimpy_docker_compose_version }}/docker-compose-Linux-x86_64 > /opt/bin/docker-compose
        chmod +x /opt/bin/docker-compose
    - path: /home/core/docker-compose.yml
      owner: core:core
      permissions: 0644
      content: |
        {{ lookup('file', wimpy_dockerfile) | replace('image: ' + wimpy_docker_image_name, 'image: ' + wimpy_docker_image_name + ':' + wimpy_docker_image_version) | indent(6, False) }}
    - path: /home/core/healthcheck.sh
      owner: core:core
      permissions: 0744
      content: |
        {{ lookup('file', role_path + '/files/healthcheck.sh') | indent(6, False) }}
  coreos:
    units:
      - name: "{{ wimpy_project_name }}.service"
        command: "start"
        content: |
          [Unit]
          Description={{ wimpy_project_name }} container
          After=install_docker_compose.service
          Requires=install_docker_compose.service
          [Service]
          User=core
          Restart=always
          ExecStartPre=/usr/bin/docker pull {{ wimpy_docker_image_name }}:{{ wimpy_release_version }}
          ExecStart=/opt/bin/docker-compose -f /home/core/docker-compose.yml up
          ExecStartPost=/home/core/healthcheck.sh "{{ wimpy_asg_name }}" AutoscalingGroup "{{ wimpy_aws_region }}"
          ExecStop=/opt/bin/docker-compose -f /home/core/docker-compose.yml down
          [Install]
          WantedBy=multi-user.target
      - name: install_docker_compose.service
        command: "start"
        content: |
          [Unit]
          Description=Install docker-compose
          After=docker.service
          Requires=docker.service

          [Service]
          Type=oneshot
          ExecStart=/home/core/install_docker_compose
{'fraction_non_alphanumeric': 0.1015213358070501, 'fraction_numerical': 0.012838589981447124, 'mean_word_length': 3.879073135409124, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4465650', 'n_tokens_mistral': 4824, 'n_tokens_neox': 4535, 'n_words': 1026}