From ef24d9e597a12c3bdb23bd49357e4b38609a1e19 Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Thu, 3 Mar 2016 22:49:58 -0500 Subject: [PATCH] Set mongodb log file to shared volume by heka TrivialFix Change-Id: I085ef2884749bb4ecc546b78052a5688e8b36ad3 --- ansible/roles/mongodb/tasks/bootstrap.yml | 1 + ansible/roles/mongodb/tasks/start.yml | 1 + ansible/roles/mongodb/templates/mongodb.conf.j2 | 2 +- docker/mongodb/extend_start.sh | 8 ++++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ansible/roles/mongodb/tasks/bootstrap.yml b/ansible/roles/mongodb/tasks/bootstrap.yml index 3c7de0f393..8c4608d67e 100644 --- a/ansible/roles/mongodb/tasks/bootstrap.yml +++ b/ansible/roles/mongodb/tasks/bootstrap.yml @@ -12,4 +12,5 @@ restart_policy: "never" volumes: - "{{ node_config_directory }}/mongodb/:{{ container_config_directory }}/:ro" + - "kolla_logs:/var/log/kolla/" - "mongodb:/var/lib/mongodb/" diff --git a/ansible/roles/mongodb/tasks/start.yml b/ansible/roles/mongodb/tasks/start.yml index 3c5fd3ff31..c5593f92cf 100644 --- a/ansible/roles/mongodb/tasks/start.yml +++ b/ansible/roles/mongodb/tasks/start.yml @@ -8,4 +8,5 @@ privileged: True volumes: - "{{ node_config_directory }}/mongodb/:{{ container_config_directory }}/:ro" + - "kolla_logs:/var/log/kolla/" - "mongodb:/var/lib/mongodb" diff --git a/ansible/roles/mongodb/templates/mongodb.conf.j2 b/ansible/roles/mongodb/templates/mongodb.conf.j2 index 0fbc4f494c..d3863e935e 100644 --- a/ansible/roles/mongodb/templates/mongodb.conf.j2 +++ b/ansible/roles/mongodb/templates/mongodb.conf.j2 @@ -4,7 +4,7 @@ dbpath = /var/lib/mongodb # where to log -logpath = /var/log/mongodb/mongodb.log +logpath = /var/log/kolla/mongodb/mongodb.log logappend = true diff --git a/docker/mongodb/extend_start.sh b/docker/mongodb/extend_start.sh index f00369ff00..8d8933f903 100644 --- a/docker/mongodb/extend_start.sh +++ b/docker/mongodb/extend_start.sh @@ -2,6 +2,14 @@ echo "run extended start" +if [[ ! -d "/var/log/kolla/mongodb" ]]; then + mkdir -p /var/log/kolla/mongodb +fi + +if [[ $(stat -c %a /var/log/kolla/mongodb) != "755" ]]; then + chmod 755 /var/log/kolla/mongodb +fi + # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then