containers/osbuild-composer: add prometheus port parameter
This commit is contained in:
parent
170feba87b
commit
962ad9e582
2 changed files with 44 additions and 2 deletions
|
|
@ -59,6 +59,18 @@ class Cli(contextlib.AbstractContextManager):
|
||||||
dest="composer_api",
|
dest="composer_api",
|
||||||
help="Disable the composer-API",
|
help="Disable the composer-API",
|
||||||
)
|
)
|
||||||
|
self._parser.add_argument(
|
||||||
|
"--prometheus",
|
||||||
|
action="store_true",
|
||||||
|
dest="prometheus",
|
||||||
|
help="Enable prometheus listener",
|
||||||
|
)
|
||||||
|
self._parser.add_argument(
|
||||||
|
"--no-prometheus",
|
||||||
|
action="store_false",
|
||||||
|
dest="prometheus",
|
||||||
|
help="Disable prometheus listener",
|
||||||
|
)
|
||||||
self._parser.add_argument(
|
self._parser.add_argument(
|
||||||
"--composer-api-port",
|
"--composer-api-port",
|
||||||
type=int,
|
type=int,
|
||||||
|
|
@ -66,6 +78,13 @@ class Cli(contextlib.AbstractContextManager):
|
||||||
dest="composer_api_port",
|
dest="composer_api_port",
|
||||||
help="Port which the composer-API listens on",
|
help="Port which the composer-API listens on",
|
||||||
)
|
)
|
||||||
|
self._parser.add_argument(
|
||||||
|
"--prometheus-port",
|
||||||
|
type=int,
|
||||||
|
default=8008,
|
||||||
|
dest="prometheus_port",
|
||||||
|
help="Port which prometheus listens on",
|
||||||
|
)
|
||||||
self._parser.add_argument(
|
self._parser.add_argument(
|
||||||
"--composer-api-bind-address",
|
"--composer-api-bind-address",
|
||||||
type=str,
|
type=str,
|
||||||
|
|
@ -73,6 +92,13 @@ class Cli(contextlib.AbstractContextManager):
|
||||||
dest="composer_api_bind_address",
|
dest="composer_api_bind_address",
|
||||||
help="Bind the composer API to the specified address",
|
help="Bind the composer API to the specified address",
|
||||||
)
|
)
|
||||||
|
self._parser.add_argument(
|
||||||
|
"--prometheus-bind-address",
|
||||||
|
type=str,
|
||||||
|
default="::",
|
||||||
|
dest="prometheus_bind_address",
|
||||||
|
help="Bind the prometheus listener to the specified address",
|
||||||
|
)
|
||||||
|
|
||||||
# --[no-]local-worker-api
|
# --[no-]local-worker-api
|
||||||
self._parser.add_argument(
|
self._parser.add_argument(
|
||||||
|
|
@ -133,6 +159,7 @@ class Cli(contextlib.AbstractContextManager):
|
||||||
self._parser.set_defaults(
|
self._parser.set_defaults(
|
||||||
builtin_worker=False,
|
builtin_worker=False,
|
||||||
composer_api=False,
|
composer_api=False,
|
||||||
|
prometheus=False,
|
||||||
local_worker_api=False,
|
local_worker_api=False,
|
||||||
remote_worker_api=False,
|
remote_worker_api=False,
|
||||||
weldr_api=False,
|
weldr_api=False,
|
||||||
|
|
@ -190,6 +217,21 @@ class Cli(contextlib.AbstractContextManager):
|
||||||
assert(sock.fileno() == index)
|
assert(sock.fileno() == index)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
|
# osbuild-composer-prometheus.socket
|
||||||
|
if self.args.prometheus:
|
||||||
|
print("Create prometheus socket on port {}".format(self.args.prometheus_port), file=sys.stderr)
|
||||||
|
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
||||||
|
self._exitstack.enter_context(contextlib.closing(sock))
|
||||||
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
|
||||||
|
sock.bind((self.args.prometheus_bind_address, self.args.prometheus_port))
|
||||||
|
sock.listen()
|
||||||
|
sockets.append(sock)
|
||||||
|
names.append("osbuild-composer-prometheus.socket")
|
||||||
|
|
||||||
|
assert(sock.fileno() == index)
|
||||||
|
index += 1
|
||||||
|
|
||||||
# osbuild-local-worker.socket
|
# osbuild-local-worker.socket
|
||||||
if self.args.local_worker_api:
|
if self.args.local_worker_api:
|
||||||
print("Create local-worker-api socket", file=sys.stderr)
|
print("Create local-worker-api socket", file=sys.stderr)
|
||||||
|
|
|
||||||
|
|
@ -31,5 +31,5 @@ COPY ./dnf-json /usr/libexec/osbuild-composer/
|
||||||
COPY ./pkg/jobqueue/dbjobqueue/schemas /opt/migrate/schemas
|
COPY ./pkg/jobqueue/dbjobqueue/schemas /opt/migrate/schemas
|
||||||
COPY --from=builder2 /opt/app-root/src/go/bin/tern /opt/migrate/
|
COPY --from=builder2 /opt/app-root/src/go/bin/tern /opt/migrate/
|
||||||
|
|
||||||
EXPOSE 8080 8700
|
EXPOSE 8008 8080 8700
|
||||||
ENTRYPOINT ["python3", "/opt/entrypoint.py", "--remote-worker-api", "--composer-api", "--shutdown-wait-period", "15"]
|
ENTRYPOINT ["python3", "/opt/entrypoint.py", "--remote-worker-api", "--composer-api", "--prometheus", "--shutdown-wait-period", "15"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue