Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing discovery method when trying to create watcher #70

Closed
Jaykah opened this issue Jun 5, 2014 · 6 comments
Closed

Missing discovery method when trying to create watcher #70

Jaykah opened this issue Jun 5, 2014 · 6 comments
Labels

Comments

@Jaykah
Copy link
Contributor

Jaykah commented Jun 5, 2014

Hello,

I am trying to get Synapse up and running, however, I have encountered the following error:

/usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/service_watcher.rb:24:in `create': Missing discovery method when trying to create watcher (ArgumentError)
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:72:in `block in create_service_watchers'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:71:in `each'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:71:in `create_service_watchers'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:18:in `initialize'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/bin/synapse:59:in `new'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/bin/synapse:59:in `<top (required)>'
    from /usr/local/bin/synapse:23:in `load'
    from /usr/local/bin/synapse:23:in `<main>'

My config looks like this:


---
  services: 
    application: 
      default_servers: 
        - 
          name: "default-app"
          host: "111.111.111.111"
          port: 443
      discovery: 
        method: "zookeeper"
        path: "/services/application"
        hosts: 
          - "xhbtr.site.com:2181"
          - "xhbtr2.site.com:2181"
          - "xhbtr3.site.com:2181"
      haproxy: 
        port: 3214
        server_options: "check inter 2s rise 3 fall 2"
        listen: 
          - "mode http"
          - "option httpchk /health"
          - "http-check expect string OK"
    haproxy: 
      reload_command: "sudo service haproxy reload"
      config_file_path: "/etc/haproxy/haproxy.cfg"
      socket_file_path: "/var/haproxy/stats.sock"
      do_writes: true
      do_reloads: true
      do_socket: false
      global: 
        - "daemon"
        - "user haproxy"
        - "group haproxy"
        - "maxconn 4096"
        - "log     127.0.0.1 local0"
        - "log     127.0.0.1 local1 notice"
        - "stats   socket /var/haproxy/stats.sock mode 666 level admin"
      defaults: 
        - "log      global"
        - "option   dontlognull"
        - "maxconn  2000"
        - "retries  3"
        - "timeout  connect 5s"
        - "timeout  client  1m"
        - "timeout  server  1m"
        - "option   redispatch"
        - "balance  leastconn"
      extra_sections: 
        listen stats :3212: 
          - "mode http"
          - "stats enable"
          - "stats uri /"
          - "stats refresh 5s"

What am I missing?

Thanks!

@igor47
Copy link
Collaborator

igor47 commented Jun 6, 2014

the reason is that your haproxy section is at the same level of indentation as the application section, under services; haproxy should be a top-level key, at the same level as services instead of under it. currently, it looks like you have no haproxy section but two services, one application which a valid discovery method and one haproxy with no valid discovery method.

this took me a long time to spot. the point of YAML was to make writing these kinds of configs easier, but it still doesn't do an amazing job...

@igor47 igor47 added the question label Jun 6, 2014
@igor47 igor47 closed this as completed Jun 6, 2014
@Jaykah
Copy link
Contributor Author

Jaykah commented Jun 6, 2014

Thank you, Igor! Looks like this has taken me a step forward.

However, now I get:

/usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/service_watcher.rb:28:in `create': Invalid discovery method ["zookeeper"] (ArgumentError)
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:72:in `block in create_service_watchers'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:71:in `each'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:71:in `create_service_watchers'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:18:in `initialize'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/bin/synapse:59:in `new'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/bin/synapse:59:in `<top (required)>'
    from /usr/local/bin/synapse:23:in `load'
    from /usr/local/bin/synapse:23:in `<main>'

I have tried to follow the project documentation, but it seems like it's a bit outdated (with YAML instead of JSON, and apparently the methods). Would be glad to help fix it up once I understand how to make it work.

@igor47
Copy link
Collaborator

igor47 commented Jun 6, 2014

why is it ["zookeeper"] in square brackets? are you accidentally creating a yaml list?

@Jaykah
Copy link
Contributor Author

Jaykah commented Jun 6, 2014

That's the thing, my YAML does not contain any square brackets, nor does it have the hyphen+space that indicates a list in the case of discovery method.

I have tried a number of variations, with no luck.

It currently looks like this:

services:
 application:
  default_servers:
    name: "default-app"
    host: "111.111.111.111"
    port: 443
  discovery:
    method: "zookeeper"
    path: "/services/application"
    hosts:
     - "xhbtr.site.com:2181"
     - "xhbtr2.site.com:2181"
     - "xhbtr3.site.com:2181"
  haproxy:
    port: 3213
    server_options: "check inter 2s rise 3 fall 2"
    listen:
     - "mode http"
     - "option httpchk /health"
     - "http-check expect string OK"
haproxy:
 reload_command: "sudo service haproxy reload"
 config_file_path: "/etc/haproxy/haproxy.cfg"
 socket_file_path: "/var/haproxy/stats.sock"
 do_writes: true
 do_reloads: true
 do_socket: false
 global:
  - "daemon"
  - "user haproxy"
  - "group haproxy"
  - "maxconn 4096"
  - "log     127.0.0.1 local0"
  - "log     127.0.0.1 local1 notice"
  - "stats   socket /var/haproxy/stats.sock mode 666 level admin"
 defaults:
  - "log      global"
  - "option   dontlognull"
  - "maxconn  2000"
  - "retries  3"
  - "timeout  connect 5s"
  - "timeout  client  1m"
  - "timeout  server  1m"
  - "option   redispatch"
  - "balance  leastconn"
 extra_sections:
  listen stats :3212:
   - "mode http"
   - "stats enable"
   - "stats uri /"
   - "stats refresh 5s"

@Jaykah
Copy link
Contributor Author

Jaykah commented Jun 6, 2014

Figured it out, had an extra space that I didn't notice.

@Jaykah
Copy link
Contributor Author

Jaykah commented Jun 6, 2014

--comment moved to a separate ticket--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants