summaryrefslogtreecommitdiff
path: root/grid5000/steps/bootstrap/start_http_server.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'grid5000/steps/bootstrap/start_http_server.yaml')
-rw-r--r--grid5000/steps/bootstrap/start_http_server.yaml19
1 files changed, 19 insertions, 0 deletions
diff --git a/grid5000/steps/bootstrap/start_http_server.yaml b/grid5000/steps/bootstrap/start_http_server.yaml
new file mode 100644
index 0000000..59184c3
--- /dev/null
+++ b/grid5000/steps/bootstrap/start_http_server.yaml
@@ -0,0 +1,19 @@
+- http_script: $${kameleon_data_dir}/helpers/simple_http_server.py
+
+- run_http_server:
+ - exec_local: |
+ HTTP_PORT=$(__find_free_port 8000 8100)
+ echo "HTTP port: $HTTP_PORT"
+ export HTTP_PORT
+ - exec_local: python2 $${http_script} --root $${http_directory} --bind 0.0.0.0 --port $HTTP_PORT --daemon --pid $${http_pid}
+ - on_bootstrap_clean:
+ - exec_local: |
+ if [ -f $${http_pid} ]; then
+ HTTP_PID=$(cat $${http_pid})
+ if ps -p $HTTP_PID > /dev/null; then
+ echo "Killing HTTP server (pid: $HTTP_PID)..."
+ kill -9 "$HTTP_PID"
+ rm -f $${http_pid}
+ fi
+ rm -f $${http_pid}
+ fi