Verified Commit 23bb37b9 authored by Pavel Doležal's avatar Pavel Doležal
Browse files

Modify DNS Probe's systemd service to take a parameter representing instance's unique ID.

This ID will affect what configuration to load from system's YAML configuration file.
parent e0eaacc1
...@@ -112,11 +112,10 @@ if (AF_PACKET_BACKEND) ...@@ -112,11 +112,10 @@ if (AF_PACKET_BACKEND)
set(BACKEND af) set(BACKEND af)
configure_file(${CMAKE_SOURCE_DIR}/src/application/dp-runner.sh ${CMAKE_BINARY_DIR}/dp-af @ONLY) configure_file(${CMAKE_SOURCE_DIR}/src/application/dp-runner.sh ${CMAKE_BINARY_DIR}/dp-af @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/systemd/dns-probe.service.in ${CMAKE_BINARY_DIR}/systemd/dns-probe-af.service) configure_file(${CMAKE_SOURCE_DIR}/systemd/dns-probe@.service.in ${CMAKE_BINARY_DIR}/systemd/dns-probe-af@.service)
install(PROGRAMS ${CMAKE_BINARY_DIR}/dp-af DESTINATION ${CMAKE_INSTALL_BINDIR}) install(PROGRAMS ${CMAKE_BINARY_DIR}/dp-af DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_SOURCE_DIR}/data-model/cznic-dns-probe.yang DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-af)
install(FILES ${CMAKE_SOURCE_DIR}/data-model/dns-probe.yml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-af) install(FILES ${CMAKE_SOURCE_DIR}/data-model/dns-probe.yml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-af)
install(FILES ${CMAKE_BINARY_DIR}/systemd/dns-probe-af.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system) install(FILES ${CMAKE_BINARY_DIR}/systemd/dns-probe-af@.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system)
target_compile_definitions(dns-probe-af PUBLIC PROBE_CONFIG="${CMAKE_INSTALL_DIR}/${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-af/dns-probe.yml") target_compile_definitions(dns-probe-af PUBLIC PROBE_CONFIG="${CMAKE_INSTALL_DIR}/${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-af/dns-probe.yml")
endif () endif ()
...@@ -146,10 +145,9 @@ if (DPDK_BACKEND) ...@@ -146,10 +145,9 @@ if (DPDK_BACKEND)
set(BACKEND dpdk) set(BACKEND dpdk)
configure_file(${CMAKE_SOURCE_DIR}/src/application/dp-runner.sh ${CMAKE_BINARY_DIR}/dp-dpdk @ONLY) configure_file(${CMAKE_SOURCE_DIR}/src/application/dp-runner.sh ${CMAKE_BINARY_DIR}/dp-dpdk @ONLY)
install(PROGRAMS ${CMAKE_BINARY_DIR}/dp-dpdk DESTINATION ${CMAKE_INSTALL_BINDIR}) install(PROGRAMS ${CMAKE_BINARY_DIR}/dp-dpdk DESTINATION ${CMAKE_INSTALL_BINDIR})
configure_file(${CMAKE_SOURCE_DIR}/systemd/dns-probe.service.in ${CMAKE_BINARY_DIR}/systemd/dns-probe-dpdk.service) configure_file(${CMAKE_SOURCE_DIR}/systemd/dns-probe@.service.in ${CMAKE_BINARY_DIR}/systemd/dns-probe-dpdk@.service)
install(FILES ${CMAKE_SOURCE_DIR}/data-model/cznic-dns-probe.yang DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-dpdk) install(FILES ${CMAKE_SOURCE_DIR}/data-model/dns-probe.yml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-dpdk)
install(FILES ${CMAKE_SOURCE_DIR}/data-model/dns-probe-yml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-dpdk/dns-probe.yml) install(FILES ${CMAKE_BINARY_DIR}/systemd/dns-probe-dpdk@.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system)
install(FILES ${CMAKE_BINARY_DIR}/systemd/dns-probe-dpdk.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system)
target_compile_definitions(dns-probe-dpdk PUBLIC PROBE_CONFIG="${CMAKE_INSTALL_DIR}/${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-dpdk/dns-probe.yml") target_compile_definitions(dns-probe-dpdk PUBLIC PROBE_CONFIG="${CMAKE_INSTALL_DIR}/${CMAKE_INSTALL_SYSCONFDIR}/dns-probe-dpdk/dns-probe.yml")
endif () endif ()
......
# DNS probe daemon # DNS probe daemon
# Modify probe's parameters in ExecStart= to fit your use case # Service parameter represents unique ID of DNS Probe instance.
# The ID specifies what configuration to load from YAML configuration file
# in @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_SYSCONFDIR@/dns-probe-@BACKEND@/dns-probe.yml
[Unit] [Unit]
Description=Daemon for DNS probe Description=Daemon for DNS probe
After=network.target After=network.target
...@@ -7,7 +9,7 @@ After=network.target ...@@ -7,7 +9,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
Restart=always Restart=always
ExecStart=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/dns-probe-@BACKEND@ ExecStart=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/dns-probe-@BACKEND@ -n %i
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment