summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2016-12-05 06:33:43 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-05 06:33:43 +0000
commit310eec58b65fdea6ded88f4271d93a8eaf7a599a (patch)
tree662d185caef47631f30e80df3bd76431277f28a1 /api
parent65e770afb564045d647abe2bdc2892ebe1130015 (diff)
parentffd0de5f9728e5c6d4a03eefc0d9782b530526ab (diff)
Merge "Making nginx and uwsgi service start when run docker by using supervisor"
Diffstat (limited to 'api')
-rwxr-xr-xapi/api-prepare.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/api/api-prepare.sh b/api/api-prepare.sh
index c05dbb5ff..fade8ccc6 100755
--- a/api/api-prepare.sh
+++ b/api/api-prepare.sh
@@ -24,14 +24,26 @@ server {
}
}
EOF
+echo "daemon off;" >> /etc/nginx/nginx.conf
fi
# nginx service start when boot
-cat << EOF >> /root/.bashrc
+supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
-nginx_status=\$(service nginx status | grep not)
-if [ -n "\${nginx_status}" ];then
- service nginx restart
- uwsgi -i /home/opnfv/repos/yardstick/api/yardstick.ini
-fi
+if [[ ! -e "${supervisor_config}" ]];then
+ cat << EOF > "${supervisor_config}"
+[supervisord]
+nodaemon = true
+
+[program:yardstick_nginx]
+user = root
+command = service nginx restart
+autorestart = true
+
+[program:yardstick_uwsgi]
+user = root
+directory = /home/opnfv/repos/yardstick/api
+command = uwsgi -i yardstick.ini
+autorestart = true
EOF
+fi