Minor language changes and added license headers

Additionally:
* Move comment outside of `rm` command.

Story: 2001694
Task: 22889

Change-Id: I9dd334c05bf9e209427db1b987f475e031d11d80
This commit is contained in:
Witold Bedyk 2018-07-06 15:17:31 +02:00
parent 2ce968d052
commit 31f92092b5
5 changed files with 62 additions and 25 deletions

View File

@ -99,11 +99,11 @@ ONBUILD RUN \
"$CONSTRAINTS_FILE"?h="$CONSTRAINTS_BRANCH" >> /VERSIONS && \
# Clean after instalation.
apk del .build-deps && \
# Pip is leaving monasca-common repo in /src so remove it.
rm -rf \
/app \
/root/.cache/ \
# Pip is leaving monasca-common repo in /src so remove it.
/src/ \
/src/monasca-common/java/ \
/tmp/* \
/var/cache/apk/* \
/var/log/* && \

View File

@ -5,11 +5,11 @@ Docker base image for Monasca services
This image is used as a starting point for images of all Monasca services.
Building monasca-base
=====================
Building monasca-base image
===========================
You need to have Docker installed (minimum supported version is ``17.09``).
Then you could build image inside of this folder:
You need to have Docker installed (minimum tested version is ``17.09``).
Then you can build image inside of this folder by running:
``docker build --no-cache -t monasca-base:1.0.0 .``
@ -17,38 +17,38 @@ Then you could build image inside of this folder:
Building child image
--------------------
In the ``example`` folder you could file sample of how to start building
new child image using ``monasca-base`` as start.
In the ``example`` folder you can find samples of how to start building
new child image using ``monasca-base``.
Requirements
~~~~~~~~~~~~
Every child image need to provide two files:
Every child image has to provide two files:
start.sh
In this starting script provide all steps that direct to proper service
In this starting script provide all steps that lead to the proper service
start. Including usage of wait scripts and templating of configuration files.
You also could provide ability to allow running container after service died
for easier debugging.
You also could provide the ability to allow running container after service
died for easier debugging.
health_check.py
This file will be used for checking status of application running in the
container. It will be useful for programs like Kubernetes or Docker Swarm
to properly handle services that are still running but stopped being
responsive. Avoid using `curl` directly and instead use `health_check.py`
written with specific service in mind. It will provide more flexibility
like when creating JSON request body.
This file will be used for checking the status of the application running in
the container. It will be useful for container orchestration like Kubernetes
or Docker Swarm to properly handle services that are still running but
stopped being responsive. Avoid using `curl` directly and instead, use
`health_check.py` written with specific service in mind. It will provide more
flexibility like when creating JSON request body.
Wait scripts
------------
Some Python libraries are already preinstalled: `pykafka` and `PyMySQL`.
They are used by wait scripts and in the process of creating child image
`pip3` will reinstall them to proper versions confronting to upper constraints
Some Python libraries are already pre-installed: `pykafka` and `PyMySQL`. They
are used by wait scripts and in the process of creating the child image `pip3`
will reinstall them to use proper versions confronting the upper constraints
file.
This wait scripts will be available in every child image and could be used in
These wait scripts will be available in every child image and can be used in
`start.sh` to avoid unnecessary errors and restarts of containers when they
are started.
@ -58,18 +58,18 @@ are started.
python3 /mysql_check.py || exit 1
/wait_for.sh 192.168.10.6:5000 || exit 1
Please, check content of every of this files for documentation of what
Please, check the content of each of these files for documentation of what
environment variables are used and more usage examples.
Useful commands
---------------
List all labels on image (you need to have ``jq`` installed):
List all labels of the image (you need to have ``jq`` installed):
``docker inspect monasca-api:master | jq .[].Config.Labels``
Get all steps from what Docker image was build:
Get all steps of the Docker image build process history:
::

View File

@ -1,5 +1,17 @@
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# TODO(Dobroslaw): move this script to monasca-common/docker folder
# and leave here small script to download it and execute using env variables
# to minimize code duplication.

View File

@ -1,4 +1,17 @@
#!/bin/sh
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Starting script.
# All checks you need to do before service could be safely started should
# be added in this file.

View File

@ -1,5 +1,17 @@
#!/bin/sh
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This script will return 0 when on specific address (like 192.168.10.6:5000)
# scanning will reveal that port is responding.
#