summaryrefslogtreecommitdiff
path: root/default/steps/bootstrap/start_http_server.yaml
blob: 59184c3bbc594f0f188c319bed3f885c82b620fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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