more changes to compose

This commit is contained in:
Tim Evens 2021-03-30 19:00:25 -07:00
parent 574bf5e8a9
commit 74154229ad
3 changed files with 41 additions and 23 deletions

View File

@ -54,14 +54,19 @@ sudo mkdir -p $OBMP_DATA_ROOT
Create sub directories Create sub directories
``` ```
mkdir -p ${OBMP_DATA_ROOT}/config mkdir -p ${OBMP_DATA_ROOT}/config
mkdir -p ${OBMP_DATA_ROOT``}/kafka-data mkdir -p ${OBMP_DATA_ROOT}/kafka-data
mkdir -p ${OBMP_DATA_ROOT}/zk-data
mkdir -p ${OBMP_DATA_ROOT}/zk-log
mkdir -p ${OBMP_DATA_ROOT}/postgres/data mkdir -p ${OBMP_DATA_ROOT}/postgres/data
mkdir -p ${OBMP_DATA_ROOT}/postgres/ts mkdir -p ${OBMP_DATA_ROOT}/postgres/ts
mkdir -p ${OBMP_DATA_ROOT}/grafana mkdir -p ${OBMP_DATA_ROOT}/grafana
mkdir -p ${OBMP_DATA_ROOT}/grafana/dashboards
sudo chmod -R 7777 $OBMP_DATA_ROOT sudo chmod -R 7777 $OBMP_DATA_ROOT
``` ```
> In order to init the DB tables, you must create the file ```${OBMP_DATA_ROOT}/config/init_db```. This should
> only be done once or whenever you want to completely wipe out the DB and start over.
Change ```OBMP_DATA_ROOT=<path>``` to where you created the directories above. The default is ```/var/openbmp``` Change ```OBMP_DATA_ROOT=<path>``` to where you created the directories above. The default is ```/var/openbmp```

View File

@ -4,15 +4,18 @@ services:
zookeeper: zookeeper:
restart: unless-stopped restart: unless-stopped
container_name: zookeeper container_name: obmp-zookeeper
image: confluentinc/cp-zookeeper:6.0.2 image: confluentinc/cp-zookeeper:6.0.2
volumes:
- ${OBMP_DATA_ROOT}/zk-data:/var/lib/zookeeper/data
- ${OBMP_DATA_ROOT}/zk-log:/var/lib/zookeeper/log
environment: environment:
ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000 ZOOKEEPER_TICK_TIME: 2000
kafka: kafka:
restart: unless-stopped restart: unless-stopped
container_name: kafka container_name: obmp-kafka
image: confluentinc/cp-kafka:6.0.2 image: confluentinc/cp-kafka:6.0.2
# Change the mount point to where you want to store Kafka data. # Change the mount point to where you want to store Kafka data.
@ -25,13 +28,13 @@ services:
- 9092:9092 - 9092:9092
environment: environment:
KAFKA_BROKER_ID: 1 KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_ZOOKEEPER_CONNECT: obmp-zookeeper:2181
# Change/add listeners based on your FQDN that the host and other containers can access. You can use # Change/add listeners based on your FQDN that the host and other containers can access. You can use
# an IP address as well. By default, only within the compose/containers can Kafka be accesssed # an IP address as well. By default, only within the compose/containers can Kafka be accesssed
# using port 29092. Outside access can be enabled, but you should use an FQDN listener. # using port 29092. Outside access can be enabled, but you should use an FQDN listener.
#KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://<FQDN>:9092 #KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://<FQDN>:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://obmp-kafka:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
@ -44,13 +47,13 @@ services:
grafana: grafana:
restart: unless-stopped restart: unless-stopped
container_name: grafana container_name: obmp-grafana
image: grafana/grafana:latest image: grafana/grafana:latest
ports: ports:
- 3000:3000 - 3000:3000
volumes: volumes:
- ${OBMP_DATA_ROOT}/grafana:/var/lib/grafana - ${OBMP_DATA_ROOT}/grafana:/var/lib/grafana
- ${OBMP_DATA_ROOT}/grafana-provisioning/:/etc/grafana/provisioning/ - ${OBMP_DATA_ROOT}/grafana/provisioning:/etc/grafana/provisioning/
environment: environment:
- GF_SECURITY_ADMIN_PASSWORD=openbmp - GF_SECURITY_ADMIN_PASSWORD=openbmp
- GF_AUTH_ANONYMOUS_ENABLED=true - GF_AUTH_ANONYMOUS_ENABLED=true
@ -59,7 +62,7 @@ services:
psql: psql:
restart: unless-stopped restart: unless-stopped
container_name: psql container_name: obmp-psql
image: openbmp/postgres:build-50 image: openbmp/postgres:build-50
ports: ports:
- 5432:5432 - 5432:5432
@ -74,7 +77,7 @@ services:
collector: collector:
restart: unless-stopped restart: unless-stopped
container_name: collector container_name: obmp-collector
image: openbmp/collector:build-50 image: openbmp/collector:build-50
sysctls: sysctls:
- net.ipv4.tcp_keepalive_intvl=30 - net.ipv4.tcp_keepalive_intvl=30
@ -85,11 +88,11 @@ services:
volumes: volumes:
- ${OBMP_DATA_ROOT}/config:/config - ${OBMP_DATA_ROOT}/config:/config
environment: environment:
- KAFKA_FQDN=kafka:29092 - KAFKA_FQDN=obmp-kafka:29092
psql-app: psql-app:
restart: unless-stopped restart: unless-stopped
container_name: psql-app container_name: obmp-psql-app
image: openbmp/psql-app:build-50 image: openbmp/psql-app:build-50
sysctls: sysctls:
- net.ipv4.tcp_keepalive_intvl=30 - net.ipv4.tcp_keepalive_intvl=30
@ -102,10 +105,11 @@ services:
- ${OBMP_DATA_ROOT}/config:/config - ${OBMP_DATA_ROOT}/config:/config
environment: environment:
- MEM=2 # Set memory to at least 2GB but ideally 4GB - MEM=2 # Set memory to at least 2GB but ideally 4GB
- KAFKA_FQDN=kafka:29092 - KAFKA_FQDN=obmp-kafka:29092
- ENABLE_RPKI=0 # 1 enables, 0 disables RPKI sync - ENABLE_RPKI=0 # 1 enables, 0 disables RPKI sync
- ENABLE_IRR=0 # 1 enables, 0 disables IRR sync - ENABLE_IRR=0 # 1 enables, 0 disables IRR sync
- POSTGRES_PASSWORD=openbmp - POSTGRES_PASSWORD=openbmp
- POSTGRES_USER=openbmp - POSTGRES_USER=openbmp
- POSTGRES_DB=openbmp - POSTGRES_DB=openbmp
- POSTGRES_HOST=psql:5432 - POSTGRES_HOST=obmp-psql
- POSTGRES_PORT=5432

