summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2016-12-03 15:04:36 +0000
committerchenjiankun <chenjiankun1@huawei.com>2016-12-03 15:04:36 +0000
commitffd0de5f9728e5c6d4a03eefc0d9782b530526ab (patch)
tree5b9cca46f092456b682f7db7ebe7cbf3bcea9eaf /api
parent78d6cbd462fc7db9dcdab4d2478f6c27437d4c88 (diff)
Making nginx and uwsgi service start when run docker by using supervisor
JIRA: YARDSTICK-444 We need web service start when docker run. But now we add command in bashrc, so the web service start only if we login in docker container. So I use supervisor to make the web service start when docker run. Change-Id: Ic77eb0e130ae7dbd82039c312649fed76b128513 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
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