I am looking into using Consul, and cannot figure out what Consul defines as a 'service' (aka how does it start it / what information is passed to it on start.)
I have a working cluster, and have written custom init.d
services in Ubuntu to try and test it out, but the init.d services are never called when I register them as service with Consul, and do not show up in the web UI either.
Local consul server config:
{
"bootstrap": true,
"server": true,
"log_level": "DEBUG",
"enable_syslog": true,
"datacenter": "dc1",
"data_dir": "data",
"acl_datacenter": "dc1",
"acl_default_policy": "allow",
"encrypt": "secret",
"acl_master_token": "secret",
"ui": true
}
Super simple script to try and determine information passed:
echo "$@" > /home/user/file1
set > /home/user/file2
My end goal is to simply have Consul start a custom script on a given node (with no web interface), that passes the information in Consul's service definition into it (ID and tags specifically).
I imagine I am understanding something elementally wrong, and would like any guidance you have to offer.
Thanks for reading!
Edit: For example, they show lower on that page how you can run two redis servers on multiple ports. How are the services being started and how is that information passed to them?
Edit 2: Thanks for the replies, they both helped me understand this better! (so I just accepted the one that came first.)
Consul has nothing to do with "starting services", it only provides information about services for another services.
Edit: For example, they show lower on that page how you can run two redis servers on multiple ports. How are the services being started and how is that information passed to them?
In this Example both Redis servers were started outside of Consul. For example we are using supervisord fot this or starting Redis as service via init.d
So, how it works: