Skip to content

Commit

Permalink
[docker-config-engine]: introduce docker sonic config engine (#274)
Browse files Browse the repository at this point in the history
* [docker-config-engine]: introduce docker sonic config engine

sonic config engine provide the sonic configure engine for all sonic
dockers that rely on the engine to generate runtime configuration.
  • Loading branch information
lguohan authored Feb 8, 2017
1 parent a412fe1 commit b6753e7
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 92 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ dockers/docker-lldp-sv2/Dockerfile
dockers/docker-orchagent/Dockerfile
dockers/docker-snmp-sv2/Dockerfile
dockers/docker-team/Dockerfile
dockers/docker-platform-monitor/Dockerfile
dockers/docker-dhcp-relay/Dockerfile
dockers/docker-teamd/Dockerfile
dockers/docker-config-engine/Dockerfile
platform/broadcom/docker-syncd-brcm/Dockerfile
21 changes: 21 additions & 0 deletions dockers/docker-config-engine/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM docker-base

RUN apt-get update

# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml

COPY \
{% for deb in docker_config_engine_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN dpkg -i \
{% for deb in docker_config_engine_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
FROM docker-base
FROM docker-config-engine

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

## Update APT package lists
RUN apt-get update

## Dependencies for sonic-cfggen
RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml


COPY \
{% for deb in docker_dhcp_relay_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN dpkg -i \
{% for deb in docker_dhcp_relay_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}

## Install isc-dhcp-relay Debian package
RUN apt-get -y install isc-dhcp-relay

Expand Down
5 changes: 1 addition & 4 deletions dockers/docker-fpm/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
FROM docker-base
FROM docker-config-engine

RUN apt-get update

RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4

# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml

COPY \
{% for deb in docker_fpm_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
Expand Down
5 changes: 1 addition & 4 deletions dockers/docker-lldp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker-base
FROM docker-config-engine

COPY \
{% for deb in docker_lldp_sv2_debs.split(' ') -%}
Expand All @@ -10,9 +10,6 @@ COPY python-wheels /python-wheels

RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20

# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml

## Pre-install the fundamental packages
## Install Python SSWSDK
## Install LLDP Sync Daemon
Expand Down
5 changes: 1 addition & 4 deletions dockers/docker-orchagent/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker-base
FROM docker-config-engine

RUN apt-get update

Expand All @@ -8,9 +8,6 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso
## TODO: implicitly install dependencies
RUN apt-get -y install libjemalloc1

# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml

COPY \
{% for deb in docker_orchagent_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
Expand Down
18 changes: 18 additions & 0 deletions dockers/docker-platform-monitor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM docker-config-engine

RUN apt-get update

RUN apt-get install -y smartmontools sensord

## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

COPY ["config.sh", "/usr/bin/"]

ENTRYPOINT /usr/bin/config.sh \
&& service rsyslog start \
&& service lm-sensors start \
&& service smartmontools start \
&& service sensord start \
&& /bin/bash
33 changes: 0 additions & 33 deletions dockers/docker-platform-monitor/Dockerfile.j2

This file was deleted.

5 changes: 1 addition & 4 deletions dockers/docker-snmp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker-base
FROM docker-config-engine

COPY \
{% for deb in docker_snmp_sv2_debs.split(' ') -%}
Expand All @@ -17,9 +17,6 @@ ENV PYTHONOPTIMIZE 1
## Clean up
RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev

# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml

RUN dpkg -i \
{% for deb in docker_snmp_sv2_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
Expand Down
6 changes: 1 addition & 5 deletions dockers/docker-teamd/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
FROM docker-base
FROM docker-config-engine

RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4


# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml

COPY \
{% for deb in docker_teamd_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
Expand Down
4 changes: 2 additions & 2 deletions platform/broadcom/docker-orchagent-brcm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz
$(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent
$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS)
$(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM)

Expand Down
4 changes: 2 additions & 2 deletions platform/cavium/docker-orchagent-cavm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz
$(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent
$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS)
$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM)

Expand Down
4 changes: 2 additions & 2 deletions platform/mellanox/docker-orchagent-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz
$(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent
$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS)
$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX)

Expand Down
7 changes: 7 additions & 0 deletions rules/docker-config-engine.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# docker image for sonic config engine

DOCKER_CONFIG_ENGINE = docker-config-engine.gz
$(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine
$(DOCKER_CONFIG_ENGINE)_DEPENDS += $(SONIC_CONFIG_ENGINE)
$(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE)
5 changes: 2 additions & 3 deletions rules/docker-dhcp-relay.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

DOCKER_DHCP_RELAY = docker-dhcp-relay.gz
$(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay
$(DOCKER_DHCP_RELAY)_DEPENDS += $(SONIC_CONFIG_ENGINE)
$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE)
SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)


Expand Down
4 changes: 2 additions & 2 deletions rules/docker-fpm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

DOCKER_FPM = docker-fpm.gz
$(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm
$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS)
$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_FPM)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM)

Expand Down
4 changes: 2 additions & 2 deletions rules/docker-lldp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

DOCKER_LLDP_SV2 = docker-lldp-sv2.gz
$(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2
$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(SONIC_CONFIG_ENGINE)
$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD)
$(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2)
$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)

Expand Down
5 changes: 2 additions & 3 deletions rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz
$(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_CONFIG_ENGINE)
$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_BASE)
$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE)

SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)
SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)

$(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon
Expand Down
4 changes: 2 additions & 2 deletions rules/docker-snmp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

DOCKER_SNMP_SV2 = docker-snmp-sv2.gz
$(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2
$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(SONIC_CONFIG_ENGINE)
$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD)
$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3)
$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)

Expand Down
4 changes: 2 additions & 2 deletions rules/docker-teamd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

DOCKER_TEAMD = docker-teamd.gz
$(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd
$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_CONFIG_ENGINE)
$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS)
$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD)

Expand Down

0 comments on commit b6753e7

Please sign in to comment.