Giter Club home page Giter Club logo

Comments (11)

solarkennedy avatar solarkennedy commented on June 20, 2024 1

You are right, in puppet each thing must be unique.

How about making your "app_name" have the port in it?

consul::service { "my_app_port_42":
  service => "my_app",
  port => 42,
}

consul::service { "my_app_port_43":
  service => "my_app",
  port => 43,
}

If you want you can specify the id directly too, but in this case you don't have to, it defaults to the title.
Here are all the available params:
https://github.com/solarkennedy/puppet-consul/blob/master/manifests/service.pp#L1

from puppet-consul.

solarkennedy avatar solarkennedy commented on June 20, 2024

Make the title of the consul::service be ${app_name}_${port}.

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

@solarkennedy Thanks for reply, we already use it few places but we dont want to do it cause it creates lot of mess.
This is basic functionality from consul end, and it can be handled on tag level when ports are different and extra information needs to be added.

One more thing i noticed is the Service ID, basically it is created with Service name which is kinda of wrong, cause when you try to register same service with different configuration (like explained in above example) from same node it will overwrite the existing service with latest config instead of adding new service to catalogue, either service id needs to be generated randomly with some logic or overhead should be off loaded to consul as it takes care of it and createsservice id on its own.

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

Can we expect fix for this any time soon @solarkennedy, it will be great help ?

from puppet-consul.

solarkennedy avatar solarkennedy commented on June 20, 2024

I can imagine (PRs welcome) a fix for Service ID.
But there will never be a fix for the puppet language requiring unique names of resources.

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

@solarkennedy correct me if am wrong, i was thinking(suggesting) https://github.com/solarkennedy/puppet-consul/blob/master/manifests/install.pp#L5 this part changing it to defined resource or function.
(It might be a lot of effort to change it though, am not sure).

from puppet-consul.

solarkennedy avatar solarkennedy commented on June 20, 2024

I'm confused, do you intend to install consul multiple times? or configure multiple consul services on the same port?

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

@solarkennedy am just trying to register multiple services from same machine, port can be same, name can be same. The issue is with ID of service if it's unique (by default if you don't provide consul generates random uuid) you can register multiple services on same agent with same name same port but technically they will be different cause of ID. But as of now in module we use service name as ID and that's the problem.

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

Also sorry for late reply, hope you're well in this difficult times :).

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

@solarkennedy Hey kyle yes i do it already, problem with this approach is, the services from other end need to do multiple calls, lets say if service is having multiple ports.
Take this example,

I have proxysql and it's running on multiple ports lets assume 8080, 8081, 8092
Now if i register each proxysql with name-port combination: proxysql-8081, proxysql-8082.

When i want to discover proxysql, I can't get catalog by simply looking for service with proxysql name, i will need to do multiple calls with name-port combination also to make those calls i should know the ports beforehand which beats the whole purpose of service discovery from my opinion.

from puppet-consul.

rushi47 avatar rushi47 commented on June 20, 2024

Yes Adding ID should do the job :) and i can see it's over writable this should help, thanks.

from puppet-consul.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.