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:
parent
2ce968d052
commit
31f92092b5
@ -99,11 +99,11 @@ ONBUILD RUN \
|
|||||||
"$CONSTRAINTS_FILE"?h="$CONSTRAINTS_BRANCH" >> /VERSIONS && \
|
"$CONSTRAINTS_FILE"?h="$CONSTRAINTS_BRANCH" >> /VERSIONS && \
|
||||||
# Clean after instalation.
|
# Clean after instalation.
|
||||||
apk del .build-deps && \
|
apk del .build-deps && \
|
||||||
|
# Pip is leaving monasca-common repo in /src so remove it.
|
||||||
rm -rf \
|
rm -rf \
|
||||||
/app \
|
/app \
|
||||||
/root/.cache/ \
|
/root/.cache/ \
|
||||||
# Pip is leaving monasca-common repo in /src so remove it.
|
/src/monasca-common/java/ \
|
||||||
/src/ \
|
|
||||||
/tmp/* \
|
/tmp/* \
|
||||||
/var/cache/apk/* \
|
/var/cache/apk/* \
|
||||||
/var/log/* && \
|
/var/log/* && \
|
||||||
|
@ -5,11 +5,11 @@ Docker base image for Monasca services
|
|||||||
This image is used as a starting point for images of all 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``).
|
You need to have Docker installed (minimum tested version is ``17.09``).
|
||||||
Then you could build image inside of this folder:
|
Then you can build image inside of this folder by running:
|
||||||
|
|
||||||
``docker build --no-cache -t monasca-base:1.0.0 .``
|
``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
|
Building child image
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
In the ``example`` folder you could file sample of how to start building
|
In the ``example`` folder you can find samples of how to start building
|
||||||
new child image using ``monasca-base`` as start.
|
new child image using ``monasca-base``.
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
Every child image need to provide two files:
|
Every child image has to provide two files:
|
||||||
|
|
||||||
start.sh
|
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.
|
start. Including usage of wait scripts and templating of configuration files.
|
||||||
You also could provide ability to allow running container after service died
|
You also could provide the ability to allow running container after service
|
||||||
for easier debugging.
|
died for easier debugging.
|
||||||
|
|
||||||
health_check.py
|
health_check.py
|
||||||
This file will be used for checking status of application running in the
|
This file will be used for checking the status of the application running in
|
||||||
container. It will be useful for programs like Kubernetes or Docker Swarm
|
the container. It will be useful for container orchestration like Kubernetes
|
||||||
to properly handle services that are still running but stopped being
|
or Docker Swarm to properly handle services that are still running but
|
||||||
responsive. Avoid using `curl` directly and instead use `health_check.py`
|
stopped being responsive. Avoid using `curl` directly and instead, use
|
||||||
written with specific service in mind. It will provide more flexibility
|
`health_check.py` written with specific service in mind. It will provide more
|
||||||
like when creating JSON request body.
|
flexibility like when creating JSON request body.
|
||||||
|
|
||||||
|
|
||||||
Wait scripts
|
Wait scripts
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Some Python libraries are already preinstalled: `pykafka` and `PyMySQL`.
|
Some Python libraries are already pre-installed: `pykafka` and `PyMySQL`. They
|
||||||
They are used by wait scripts and in the process of creating child image
|
are used by wait scripts and in the process of creating the child image `pip3`
|
||||||
`pip3` will reinstall them to proper versions confronting to upper constraints
|
will reinstall them to use proper versions confronting the upper constraints
|
||||||
file.
|
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
|
`start.sh` to avoid unnecessary errors and restarts of containers when they
|
||||||
are started.
|
are started.
|
||||||
|
|
||||||
@ -58,18 +58,18 @@ are started.
|
|||||||
python3 /mysql_check.py || exit 1
|
python3 /mysql_check.py || exit 1
|
||||||
/wait_for.sh 192.168.10.6:5000 || 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.
|
environment variables are used and more usage examples.
|
||||||
|
|
||||||
|
|
||||||
Useful commands
|
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``
|
``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:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# TODO(Dobroslaw): move this script to monasca-common/docker folder
|
||||||
# and leave here small script to download it and execute using env variables
|
# and leave here small script to download it and execute using env variables
|
||||||
# to minimize code duplication.
|
# to minimize code duplication.
|
||||||
|
@ -1,4 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/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.
|
# Starting script.
|
||||||
# All checks you need to do before service could be safely started should
|
# All checks you need to do before service could be safely started should
|
||||||
# be added in this file.
|
# be added in this file.
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/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)
|
# This script will return 0 when on specific address (like 192.168.10.6:5000)
|
||||||
# scanning will reveal that port is responding.
|
# scanning will reveal that port is responding.
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user