Closed freeformflow closed 9 years ago
@PandaWhisperer, I'm assigning this to you for iteration Alpha-02. Huxley stands to gain from a stabilized and reliable kick server, and you have experience with PBX. So, this is a good match for you.
Copied From panda-kick Ticket 2
@PandaWhisperer, I agree that panda-kick is rough. Since it's passed the proof-of-concept test from Dan, let's go ahead and create a formalized API server using PBX. It should only take a couple days, and we want to make sure this is reliable since it underpins our ability to deploy other services.
Since panda-kick is part of the "wiring up" that Huxley clusters perform, and you've been dealing with that for the ELK stack mixins, I think this work dove-tails nicely. This is Ticket #24 on Huxley. Let's make it part of your Iteration Alpha-02 work, please. I'll copy this text there.
Also, please let me know if you'd like me to walk you through any code or intentions.
@PandaPup I do have a question about the kick server. Is there a reason why the configuration file is read several times on each request? Is that intentional? I.e. is there ever a situation where we want to change the configuration without having to restart the kick server?
@PandaWhisperer No, at least not right now. My main concern is to be cautious because the kick server holds AWS credentials. At the time, I thought it would be better if those were not held in active memory, but that idea did not pan out very well, haha.
The main protection for the kick server is the AWS Security Group. The kick server is accessible on port 2000, which is exposed to only other addresses on the subnet. This should be sufficient for now, so we can abandon my earlier misguided plan to keep the config out of active memory.
To the question of configuration, we want to work toward making the kick server pretty savvy and independent, eventually. Because the kick server has AWS access, theoretically it could lookup what it needs from Amazon. For example, when a service asks for a hostname under a new domain, the kick server could find out that hosted zone ID. But that's a future wish. For now, we can focus on stability.
Well, the credentials are already stored unencrypted on disk. Plus, once they're read into memory, even if it's just into a local variable, you have no control over how long they remain there, because of the garbage collector. Oh and finally, you assign them to a persistent object (AWS.config = configure_aws()
), so they actually stay in memory unencrypted the entire lifetime of the server.
Since the kick server is the only thing accessible on the machine, the only insurance we have is that it's not vulnerable to a buffer overflow attack? Hopefully JavaScript keeps its strings in check.
Been working on this and I have a couple questions / thoughts on using PBX:
application/json
is not enough. .service
file, I'm not sure how that would work. Also, when would deleting every occur? Currently non of the .service
files I've seen do that.@PandaPup @dyoder Please let me know your input on this.
@PandaWhisperer, okay, cool.
@PandaPup
application/json
by inserting the vnd
(signifying a vendor-specific extension, I believe) prefix and the name of the application and the resource being described: application/vnd.#{app_name}.#{resource_name}+json
. This can be achieved with curl
by adding an appropriate -H 'Content-Type: ...'
header. A custom client would be sleeker, and only require a few lines of code thanks to autodiscovery, but it would have to be added to the Docker images (I believe).Well, I guess we could do whatever we want in the create
handler, and forgo all the others, including PUT. But then there isn't really much left that we'd need PBX for, so a plain server would (or using connect) would be preferable.
@PandaWhisperer,
Also, if we need to, we can eventually start holding resource IDs in etcd. That would be cool, actually. So, we don't need to be afraid of being RESTful. We want to work with PBX to make our lives easier.
The rewrite should address panda-kick:#4, panda-kick:#5.
Closing because https://github.com/pandastrike/panda-kick/pull/6 has been merged.
The code for the cluster's kick server is stored in panda-kick. It works, but it's fairly rough. We should formalize it and use PBX to setup a proper API. We should create a JSON schema for the kick server's inputs and set up the kick server to begin validating requests it is sent.