Add dev image
This commit is contained in:
parent
762c6359ae
commit
58c7c1a107
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
|
.idea
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
|||||||
26
LICENSE
Normal file
26
LICENSE
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Copyright 2021 Cisco Systems, Inc.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
45
README.md
Normal file
45
README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# OpenBMP docker files
|
||||||
|
Docker files for OpenBMP.
|
||||||
|
|
||||||
|
(Prerequisite) Platform Docker Install
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
> Ignore this step if you already have a current docker install
|
||||||
|
|
||||||
|
> ####NOTE
|
||||||
|
> You should use the latest docker version, documented in this section.
|
||||||
|
|
||||||
|
Follow the instructions on https://docs.docker.com/get-docker/
|
||||||
|
|
||||||
|
### Optionally add a non-root user to run docker as
|
||||||
|
usermod -aG docker ubuntu
|
||||||
|
|
||||||
|
# Logout and log back so the group takes affect.
|
||||||
|
|
||||||
|
|
||||||
|
### Optionally configure **/etc/default/docker** (e.g. for proxy config)
|
||||||
|
|
||||||
|
export http_proxy="http://proxy:80/"
|
||||||
|
export https_proxy="http://proxy:80/"
|
||||||
|
export no_proxy="127.0.0.1,openbmp.org,/var/run/docker.sock"
|
||||||
|
|
||||||
|
Make sure you can run '**docker run hello-world**' successfully.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Install OpenBMP using Docker
|
||||||
|
----------------------------
|
||||||
|
Each docker file contains a readme file, see below:
|
||||||
|
|
||||||
|
* [Collector](collector/README.md)
|
||||||
|
* [PostgreSQL](postgres/README.md)
|
||||||
|
|
||||||
|
|
||||||
|
Install OpenBMP using docker-compose
|
||||||
|
----------------------------
|
||||||
|
[Docker Compose](https://docs.docker.com/compose/install/) is used to run several containers. It also handles restarting containers on reboot/restart.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose up
|
||||||
|
```
|
||||||
|
|
||||||
73
dev-build/Dockerfile
Normal file
73
dev-build/Dockerfile
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# Collector: openbmp/collector
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2021 Cisco Systems, Inc. and others. All rights reserved.
|
||||||
|
# Copyright (c) 2013-2021 Tim Evens (tim@evensweb.com). All rights reserved.
|
||||||
|
#
|
||||||
|
# Author: Tim Evens <tim@openbmp.org>
|
||||||
|
#
|
||||||
|
# BUILD: docker build -t openbmp/collector .
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
# stage: Build collector
|
||||||
|
# -----------------------------------------------
|
||||||
|
FROM ubuntu:focal AS build
|
||||||
|
|
||||||
|
WORKDIR /ws
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install git gcc g++ libboost-dev cmake zlib1g-dev libssl1.1 libsasl2-2 libssl-dev libsasl2-dev
|
||||||
|
|
||||||
|
RUN cd /tmp && git clone https://github.com/edenhill/librdkafka.git \
|
||||||
|
&& cd librdkafka \
|
||||||
|
&& ./configure \
|
||||||
|
&& make \
|
||||||
|
&& make install
|
||||||
|
&& cd /tmp
|
||||||
|
|
||||||
|
RUN git clone https://github.com/jbeder/yaml-cpp.git \
|
||||||
|
&& cd yaml-cpp \
|
||||||
|
&& mkdir build && cd build \
|
||||||
|
&& make \
|
||||||
|
&& make install
|
||||||
|
&& cd /tmp
|
||||||
|
|
||||||
|
RUN cd /ws && mkdir build && cd build \
|
||||||
|
&& cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ \
|
||||||
|
&& make \
|
||||||
|
&& make install
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
# stage: Final container
|
||||||
|
# -----------------------------------------------
|
||||||
|
# Pull base image.
|
||||||
|
FROM ubuntu:focal
|
||||||
|
|
||||||
|
# Proxy/if behind firewall
|
||||||
|
# Update your /etc/sysconfig/docker or /etc/default/docker file by adding proxy envs there using export <var>=<val>
|
||||||
|
|
||||||
|
# Add files.
|
||||||
|
ADD scripts/install /tmp/
|
||||||
|
ADD scripts/run /usr/sbin/
|
||||||
|
|
||||||
|
ARG BUILD_NUMBER=0
|
||||||
|
|
||||||
|
# Proxy servers
|
||||||
|
#ENV http_proxy http://proxy:80
|
||||||
|
#ENV https_proxy http://proxy:80
|
||||||
|
#ENV no_proxy "domain.com"
|
||||||
|
|
||||||
|
# Run Install script
|
||||||
|
RUN /tmp/install
|
||||||
|
|
||||||
|
# Define mount points.
|
||||||
|
VOLUME ["/config"]
|
||||||
|
|
||||||
|
# Define working directory.
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
# Define default command.
|
||||||
|
CMD ["/usr/sbin/run"]
|
||||||
|
|
||||||
|
# Expose ports.
|
||||||
|
# openbmpd/collector
|
||||||
|
EXPOSE 5000
|
||||||
86
dev-build/README.md
Normal file
86
dev-build/README.md
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
OpenBMP Collector Container
|
||||||
|
----------------------------
|
||||||
|
Collector container is the container for collecting BMP messages from BMP senders, e.g. routers.
|
||||||
|
This container can be distributed.
|
||||||
|
|
||||||
|
#### Container Includes
|
||||||
|
* **Openbmpd** - Latest collector (listening port is TCP 5000)
|
||||||
|
|
||||||
|
### Recommended Current Linux Distributions
|
||||||
|
|
||||||
|
1. Ubuntu 14.04/Trusty
|
||||||
|
1. CentOS 7/RHEL 7
|
||||||
|
|
||||||
|
### 1) Install docker
|
||||||
|
Docker host should be **Linux x86_64**. Follow the [Docker Instructions](https://docs.docker.com/installation/) to install docker.
|
||||||
|
|
||||||
|
- - -
|
||||||
|
|
||||||
|
### 2) Download the docker image
|
||||||
|
|
||||||
|
docker pull openbmp/collector
|
||||||
|
|
||||||
|
- - -
|
||||||
|
|
||||||
|
### 3) [OPTIONAL] Add persistent configs
|
||||||
|
|
||||||
|
#### On host create persistent config location
|
||||||
|
|
||||||
|
mkdir -p /var/openbmp/config
|
||||||
|
chmod 777 /var/openbmp/config
|
||||||
|
|
||||||
|
#### config/hosts
|
||||||
|
You can add custom host entries so that the collector will reverse lookup IP addresses
|
||||||
|
using a persistent hosts file.
|
||||||
|
|
||||||
|
Run docker with ```-v /var/openbmp/config:/config``` to make use of the persistent config files.
|
||||||
|
|
||||||
|
#### config/openbmpd.conf
|
||||||
|
You can provide a customized **openbmpd.conf**. See [Config Example](https://github.com/OpenBMP/openbmp/blob/master/Server/openbmpd.conf)
|
||||||
|
|
||||||
|
### 4) Run docker container
|
||||||
|
|
||||||
|
#### Environment Variables
|
||||||
|
Below table lists the environment variables that can be used with ``docker run -e <name=value>``
|
||||||
|
|
||||||
|
NAME | Value | Details
|
||||||
|
:---- | ----- |:-------
|
||||||
|
KAFKA\_FQDN | hostanme or IP | Kafka broker hostname[:port]. Hostname can be an IP address
|
||||||
|
OPENBMP\_ADMIN\_ID | name or IP | Name or IP of the collector, default is the docker hostname
|
||||||
|
OPENBMP\_BUFFER | Size in MB | Defines the openbmpd buffer per router for BMP messages. Default is 16 MB.
|
||||||
|
|
||||||
|
#### Run normally
|
||||||
|
|
||||||
|
> ##### IMPORTANT
|
||||||
|
> You must define the **KAFKA_FQDN** as a 'hostname'. If all containers are running on the same node, this
|
||||||
|
> hostname can be local specific, such as 'localhost' or 'myhost'. If Kafka is running on a different server,
|
||||||
|
> than the consumers and producers, then the KAFKA_FQDN should be a valid hostname that can be resolved using DNS.
|
||||||
|
> This can be internal DNS or manually done by updating the /etc/hosts file on each machine.
|
||||||
|
|
||||||
|
docker run -d --name=openbmp_collector -e KAFKA_FQDN=localhost \
|
||||||
|
--sysctl net.ipv4.tcp_keepalive_intvl=30 \
|
||||||
|
--sysctl net.ipv4.tcp_keepalive_probes=5 \
|
||||||
|
--sysctl net.ipv4.tcp_keepalive_time=180 \
|
||||||
|
-v /var/openbmp/config:/config \
|
||||||
|
-p 5000:5000 \
|
||||||
|
openbmp/collector
|
||||||
|
|
||||||
|
|
||||||
|
### Monitoring/Troubleshooting
|
||||||
|
|
||||||
|
You can use standard docker exec commands to monitor the log files. To monitor
|
||||||
|
openbmp, use ```docker exec openbmp_collector tail -f /var/log/openbmpd.log```
|
||||||
|
|
||||||
|
Alternatively, it can be easier at times to navigate all the log files from within the container. You can do so using:
|
||||||
|
|
||||||
|
docker exec -it openbmp_collector bash
|
||||||
|
|
||||||
|
|
||||||
|
#### docker logs
|
||||||
|
You can use ```docker logs openbmp_collector``` to get the console logs. This is useful if the container exits due to
|
||||||
|
invalid start or for another reason.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
37
dev-image/Dockerfile
Normal file
37
dev-image/Dockerfile
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Development build container: openbmp/dev-image
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 Cisco Systems, Inc. and others. All rights reserved.
|
||||||
|
# Copyright (c) 2021 Tim Evens. All rights reserved.
|
||||||
|
#
|
||||||
|
# Container used to build the OpenBMP components
|
||||||
|
#
|
||||||
|
# Author: Tim Evens <tim@openbmp.org>
|
||||||
|
#
|
||||||
|
# BUILD: docker build -t openbmp/dev-image .
|
||||||
|
# docker tag openbmp/dev-image openbmp/dev-image:latest
|
||||||
|
|
||||||
|
FROM debian:bullseye-slim AS build
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
WORKDIR /ws
|
||||||
|
|
||||||
|
# Install the various depends
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y openjdk-17-jdk-headless maven
|
||||||
|
RUN mkdir -p /usr/share/man/man1/ \
|
||||||
|
&& apt-get -y install git gcc g++ libboost-dev cmake zlib1g-dev libssl-dev libsasl2-dev \
|
||||||
|
liblz4-dev libzstd-dev librdkafka-dev
|
||||||
|
|
||||||
|
|
||||||
|
# Build/install yaml-cpp
|
||||||
|
RUN cd /tmp && git clone https://github.com/jbeder/yaml-cpp.git \
|
||||||
|
&& cd yaml-cpp \
|
||||||
|
&& mkdir build && cd build \
|
||||||
|
&& cmake -DBUILD_SHARED_LIBS=OFF .. \
|
||||||
|
&& make && make install \
|
||||||
|
&& cd /tmp
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
RUN rm -rf /tmp/* && apt-get clean
|
||||||
|
|
||||||
24
dev-image/README.md
Normal file
24
dev-image/README.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
OpenBMP Development Image
|
||||||
|
----------------------------
|
||||||
|
This image is the base development image used to build all the OpenBMP
|
||||||
|
components. It has all the needed dependencies included.
|
||||||
|
|
||||||
|
### Build Image
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t openbmp/dev-image:build-NNN .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Publish Image to dockerhub
|
||||||
|
|
||||||
|
```
|
||||||
|
# Login to docker
|
||||||
|
docker login
|
||||||
|
|
||||||
|
# Tag the image
|
||||||
|
docker tag openbmp/dev-image:build-NNN openbmp/dev-image:latest
|
||||||
|
|
||||||
|
# Upload the image
|
||||||
|
docker push openbmp/dev-image:build-NNN
|
||||||
|
docker push openbmp/dev-image:latest
|
||||||
|
```
|
||||||
Loading…
x
Reference in New Issue
Block a user