Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One Python to rule them all #143

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,52 @@ services:
image: memcached:${MEMCACHED_VERSION}

influxdb:
image: influxdb:${INFLUXDB_VERSION}
influxdb-init:
image: monasca/influxdb-init:${INFLUXDB_INIT_VERSION}
depends_on:
- influxdb
image: influxdb:latest

# cadvisor will allow host metrics to be collected, but requires significant
# access to the host system
# if this is not desired, the following can be commented out, and the CADVISOR
# environment variable should be set to "false" in the `agent-collector`
# block - however no metrics will be collected
cadvisor:
image: google/cadvisor:${CADVISOR_VERSION}
image: google/cadvisor:v0.26.1
volumes:
- "/:/rootfs:ro"
- "/var/run:/var/run:rw"
- "/sys:/sys:ro"
- "/var/lib/docker:/var/lib/docker:ro"

agent-forwarder:
image: monasca/agent-forwarder:${MON_AGENT_FORWARDER_VERSION}
image: monasca/agent-forwarder:master
environment:
NON_LOCAL_TRAFFIC: "true"

agent-collector:
image: monasca/agent-collector:${MON_AGENT_COLLECTOR_VERSION}
restart: on-failure
image: monasca/agent-collector:master
environment:
AGENT_HOSTNAME: "docker-host"
FORWARDER_URL: "http://agent-forwarder:17123"
CADVISOR: "true"
CADVISOR_URL: "http://cadvisor:8080/"

influxdb-init:
image: monasca/influxdb-init:1.0.0
depends_on:
- influxdb

alarms:
image: monasca/alarms:${MON_ALARMS_VERSION}

zookeeper:
image: zookeeper:${ZOOKEEPER_VERSION}
image: zookeeper:3.4

kafka:
image: monasca/kafka:${MON_KAFKA_VERSION}
image: monasca/kafka:0.9.0.1-2.11-1.1.0
depends_on:
- zookeeper
kafka-init:
image: monasca/kafka-init:${MON_KAFKA_INIT_VERSION}
image: monasca/kafka-init:0.0.1
environment:
ZOOKEEPER_CONNECTION_STRING: "zookeeper:2181"
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_TOPIC_CONFIG: segment.ms=900000 # 15m
KAFKA_CREATE_TOPICS: "\
metrics:64:1,\
Expand All @@ -61,20 +60,20 @@ services:
events:12:1,\
60-seconds-notifications:3:1"
depends_on:
- zookeeper
- kafka

mysql:
image: mysql:${MYSQL_VERSION}
image: mysql:5.5
environment:
MYSQL_ROOT_PASSWORD: secretmysql
mysql-init:
image: monasca/mysql-init:${MYSQL_INIT_VERSION}
image: monasca/mysql-init:1.5.1
environment:
MYSQL_INIT_DISABLE_REMOTE_ROOT: "false"
MYSQL_INIT_RANDOM_PASSWORD: "false"

keystone:
image: monasca/keystone:${MON_KEYSTONE_VERSION}
image: monasca/keystone:1.1.1
environment:
KEYSTONE_HOST: keystone
KEYSTONE_PASSWORD: secretadmin
Expand All @@ -90,10 +89,10 @@ services:
- "35357:35357"

monasca-sidecar:
image: timothyb89/monasca-sidecar:${MON_SIDECAR_VERSION}
image: timothyb89/monasca-sidecar:1.0.0

monasca:
image: monasca/api:${MON_API_VERSION}
image: monasca/api:master
environment:
SIDECAR_URL: http://monasca-sidecar:4888/v1/ingest
depends_on:
Expand All @@ -108,15 +107,15 @@ services:
- "8070:8070"

monasca-persister:
image: monasca/persister:${MON_PERSISTER_VERSION}
image: monasca/persister:master
depends_on:
- monasca
- influxdb
- zookeeper
- kafka

thresh:
image: monasca/thresh:${MON_THRESH_VERSION}
image: monasca/thresh:latest
environment:
NO_STORM_CLUSTER: "true"
WORKER_MAX_HEAP_MB: "256"
Expand All @@ -125,7 +124,7 @@ services:
- kafka

monasca-notification:
image: monasca/notification:${MON_NOTIFICATION_VERSION}
image: monasca/notification:master
environment:
NF_PLUGINS: "webhook"
depends_on:
Expand All @@ -135,7 +134,7 @@ services:
- mysql

grafana:
image: monasca/grafana:${MON_GRAFANA_VERSION}
image: monasca/grafana:4.0.0-1.1.1
environment:
GF_AUTH_BASIC_ENABLED: "false"
GF_USERS_ALLOW_SIGN_UP: "true"
Expand All @@ -151,6 +150,6 @@ services:
- monasca

grafana-init:
image: monasca/grafana-init:${MON_GRAFANA_INIT_VERSION}
image: monasca/grafana-init:1.1.0
depends_on:
- grafana
32 changes: 11 additions & 21 deletions monasca-agent-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM alpine:3.5
ARG TIMESTAMP_SLUG
# note(kornicameiter) running monasca-agent with Python3 is not possible
# at the moment, enforce Python2 variant of monasca/python
FROM monasca/python:2-${TIMESTAMP_SLUG}

