From 62781f455007310cbae34aeb7bcbbad0cf58e5df Mon Sep 17 00:00:00 2001 From: zhubingbing <1392607554@qq.com> Date: Wed, 31 Aug 2016 08:00:35 +0000 Subject: [PATCH] repair rally dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add create rally dabase and create rally log script Closes-Bug: #1618722  Change-Id: I8a78e518f63c4e9fab753a58fb7e36772380d4ef --- docker/rally/Dockerfile.j2 | 8 ++++++-- docker/rally/extend_start.sh | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 docker/rally/extend_start.sh diff --git a/docker/rally/Dockerfile.j2 b/docker/rally/Dockerfile.j2 index 77950d8556..503fcad7f3 100644 --- a/docker/rally/Dockerfile.j2 +++ b/docker/rally/Dockerfile.j2 @@ -17,12 +17,16 @@ RUN useradd --user-group rally ADD rally-archive /rally-source RUN ln -s rally-source/* rally \ + && useradd --user-group rally \ && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /rally \ - && mkdir -p /etc/rally /var/log/rally \ - && useradd --user-group rally + && mkdir -p /etc/rally /var/log/rally /home/rally \ + && chown -R rally: /etc/rally /var/log/rally /home/rally {% endif %} +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start + RUN usermod -a -G kolla rally {% block rally_footer %}{% endblock %} diff --git a/docker/rally/extend_start.sh b/docker/rally/extend_start.sh new file mode 100644 index 0000000000..a3af2c96ef --- /dev/null +++ b/docker/rally/extend_start.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# 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 + rally-manage db recreate + exit 0 +fi + +if [[ ! -d "/var/log/kolla/rally" ]]; then + mkdir -p /var/log/kolla/rally +fi +if [[ $(stat -c %a /var/log/kolla/rally) != "755" ]]; then + chmod 755 /var/log/kolla/rally +fi