View File

@ -10,6 +10,7 @@
export POSTGRES_USER=${POSTGRES_USER:="openbmp"} export POSTGRES_USER=${POSTGRES_USER:="openbmp"}
export POSTGRES_PASSWORD=${POSTGRES_PASSWORD:="openbmp"} export POSTGRES_PASSWORD=${POSTGRES_PASSWORD:="openbmp"}
export POSTGRES_HOST=${POSTGRES_HOST:="127.0.0.1"} export POSTGRES_HOST=${POSTGRES_HOST:="127.0.0.1"}
exprot POSTGRES_PORT=${POSTGRES_PORT:="5432"}
export POSTGRES_DB=${POSTGRES_DB:="openbmp"} export POSTGRES_DB=${POSTGRES_DB:="openbmp"}
export MEM=${MEM:="1"} # mem in gigabytes export MEM=${MEM:="1"} # mem in gigabytes
export PGCONNECT_TIMEOUT=15 export PGCONNECT_TIMEOUT=15
@ -60,6 +61,7 @@ config_postgres_profile() {
echo "export PGUSER=$POSTGRES_USER" > /usr/local/openbmp/pg_profile echo "export PGUSER=$POSTGRES_USER" > /usr/local/openbmp/pg_profile
echo "export PGPASSWORD=$POSTGRES_PASSWORD" >> /usr/local/openbmp/pg_profile echo "export PGPASSWORD=$POSTGRES_PASSWORD" >> /usr/local/openbmp/pg_profile
echo "export PGHOST=$POSTGRES_HOST" >> /usr/local/openbmp/pg_profile echo "export PGHOST=$POSTGRES_HOST" >> /usr/local/openbmp/pg_profile
echo "export PGPORT=$POSTGRES_PORT" >> /usr/local/openbmp/pg_profile
echo "export PGDATABASE=$POSTGRES_DB" >> /usr/local/openbmp/pg_profile echo "export PGDATABASE=$POSTGRES_DB" >> /usr/local/openbmp/pg_profile
} }
@ -67,16 +69,21 @@ config_postgres_profile() {
# Initdb Postgres # Initdb Postgres
# ----------------------------------------------- # -----------------------------------------------
initdb_postgres() { initdb_postgres() {
echo " ===> Initializing the DB" if [[ -f /config/init_db ]]; then
echo " ===> Initializing the DB"
# Load the schema files # Load the schema files
echo " ===> Loading Schemas" echo " ===> Loading Schemas"
echo "------" > /var/log/db_schema_load.log
for file in $(ls -v /usr/local/openbmp/db_schema/*.sql); do echo "------" > /var/log/db_schema_load.log
echo " ===[ $file ] ========================================" >> /var/log/db_schema_load.log for file in $(ls -v /usr/local/openbmp/database/*.sql); do
su - -c "psql -U $POSTGRES_USER $POSTGRES_DB < $file" >> /var/log/db_schema_load.log 2>&1 echo " ===[ $file ] ========================================" >> /var/log/db_schema_load.log
done psql < $file >> /var/log/db_schema_load.log 2>&1
done
rm -f /config/init_db
fi
} }
# ----------------------------------------------- # -----------------------------------------------
@ -210,10 +217,12 @@ update_hosts
check_kafka check_kafka
config_cron
config_postgres_profile config_postgres_profile
source /usr/local/openbmp/pg_profile
config_cron
rm -f /etc/cron.d/openbmp-rpki rm -f /etc/cron.d/openbmp-rpki
if [[ ${ENABLE_RPKI:-""} != "" ]]; then if [[ ${ENABLE_RPKI:-""} != "" ]]; then
enable_rpki enable_rpki