From 5da62f7368c147474ea4095ee9967839924c40d1 Mon Sep 17 00:00:00 2001 From: Uggla Date: Tue, 26 May 2015 22:25:34 +0200 Subject: [PATCH] - Add container and image naming (redfish-simulator) - Add a build script - Modify redfish-setup.sh to exit apache in a proper way - Modify run script --- dmtf/buildImage.sh | 5 +++++ dmtf/redfish-setup.sh | 19 +++++++++++++++++-- ...edfish-ctn.sh => run-redfish-simulator.sh} | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 dmtf/buildImage.sh rename dmtf/{run-redfish-ctn.sh => run-redfish-simulator.sh} (56%) diff --git a/dmtf/buildImage.sh b/dmtf/buildImage.sh new file mode 100755 index 0000000..896e79a --- /dev/null +++ b/dmtf/buildImage.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Build and tag images +docker build -t "redfish-simulator" . +docker tag redfish-simulator:latest localhost:5000/redfish-simulator diff --git a/dmtf/redfish-setup.sh b/dmtf/redfish-setup.sh index ef708f7..cd23c68 100644 --- a/dmtf/redfish-setup.sh +++ b/dmtf/redfish-setup.sh @@ -1,4 +1,20 @@ #!/bin/bash + +function start_apache { + echo "Launching apache2 in foreground with /usr/sbin/apache2ctl -DFOREGROUND -k start" + /usr/sbin/apache2ctl -DFOREGROUND -k start +} + +function stop_apache { + echo "Stopping apache2" + /usr/sbin/apache2ctl stop +} + +# Trap to have a clean exit +trap stop_apache HUP INT QUIT KILL TERM + + +# Main cd /var/www/html unzip -q -o /tmp/DSP2043_0.96.0a.zip mkdir -p redfish @@ -7,5 +23,4 @@ ln -sf .. v1 cd .. ip a #sed -i -e 's/Listen 80/Listen 8000/' /etc/apache2/ports.conf -echo "Launching apache2 in foreground with /usr/sbin/apache2ctl -DFOREGROUND -k start" -/usr/sbin/apache2ctl -DFOREGROUND -k start +start_apache diff --git a/dmtf/run-redfish-ctn.sh b/dmtf/run-redfish-simulator.sh similarity index 56% rename from dmtf/run-redfish-ctn.sh rename to dmtf/run-redfish-simulator.sh index d5afeaf..0e0764f 100755 --- a/dmtf/run-redfish-ctn.sh +++ b/dmtf/run-redfish-simulator.sh @@ -1,4 +1,4 @@ #!/bin/bash # Th -p option needs to be after the run command. No warning is given if before but doesn't work -docker run -p 8000:80 localhost:5000/pb:docker-redfish +docker run -d -p 8000:80 --name "redfish-simulator" localhost:5000/redfish-simulator