summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2019-04-10 19:33:15 -0400
committerEd Tanous <ed.tanous@intel.com>2019-04-22 17:37:41 +0000
commit5a7094b22c9bc07ea7bfd591990fd8c9f2ac6419 (patch)
tree7b1c0387b3598ce9575b94a93d66c16b319782c6
parent4418c7f0ddcc5d3518831729a380a0b67e5d4093 (diff)
downloadbmcweb-5a7094b22c9bc07ea7bfd591990fd8c9f2ac6419.tar.gz
bmcweb-5a7094b22c9bc07ea7bfd591990fd8c9f2ac6419.zip
Add systemd unit files
Add bmcweb.socket, a systemd unit file that enables systemd socket activation of bmcweb. Systemd socket activation defers startup of socket listening applications until something connects to the socket. There are presently no configurable parameters in bmcweb.socket. Add bmcweb.service, a systemd unit file for starting bmcweb. bmcweb.service has one configurable parameter, the installation prefix. Prior these unit files were hosted in the meta-phosphor repository but OpenBMC is moving away from unit-files-in-metadata and trying to do it the way the rest of the world does it - unit files are provided by the projects that contain the application source. The unit files were copied mostly verbatim (minor update for installation prefix in bmcweb.service template) so the only new logic here is in the cmake logic. Tested by: 1 - devtool add bmcweb. 2 - apply this diff to bmcweb_git.bb: -inherit obmc-phosphor-systemd +inherit systemd 3 - bitbake bmcweb. 4 - manual inspection of the image dir in the yocto build tree. Change-Id: I61b49d519f5b4eb06e97a14d4f6707344e544434 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--CMakeLists.txt13
-rw-r--r--bmcweb.service.in13
-rw-r--r--bmcweb.socket9
3 files changed, 35 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28fbe0f..7cde52e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -273,3 +273,16 @@ target_compile_definitions (
$<$<BOOL:${BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES}>: -DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES>
)
+
+# configure and install systemd unit files
+configure_file (bmcweb.socket bmcweb.socket COPYONLY)
+configure_file (bmcweb.service.in bmcweb.service)
+pkg_get_variable (SYSTEMD_SYSTEMUNITDIR systemd systemdsystemunitdir)
+install (
+ FILES ${PROJECT_BINARY_DIR}/bmcweb.socket
+ DESTINATION ${SYSTEMD_SYSTEMUNITDIR}
+)
+install (
+ FILES ${PROJECT_BINARY_DIR}/bmcweb.service
+ DESTINATION ${SYSTEMD_SYSTEMUNITDIR}
+)
diff --git a/bmcweb.service.in b/bmcweb.service.in
new file mode 100644
index 0000000..644ecca
--- /dev/null
+++ b/bmcweb.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Start bmcweb server
+
+Wants=network.target
+After=network.target
+
+[Service]
+ExecStart=@CMAKE_INSTALL_PREFIX@/bin/bmcweb
+Type=simple
+WorkingDirectory=/home/root
+
+[Install]
+WantedBy=network.target
diff --git a/bmcweb.socket b/bmcweb.socket
new file mode 100644
index 0000000..8782e4d
--- /dev/null
+++ b/bmcweb.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=BMC Webserver socket
+
+[Socket]
+ListenStream=443
+ReusePort=true
+
+[Install]
+WantedBy=sockets.target
OpenPOWER on IntegriCloud