Gentoo Archives: gentoo-user

From: Damo Brisbane <dhatchett2@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Openrc - where to register services for discovery
Date: Tue, 08 May 2018 01:50:04
Message-Id: CAE5cDqNunLQwyc9hjm_pdLBG6H1d7ZwYmNeR4w7Nqk6JKqwKWw@mail.gmail.com
1 I'd like to add hooks into an openrc startup script for sidecar
2 <http://ispyker.blogspot.com.au/2014/08/a-netflixoss-sidecar-in-support-of-non.html>
3 type functionality, ie service discovery registration, but not exactly
4 sure the best way to do it. The problem seems to happen often enough that
5 i'd welcome some feedback on it. Preferably openrc, but s6 experience
6 appreciated. For example;
7
8 To add service discovery to the starting of some init.d service, eg lets
9 say a docker container, the container starts every time as a result of
10 running */etc/init.d/docker start*, and as a consequence of being created
11 with:
12
13 --restart=always
14
15 With above flag, the container will automatically start as part of the
16 standard docker init script, "/etc/init.d/docker start". But in my case,
17 the container does not natively register itself with consul (or could be
18 any other service discovery system). I know that I can run another
19 container to do the job of registering the container into the service
20 discovery system, but interested in any alternative *within the init
21 system*, ie using openrc script?
22
23 Might it as a *post-hook*, or as an extra file in some *conf.d* place? I
24 could hack together something, ie using a piece of code like "curl
25 .../register/myservice", but prefer to hear other peoples
26 experience/knowledge on how/where this may be done.
27 Cheers