-
Notifications
You must be signed in to change notification settings - Fork 37
Consul support #1
Comments
@juanjovazquez, thanks for your kind words. So far have no big plans, but PRs are always very welcome! In order to support different coordination services I think we need to abstract over the actual interactions with etcd, consul and potential others – we probably should split the project into I'm not familiar with consul. Do you think the current design of the state machine would also work for consul? In particular, does it offer some means of locking, e.g. via a CAS write (like etcd)? |
I think this should be feasible, but please let me check this out more carefully. I will keep you posted on the progress by means of this issue. |
Yeah, let's use this issue to discuss possible approaches. |
@hseeberger, regarding this effort, I've started trying to get the same outcomes as with the etcd based code. In order to remain simple and to make easier the compare and constrast task between etcd and consul, I've just copy-pasted the Consul is more fine-grained than etcd when it comes to solve the use cases, i.e. locks, mutex, semaphores, leader election, etc. For example, in order to create a lock in the same way you did for the Locking stage, I had to carry out the following operations: (1) Create a session with a ttl and (2) Create the This locking session will never be renewed so that the session will be deleted after the ttl. A similar workflow is carried out during the type StateData = (List[Address], Option[String]) where the optional second element in the tuple references this session-id. I'm not used to FSM's so I've probably made mistakes but I didn't want to continue until know your opinion about the convenience of a code refactoring to accommodate both coordination services. |
Thanks a lot. I'm currently at a conference, but will take a look later. |
I took a quick look and noticed two things: First your approach of copying makes it terribly hard to see what has been changed. May I suggest you simply change the ConstructrMachine so it's possible to look at a diff? Second, I think only matching |
Of course, you're right. I'll propose you a new version ASAP. Thanks!. |
No worries, your contribution is highly appreciated! |
@hseeberger I hope you can explore it easier now. Please, feel free to ask me for any other improvement. Thanks in advance. |
Thanks a lot. It's a pity that using Consul is so much harder than etcd. Before moving on we should add tests. The existing tests require a running etcd, I have to change that ... but in the meantime why don't you mimic the existing tests for Consul. BTW, I think you don't have to go through rapture-json, i.e. can marshal/unmarshal directly. But we can figure that out later. |
@juanjovazquez, just a heads-up that I'm currently working on supporting different clustered systems like Cassandra. This adds another dimension, hence supporting different coordination services (like Consul) will be affected and might probably be postponed. |
@hseeberger, no problem, I can always close my own 'private' versions to solve my more urgent use cases. As far as this project is concerned, what I'd like to know is whether the support of different coordination services is appealing to you or not. If so, I'm willing to work on it or even other members of my team. In that case, it would be important to me that you to participate in defining the kind of abstractions to carry out, the project structure and so on. I wouldn't like to force you in some direction that you don't want to take. On the other hand, I'll work in the integration testing part ASAP. Regarding JSON parsing, I'm using your json marshaller in the context of some internal projects. I love it and I suppose that it's what you mean when talk about not sticking to rapture, isn't it?. |
@juanjovazquez, supporting different coordination services is definitely appealing and getting contributions (like yours) even more. The only problem I'm facing right now is the very early state of this project and the numerous axes it could/should evolve which impose complexity that needs to be managed. Please continue working on Consul support, in particular the tests. Once we know it's working, we can think about common abstractions. Regarding JSON I'm using Rapture in addition to the standard spray-json-marshalling from Akka HTTP, because etcd returns nastily verbose objects which I didn't want to rebuild as case classes. Not sure if this is a good idea, though. In your case it looked to me that Rapture isn't adding a lot of value because the JSON returned by Consul seems to be pretty close to the "domain objects". |
@juanjovazquez, I have introduced an abstraction for coordination backends like etcd and Consul. Please take a look at #5. Ideally you would implement |
@hseeberger, great!. We're working in the testing part for Consul but we'll update our fork first in order to take advantage of this abstraction. I've had to involve a member of my team in this effort and he's needing some time to catch up but I think we'll be able to propose a working Consul based version in the next days. Thanks!. |
@juanjovazquez, sounds great! At this early stage the code isn't documented at all, so if you or your coworker have questions, don't hesitate to ask. |
@hseeberger, sure we'll have!. Thanks! |
@juanjovazquez, I pushed some more changes and I'm really happy that the introduced abstractions (coordination, machine) work for Akka and Cassandra! I'm pretty sure we need to fine tune some details, but the overall design seems to work. Looking forward to seeing Consul support (in the constructr-coordination module). |
@hseeberger, I'm glad that the metaphor (a.k.a. ConstructrMachine) is working well. Congrats!. Up until now, all we'll probably need to add is a way to carry some metadata about the open session with the coordination service, i.e. Consul. As I mentioned before, in order to be able to refresh the node registry, we need to provide a type StateData = (List[Address], Option[String]) The optional String is a container for the sessionId that will be provided after the type StateData = (List[Address], Option[Metadata]) where type Metadata = Map[String, String] WDYT? |
@juanjovazquez, yeah, keeping some context of type |
@hseeberger, just a short update about our efforts on Consul. We already have the set of multinode tests working properly with Consul instead of etcd. Now, we're going to adapt the solution to the abstractions you've been working lately. We'll try to bring up to date our part asap!. Please, stay tuned!. |
That sounds like great progress! |
@hseeberger, as you've probably already seen, we've created a PR according to the outcomes from this discussion thread. A couple of things to take into account. First, we've had to slightly change the way we're starting the docker containers in tests in order to run them into docker-machine. We couldn't make them start properly in the other way. Second, we cannot see what has happenned with the refreshing stage after your last changes in code. Please, could you pointing out how is currently the refreshing procedure?. As we understand, it's still necessary to refresh periodically the keys in the coordination service as they have been registered with a ttl, but unfortunately we cannot understand how you are doing now. Thanks! |
Ok, I've just seen that you're commenting in the PR. Sorry... |
No worries! |
@hseeberger, please find here #12 a new installment of the Consul PR. Feel free to comment and criticize ;) |
@hseeberger, please check out our last revision of #12. As you mentioned, we've squashed all revisions into a single commit. All tests are passing ;). |
Fixed by #12. |
Excellent work!. Thanks for sharing this. Do you have any plans to support consul in addition to etcd in the near future?. Would you accept PRs in this regard?.
The text was updated successfully, but these errors were encountered: