[docker] Fix configuration

* fix lable of database section. it should be [database] instead of [db]
* create `/home/rally/data` dir by rally user instead of root, so rally
  could operate the database there.
* modify the volume path
* update the docs

Change-Id: Ia4df80e2ce570ede4582c875c0550d5ba8da60d9
This commit is contained in:
Andrey Kurilin 2017-12-10 10:48:59 +02:00
parent a150575fd6
commit 6ba63eadf7
2 changed files with 28 additions and 35 deletions

View File

@ -10,8 +10,8 @@ COPY . /home/rally/source
WORKDIR /home/rally/source
RUN pip install . --constraint upper-constraints.txt && \
mkdir /etc/rally && mkdir /home/rally/data && \
echo "[db]" > /etc/rally/rally.conf && \
mkdir /etc/rally && \
echo "[database]" > /etc/rally/rally.conf && \
echo "connection=sqlite:////home/rally/data/rally.db" >> /etc/rally/rally.conf
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
>> /etc/bash.bashrc; echo '\
@ -37,10 +37,10 @@ RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \
USER rally
ENV HOME /home/rally
RUN rally db recreate
RUN mkdir /home/rally/data && rally db recreate
# Docker volumes have specific behavior that allows this construction to work.
# Data generated during the image creation is copied to volume only when it's
# attached for the first time (volume initialization)
VOLUME ["/home/rally"]
VOLUME ["/home/rally/data"]
ENTRYPOINT ["rally"]

View File

@ -113,18 +113,30 @@ the Rally git repository and run:
docker build -t myrally .
If you build your own Docker image, substitute ``myrally`` for
``rallyforge/rally`` in the commands below.
``xrally/xrally-openstack`` in the commands below.
The Rally Docker image is configured to store local settings and the
database in the user's home directory. For persistence of these data,
The Rally Docker image is configured to store the database in the user's home
directory - ``/home/rally/data/rally.sqlite``. For persistence of these data,
you may want to keep this directory outside of the container. This may
be done via the following steps:
be done via 2 ways:
* use a docker image. In this case you do not need to initialize the database
.. code-block:: bash
docker volume create --name rally_volume
docker run -v rally_volume:/home/rally/data xrally/xrally-openstack deployment create --name "foo"
* mount the directory to container. In this case, there is ability to transmit
task files inside the container, but you will need to initialize the database
by yourself
.. code-block:: bash
sudo mkdir /var/lib/rally_container
sudo chown 65500 /var/lib/rally_container
docker run -it -v /var/lib/rally_container:/home/rally rallyforge/rally
docker run -v /var/lib/rally_container:/home/rally/data xrally/xrally-openstack db create
docker run -v /var/lib/rally_container:/home/rally/data xrally/xrally-openstack deployment create --name "foo"
.. note::
@ -135,26 +147,7 @@ be done via the following steps:
likely to work if your home directory has excessively open
permissions (e.g., ``0755``), which is not recommended.
You can find all task samples, docs and pre created tasks at /opt/rally/.
Also you may want to save the last command as an alias:
.. code-block:: bash
echo 'alias dock_rally="docker run -it -v /var/lib/rally_container:/home/rally rallyforge/rally"' >> ~/.bashrc
After executing ``dock_rally``, or ``docker run ...``, you will have
bash running inside the container with Rally installed. You may do
anything with Rally, but you need to create the database first:
.. code-block:: console
user@box:~/rally$ dock_rally
rally@1cc98e0b5941:~$ rally db recreate
rally@1cc98e0b5941:~$ rally deployment list
There are no deployments. To create a new deployment, use:
rally deployment create
rally@1cc98e0b5941:~$
You can find all task samples, docs and pre created tasks at /home/rally/source
In case you have SELinux enabled and Rally fails to create the
database, try executing the following commands to put SELinux into
Permissive Mode on the host machine