ARG AGENT_REPO=https://git.openstack.org/openstack/monasca-agent
ARG AGENT_BRANCH="master"
ARG UPPER_CONSTRAINTS=https://raw.githubusercontent.com/openstack/requirements/master/upper-constraints.txt
ARG AGENT_USER="mon-agent"
ARG AGENT_BRANCH=master
ARG CONSTRAINTS_BRANCH=master
ARG AGENT_USER=mon-agent

# To force a rebuild, pass --build-arg REBUILD="$(DATE)" when running
# `docker build`
Expand All @@ -20,23 +23,10 @@ ENV CONFIG_TEMPLATE=true \
LOG_LEVEL=WARN \
HOSTNAME_FROM_KUBERNETES=false

RUN apk add --no-cache \
python py2-pip py2-jinja2 libxml2 py2-psutil && \
apk add --no-cache --virtual build-dep \
git python-dev make g++ linux-headers libxml2-dev libxslt-dev && \
mkdir /monasca-agent && cd /monasca-agent && \
git init && \
git remote add origin $AGENT_REPO && \
git fetch origin $AGENT_BRANCH && \
git reset --hard FETCH_HEAD && \
pip install docker-py prometheus_client && \
cd /monasca-agent && \
pip install -r requirements.txt -c "$UPPER_CONSTRAINTS" && \
python setup.py install && \
cd / && \
rm -rf /monasca-agent && \
rm -rf /root/.cache/pip && \
apk del build-dep
COPY apk_install.sh /apk.sh
RUN /build.sh -r ${AGENT_REPO} -b ${AGENT_BRANCH} -q ${CONSTRAINTS_BRANCH} \
-d "Jinja2 prometheus_client docker-py" && \
rm -rf /build.sh

COPY agent.yaml.j2 /etc/monasca/agent/agent.yaml.j2
COPY template.py kubernetes_get_host.py /
Expand Down
4 changes: 4 additions & 0 deletions monasca-agent-base/apk_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install_apk_deps() {
apk add --no-cache libxml2 py2-psutil
apk add --no-cache --virtual build-dep git make g++ linux-headers libxml2-dev libxslt-dev
}
2 changes: 2 additions & 0 deletions monasca-agent-base/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ variants:
- tag: master
aliases:
- :master-{date}-{time}
args:
TIMESTAMP_SLUG: 20170809-155207
3 changes: 2 additions & 1 deletion monasca-agent-collector/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM monasca/agent-base:master-20170901-210328
ARG MON_AGENT_BASE_VERSION
FROM monasca/agent-base:${MON_AGENT_BASE_VERSION}

ARG AGENT_USER="mon-agent"

Expand Down
2 changes: 2 additions & 0 deletions monasca-agent-collector/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ variants:
- tag: master
aliases:
- :master-{date}-{time}
args:
MON_AGENT_BASE_VERSION: master-20170901-210328
3 changes: 2 additions & 1 deletion monasca-agent-forwarder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM monasca/agent-base:master-20170901-210328
ARG MON_AGENT_BASE_VERSION
FROM monasca/agent-base:${MON_AGENT_BASE_VERSION}

ARG AGENT_USER="mon-agent"

Expand Down
2 changes: 2 additions & 0 deletions monasca-agent-forwarder/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ variants:
- tag: master
aliases:
- :master-{date}-{time}
args:
MON_AGENT_BASE_VERSION: master-20170901-210328
12 changes: 4 additions & 8 deletions monasca-alarms/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM alpine:3.5
ARG MON_CLIENT_VERSION="1.6.0"

FROM monasca/client:${MON_CLIENT_VERSION}

# To force a rebuild, pass --build-arg REBUILD="$(DATE)" when running
# `docker build`
Expand All @@ -12,13 +14,7 @@ ENV MONASCA_WAIT_FOR_API=true \
OS_USERNAME=mini-mon \
OS_USER_DOMAIN_NAME=Default

RUN apk add --no-cache \
python py2-pip py2-netaddr py2-yaml py2-jinja2 && \
apk add --no-cache --virtual build-dep \
git python-dev make g++ linux-headers && \
pip install python-monascaclient && \
rm -rf /root/.cache/pip && \
apk del build-dep
RUN apk add --no-cache py2-netaddr py2-yaml py2-jinja2

COPY definitions.yml.j2 /config/definitions.yml.j2
COPY monasca_alarm_definition.py template.py start.sh /
Expand Down
3 changes: 2 additions & 1 deletion monasca-alarms/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repository: monasca/alarms
variants:
- tag: 1.1.1
- tag: 1.1.2
aliases:
- :latest
- tag: 1.1.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old tag should be removed

2 changes: 1 addition & 1 deletion monasca-alarms/monasca_alarm_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def main(args=None):
}

if not monascaclient_found:
print("python-monascaclient >= 1.0.9 is required", file=sys.stderr)
print("python-monascaclient>=1.6.0<1.7.0 is required", file=sys.stderr)
sys.exit(1)

