cloudfoundry-community / cf-boshworkspace

Deploy Cloud Foundry using bosh-workspace
7 stars 17 forks source link

Add missing metron_agent.deployment to cf-aws-large*.yml #74

Closed djvdorp closed 9 years ago

djvdorp commented 9 years ago
CF v209+ requires a global property (metron_agent.deployment) to be set,
as per their release notes:

new mandatory property to add: properties.metron_agent.deployment
(defaults to meta.environment in spiff templates)
- https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/v209

For the tiny (aws) deployments in cf-boshworkspace, this has been fixed in
this commit:
- https://github.com/cloudfoundry-community/cf-boshworkspace/commit/239aaa9d5c16f0b9dba71fd8c33bcb5fabf16664

However, this does not seem to be the case for the large
(aws) deployments, and that makes the deployment fail with error:

Started preparing configuration > Binding configuration. Failed: Error
  filling in template `metron_agent.json.erb' for `ha_proxy_z1/0' (line
5: Can't find property `["metron_agent.deployment"]') (00:00:01)

Error 100: Error filling in template `metron_agent.json.erb' for
`ha_proxy_z1/0' (line 5: Can't find property
`["metron_agent.deployment"]')

Notes:

  1. We wanted to make the change in the same place as this commit does it for the cf-aws-tiny.yml deployments. However, we were not sure which file from the cf-aws-large is the equivalent of tiny/cf-tiny-scalable.yml for the Large deployments. For this reason, we created a separate template cf-metron-agent.yml to have a clear change. We have also put it in the same position (right after cf/cf-deployment.yml in the templates list) as this is done for the Tiny deployments.
  2. We are not sure that either this commit or our commit should be needed, as per this issue the cf/cf-lamb.yml template should be filling in the metron_agent.deployment global property for you.

I will post/move my comments I made at the cf-release issue #690 here for reference.

djvdorp commented 9 years ago

Comment 1 moved from cf-release issue #690:

@jpalermo, I'm sorry for commenting on this issue while it's already closed, but I'm currently running into pretty much the same issue as @mjseid had here.

Trying to install a cf-aws-large deployment with version 210. OS: ubuntu Spiff: 1.0.3 IaaS: AWS Installation routine: https://github.com/cloudfoundry-community/terraform-aws-cf-install which uses templates from https://github.com/cloudfoundry-community/cf-boshworkspace

I checked everything that's already mentioned here:

meta:
  environment: ~

lamb_meta:
  release:
    name: cf

  loggregator_templates:
  - name: doppler
    release: (( lamb_meta.release.name ))
  - name: syslog_drain_binder
    release: (( lamb_meta.release.name ))
  - name: metron_agent
    release: (( lamb_meta.release.name ))

  loggregator_trafficcontroller_templates:
  - name: loggregator_trafficcontroller
    release: (( lamb_meta.release.name ))
  - name: metron_agent
    release: (( lamb_meta.release.name ))

jobs:
- name: loggregator_z1
  properties:
    doppler:
      zone: z1
    metron_agent:
      zone: z1

- name: loggregator_z2
  properties:
    doppler:
      zone: z2
    metron_agent:
      zone: z2

- name: loggregator_trafficcontroller_z1
  properties:
    traffic_controller:
      zone: z1
    metron_agent:
      zone: z1

- name: loggregator_trafficcontroller_z2
  properties:
    traffic_controller:
      zone: z2
    metron_agent:
      zone: z2

properties:
  <<: (( merge ))

  loggregator:
    maxRetainedLogMessages: 100
    debug: (( merge || false ))
    blacklisted_syslog_ranges: ~

  doppler:
    maxRetainedLogMessages: 100
    debug: (( merge || false ))
    blacklisted_syslog_ranges: ~
    unmarshaller_count: (( merge || 5 ))

  metron_agent:
    deployment: (( meta.environment ))

(file 2: /home/ubuntu/workspace/deployments/cf-boshworkspace/.releases/cf/src/loggregator/manifest-templates/lamb-properties.rb):

class LambProperties
  def initialize(infrastructure)
    @infrastructure = infrastructure
  end

  def loggregator_z1_properties
    result = <<-EOF
    metron_agent:
      zone: z1
    doppler:
      zone: z1
    EOF
    result.chomp
  end

  def loggregator_z2_properties
    result = <<-EOF
    metron_agent:
      zone: z2
    doppler:
      zone: z2
    EOF
    result.chomp
  end

  def loggregator_trafficcontroller_z1_properties
    result = <<-EOF
    metron_agent:
      zone: z1
    traffic_controller:
      zone: z1
    EOF
    result.chomp
  end

  def loggregator_trafficcontroller_z2_properties
    result = <<-EOF
    metron_agent:
      zone: z2
    traffic_controller:
      zone: z2
    EOF
    result.chomp
  end

  def loggregator_templates
    result = <<-EOF
    - name: doppler
      release: cf
    - name: syslog_drain_binder
      release: cf
    - name: metron_agent
      release: cf
    EOF
    result.chomp
  end

  def loggregator_trafficcontroller_templates
    result = <<-EOF
    - name: loggregator_trafficcontroller
      release: cf
    - name: metron_agent
      release: cf
    EOF
    result.chomp
  end

  def aws_lamb_properties(deployment_name)
    result = <<-EOF
  loggregator:
    maxRetainedLogMessages: 100
    debug: false
    blacklisted_syslog_ranges:
    - start: 10.10.0.0
      end: 10.10.255.255

  doppler:
    maxRetainedLogMessages: 100
    debug: false
    blacklisted_syslog_ranges: null
    unmarshaller_count: 5

  metron_agent:
    deployment: #{deployment_name}
    EOF
    result.chomp
  end

  def lamb_properties(deployment_name)
    return aws_lamb_properties(deployment_name) if @infrastructure == 'aws'

    result = <<-EOF
  loggregator:
    maxRetainedLogMessages: 100
    debug: false
    blacklisted_syslog_ranges: null

  doppler:
    maxRetainedLogMessages: 100
    debug: false
    blacklisted_syslog_ranges: null
    unmarshaller_count: 5

  metron_agent:
    deployment: #{deployment_name}
    EOF
    result.chomp
  end

  def get_binding
    binding
  end
end
---
name: cf-aws-large
director_uuid: ae64e1ad-3ceb-4ff0-9e9b-55012142602c
releases:
- name: cf
  version: 210
meta:
  environment: cf-aws-large

However, the properties.metron_agent section at the top level (properties: without any indentation) is missing, even though I think that CF-Lamb should generate it (/home/ubuntu/workspace/deployments/cf-boshworkspace/.deployments/cf-aws-large.yml).

I have already read and checked these sources, but am unable to get any further at this moment without doing dirty workarounds:

djvdorp commented 9 years ago

Comment 2 moved from cf-release issue #690:

In the mean time, I tried to work around the issue by using a higher version of CloudFoundry to install with https://github.com/cloudfoundry-community/terraform-aws-cf-install (cf_release_version = 212 instead of the default 210) but I'm hitting the same issue.

This might mean that something might be wrong in the deployments/templates provided by that that project? I will try to pinpoint this some more, as far as I'm able to, any input or help would be greatly appreciated!

The spiff command used for merging (with cf_size = "large"):

spiff merge 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf/cf-deployment.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf/cf-jobs.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-uaa-port.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-allow-services-access.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf/cf-properties.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf/cf-infrastructure-aws.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf/cf-minimal-dev.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf/cf-lamb.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-runners.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-single-az.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-no-ssl.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-test-errands.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-properties.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-use-haproxy.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-use-postgresql.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-use-nfs.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-secrets.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-networking.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/templates/cf-deployment-size.yml 
/home/ubuntu/workspace/deployments/cf-boshworkspace/.stubs/cf-aws-large.yml 2>&1
lnguyen commented 9 years ago

thanks!

djvdorp commented 9 years ago

Thank you for merging this in!

@longnguyen11288 @geofffranks may I ask what the version/release strategy for this repository is? I have noticed that the latest release is v1.1.14, but cloudfoundry-community/terraform-aws-cf-install still uses v1.1.13.

I'm just asking since I had a lot of pull requests accepted here recently:

And people using the upstream cloudfoundry-community/terraform-aws-cf-install repository might benefit from the fixes if they run into the same issues as we did.

geofffranks commented 9 years ago

I can take a look this week and see about bumping the version. In the mean time, you can use the cf_boshworkspace_version variable in the terraform.tfvars file of terraform-aws-cf-install to control what commit/tag/branch of cf-boshworkspace you use.

geofffranks commented 9 years ago

Ok, v1.1.15 updated, and default version of https://github.com/cloudfoundry-community/terraform-aws-cf-install is updated for it.

djvdorp commented 9 years ago

@geofffranks thank you very much, we just gave the cf_boshworkspace_version v1.1.15 a try on a cf-aws-large deployment this morning, and it works flawlessly!