-
Notifications
You must be signed in to change notification settings - Fork 314
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
add hab-director #541
add hab-director #541
Conversation
By analyzing the blame information on this pull request, we identified @adamhjk, @fnichol, @smith, @jtimberman and @reset to be potential reviewers |
a604f3f
to
0c764f5
Compare
|
||
pub const FIRST_GOSSIP_PORT: u16 = 9000; | ||
pub const FIRST_SIDECAR_PORT: u16 = 8000; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/pedant You have extra whitespace.
0c764f5
to
e041d4f
Compare
|
||
fn from_toml(toml: toml::Value) -> Result<Self> { | ||
let mut cfg = Config::default(); | ||
let c = toml.lookup("cfg.services").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be error handling here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
e041d4f
to
30d3d49
Compare
use super::ServiceDef; | ||
use super::error::Error; | ||
|
||
const HAB_SUP_PATH: &'static str = "/src/components/sup/target/debug/hab-sup"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this path correct?
a94687f
to
76bae6f
Compare
@habitat-sh/habitat-core-maintainers I fixed up some things to make this work under
|
9dcddb1
to
d78b920
Compare
The first child that is created now connects to the parent |
d78b920
to
c29260f
Compare
Signed-off-by: Dave Parfitt <dparfitt@chef.io>
c29260f
to
6ee8961
Compare
anyone have a moment to review the newest changes so I can get this merged? |
📌 Commit 6ee8961 has been approved by |
Signed-off-by: Dave Parfitt <dparfitt@chef.io> Pull request: #541 Approved by: adamhjk
☀️ Test successful - travis |
Signed-off-by: Dave Parfitt <dparfitt@chef.io> Pull request: #541 Approved by: adamhjk
Signed-off-by: Dave Parfitt <dparfitt@chef.io> Pull request: #541 Approved by: adamhjk
(this text copied verbatim from src/main.rs)
The Habitat Director is a supervisor for a group of
hab-sup
processes. It loads packages to start from it'sconfig.toml
file. The director will automatically restart child process upon failure detection. Eachchild service runs in it's own
hab-sup
process. The director can be run inside of ahab-sup
instance as well.Components
Task
hab-sup start
Controller
ExecContext
ExecContext
is used todecouple service root directory and path to a supervisor executable.
Decoupling these values into a struct allows us to easily test
Tasks
+Controllers
.ExecParams
Task
that theController
calculates duringstartup.
ExecParams
currently includes:ServiceDef
PackageIdent
,ServiceGroup
, and CLI args. Thesevalues are loaded from the config file and are set by the user, as
opposed to
ExecContext
values which are set by theController
.core.redis.somegroup.someorg
corresponds to thecore/redis
PackageIdent
, and theredis.somegroup@someorg
ServiceGroup
.core.redis.somegroup
corresponds to thecore/redis
PackageIdent
, and theredis.somegroup
ServiceGroup
(org-less).
Config file format
ServiceDef
s are parsed from theconfig.toml
file upon startup.All services must be described as children of the
services
toml table.Note, when toml is rendered, the values for
services
will belocated under
cfg.services.*
.Each service definition is a
.
separated list of values as a TOML table name.[services.<origin>.<name>.<group>.<organization>]
or rendered by
hab-sup
:[cfg.services.<origin>.<name>.<group>.<organization>]
A service definition can additionally specify a
start
key/value underthe service table definition:
Signal handling
the director exits. Child processes will have already been sent the signal
from bash because they are in the same session group, and will die as well.
signal behavior is undefined and signals are NOT forwarded to child tasks.
kill this process), they are re-sent to each
Task
in the sameorder that services are defined in
config.toml
.PID files
Task
created, a pid file is created in thehab-director
service directory. For example, forcore.redis.somegroup.someorg
, we'll have a/hab/svc/hab-director/core-redis-somegroup-someorg.pid
file created. Creation/removal of these files is handled automatically by the director.Ring behavior
sys.gossip_ip:sys.gossip_port
by specifying a--peer
to hab-sup. This only occurs if the director is running under a supervisor.--peer
.hab-sup
. If it can't find it, it falls back to thehab-sup
in/src/components/sup...
hab-sup
is demoed hereRUST_LOG=habitat_director=debug
to see process start params, path tohab-sup
etc.config.toml
are split on whitespace to pass tostd::process::Command
. This will break if we allow string args that contain whitespace, but we don't currently have any args that allow whitespace.sup/supervisor
anddirector/controller
behavior when not started from bash should be investigated and updated in another PR.hab-plan-build
to work for any Rust plan.