if not args.definitions_file:
Expand Down
24 changes: 9 additions & 15 deletions monasca-api-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
FROM alpine:3.5
ARG TIMESTAMP_SLUG
# monasca-api cannot run under Python3
# enforcing Python2
FROM monasca/python:2-${TIMESTAMP_SLUG}

ARG API_REPO=https://github.com/openstack/monasca-api.git
ARG API_BRANCH=master
ARG CONSTRAINTS_BRANCH=master

# To force a rebuild, pass --build-arg REBUILD="$(DATE)" when running
# `docker build`
Expand Down Expand Up @@ -34,20 +38,10 @@ ENV CONFIG_TEMPLATE=true \
ACCESS_LOG_FORMAT="%(asctime)s [%(process)d] gunicorn.access [%(levelname)s] %(message)s" \
ACCESS_LOG_FIELDS='%(h)s %(l)s %(u)s %(t)s %(r)s %(s)s %(b)s "%(f)s" "%(a)s" %(L)s'

RUN apk add --no-cache python py2-pip py2-jinja2 curl mysql-client && \
apk add --no-cache --virtual build-dep \
python-dev git make g++ linux-headers && \
mkdir /monasca-api && cd /monasca-api && \
git init && \
git remote add origin $API_REPO && \
git fetch origin $API_BRANCH && \
git reset --hard FETCH_HEAD && \
pip install --no-cache-dir gunicorn influxdb \
python-memcached -r requirements.txt && \
python setup.py install && \
cd / && \
rm -rf /monasca-api && \
apk del build-dep
COPY apk_install.sh /apk.sh
RUN /build.sh -r ${API_REPO} -b ${API_BRANCH} \
-q ${CONSTRAINTS_BRANCH} -d "gunicorn influxdb python-memcached Jinja2" && \
rm -rf /build.sh

COPY api-* /etc/monasca/
COPY template.py start.sh health-check.sh kafka_wait_for_topics.py /
Expand Down
4 changes: 4 additions & 0 deletions monasca-api-python/apk_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install_apk_deps() {
apk add --no-cache curl mysql-client
apk add --no-cache --virtual build-dep git make g++ linux-headers
}
2 changes: 2 additions & 0 deletions monasca-api-python/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ variants:
- :master-{date}-{time}
args:
API_BRANCH: refs/changes/63/417163/10
CONSTRAINTS_BRANCH: master
TIMESTAMP_SLUG: 20170809-155207
27 changes: 8 additions & 19 deletions monasca-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
FROM alpine:3.5
ARG PYTHON_VERSION
ARG TIMESTAMP_SLUG
FROM monasca/python:${PYTHON_VERSION}-${TIMESTAMP_SLUG}

ARG CLIENT_REPO=https://git.openstack.org/openstack/python-monascaclient
ARG CLIENT_BRANCH="master"
ARG UPPER_CONSTRAINTS=https://raw.githubusercontent.com/openstack/requirements/master/upper-constraints.txt
ARG CLIENT_BRANCH=master
ARG CONSTRAINTS_BRANCH=master

# To force a rebuild, pass --build-arg REBUILD="$(DATE)" when running
# `docker build`
ARG REBUILD=1

RUN set -x && \
apk add --no-cache python py2-pip git && \
apk add --no-cache --virtual build-dep \
git python-dev make g++ linux-headers libxml2-dev libxslt-dev && \
mkdir /python-monascaclient && cd /python-monascaclient && \
git init && \
git remote add origin $CLIENT_REPO && \
git fetch origin $CLIENT_BRANCH && \
git reset --hard FETCH_HEAD && \
pip install -r requirements.txt -c "$UPPER_CONSTRAINTS" && \
python setup.py install && \
cd / && \
rm -rf /python-monascaclient && \
rm -rf /root/.cache/pip && \
apk del build-dep

RUN apk add --no-cache --virtual build-dep libxml2-dev libxslt-dev && \
/build.sh -r ${CLIENT_REPO} -b ${CLIENT_BRANCH} -q ${CONSTRAINTS_BRANCH} && \
monasca --version

CMD ["sh"]
22 changes: 20 additions & 2 deletions monasca-client/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
repository: monasca/client
variants:
- tag: latest
- tag: 1.7.0
aliases:
- :1.6.0
- :latest
- :1.7
- :1
args:
CLIENT_BRANCH: 1.7.0
PYTHON_VERSION: '2'
TIMESTAMP_SLUG: 20170809-155207
CONSTRAINTS_BRANCH: master

- tag: 1.6.0
aliases:
- :1.6
args:
CLIENT_BRANCH: 1.6.0
PYTHON_VERSION: '2'
TIMESTAMP_SLUG: 20170809-155207
CONSTRAINTS_BRANCH: master

- tag: master
aliases:
- :master-{date}-{time}
args:
CLIENT_BRANCH: master
PYTHON_VERSION: '2'
TIMESTAMP_SLUG: 20170809-155207
CONSTRAINTS_BRANCH: master
Loading