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
36 if [[ "${YARDSTICK_VENV}" ]];then
37 echo "virtualenv = ${YARDSTICK_VENV}" >> "${uwsgi_config}"
42 nginx_config='/etc/nginx/conf.d/yardstick.conf'
44 if [[ ! -e "${nginx_config}" ]];then
46 cat << EOF > "${nginx_config}"
49 server_name localhost;
50 index index.htm index.html;
53 uwsgi_pass unix:///var/run/yardstick.sock;
59 # nginx service start when boot
60 supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
62 if [[ ! -e "${supervisor_config}" ]];then
63 cat << EOF > "${supervisor_config}"
67 [program:yardstick_nginx]
69 command = service nginx restart
72 [program:yardstick_uwsgi]
74 directory = /etc/yardstick
75 command = uwsgi -i yardstick.ini
80 # create api log directory
81 mkdir -p /var/log/yardstick
83 # create yardstick.sock for communicating
84 touch /var/run/yardstick.sock