2 ##############################################################################
3 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
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 ##############################################################################
11 : ${YARDSTICK_REPO_DIR:='/home/opnfv/repos/yardstick'}
13 # generate uwsgi config file
14 mkdir -p /etc/yardstick
15 uwsgi_config='/etc/yardstick/yardstick.ini'
16 if [[ ! -e "${uwsgi_config}" ]];then
18 cat << EOF > "${uwsgi_config}"
22 chdir = ${YARDSTICK_REPO_DIR}/api
30 callable = app_wrapper
33 daemonize= /var/log/yardstick/uwsgi.log
34 socket = /var/run/yardstick.sock
39 nginx_config='/etc/nginx/conf.d/yardstick.conf'
41 if [[ ! -e "${nginx_config}" ]];then
43 cat << EOF > "${nginx_config}"
46 server_name localhost;
47 index index.htm index.html;
50 uwsgi_pass unix:///var/run/yardstick.sock;
56 # nginx service start when boot
57 supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
59 if [[ ! -e "${supervisor_config}" ]];then
60 cat << EOF > "${supervisor_config}"
64 [program:yardstick_nginx]
66 command = service nginx restart
69 [program:yardstick_uwsgi]
71 directory = /etc/yardstick
72 command = uwsgi -i yardstick.ini
77 # create api log directory
78 mkdir -p /var/log/yardstick
80 # create yardstick.sock for communicating
81 touch /var/run/yardstick.sock