Merge "argsAlreadyParsedError: arguments already parsed: cannot register CLI option"
[yardstick.git] / api / api-prepare.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 # nginx config
12 nginx_config='/etc/nginx/conf.d/yardstick.conf'
13
14 if [[ ! -e "${nginx_config}" ]];then
15
16     cat << EOF > "${nginx_config}"
17 server {
18     listen 5000;
19     server_name localhost;
20     index  index.htm index.html;
21     location / {
22         include uwsgi_params;
23         uwsgi_pass unix:///home/opnfv/repos/yardstick/api/yardstick.sock;
24     }
25 }
26 EOF
27 echo "daemon off;" >> /etc/nginx/nginx.conf
28 fi
29
30 # nginx service start when boot
31 supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
32
33 if [[ ! -e "${supervisor_config}" ]];then
34     cat << EOF > "${supervisor_config}"
35 [supervisord]
36 nodaemon = true
37
38 [program:yardstick_nginx]
39 user = root
40 command = service nginx restart
41 autorestart = true
42
43 [program:yardstick_uwsgi]
44 user = root
45 directory = /home/opnfv/repos/yardstick/api
46 command = uwsgi -i yardstick.ini
47 autorestart = true
48 EOF
49 fi