diff options
-rwxr-xr-x | api/api-prepare.sh | 24 | ||||
-rw-r--r-- | docker/Dockerfile | 2 | ||||
-rwxr-xr-x | install.sh | 1 |
3 files changed, 21 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 diff --git a/docker/Dockerfile b/docker/Dockerfile index 048804dc5..3dd94019a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,6 +48,7 @@ RUN apt-get update && apt-get install -y \ nginx \ uwsgi \ uwsgi-plugin-python \ + supervisor \ python-setuptools && \ easy_install -U setuptools @@ -73,3 +74,4 @@ ADD http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img /home/op ADD http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img /home/opnfv/images/ COPY ./exec_tests.sh /usr/local/bin/ +CMD ["/usr/bin/supervisord"] diff --git a/install.sh b/install.sh index afb735195..e9b6035d9 100755 --- a/install.sh +++ b/install.sh @@ -16,6 +16,7 @@ apt-get update && apt-get install -y \ nginx \ uwsgi \ uwsgi-plugin-python \ + supervisor \ python-setuptools && \ easy_install -U setuptools |