Refactor Docker setup to include /run/exabgp directory and update ExaBGP configuration. Added named pipes in standard and compatibility locations, ensuring proper initialization for CLI communication.
Build and Push Docker Image / build (push) Successful in 3m41s

This commit is contained in:
2025-07-11 16:21:30 +07:00
parent a7684e03a1
commit 050cf03339
4 changed files with 58 additions and 32 deletions
+15
View File
@@ -42,6 +42,21 @@ docker run -d `
-e BGP_NEIGHBOR_IP=192.168.1.1 `
-e BGP_NEIGHBOR_AS=65001 `
git.shts.su/infra/bgp-server:latest
# Примечание: Если используете старую версию образа, может потребоваться пересборка
# или запуск с дополнительными volume для named pipes:
docker run -d `
--name bgp-server `
--restart unless-stopped `
-p 179:179 `
-v ${PWD}/data:/app/data:ro `
-v ${PWD}/logs:/app/logs `
-v /run/exabgp:/run/exabgp `
-e BGP_LOCAL_AS=65000 `
-e BGP_ROUTER_ID=192.168.1.100 `
-e BGP_NEIGHBOR_IP=192.168.1.1 `
-e BGP_NEIGHBOR_AS=65001 `
git.shts.su/infra/bgp-server:latest
```
### 3. Проверка работы
+1 -1
View File
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \
RUN pip install exabgp
# Создание структуры директорий
RUN mkdir -p /app/scripts /app/data /app/logs
RUN mkdir -p /app/scripts /app/data /app/logs /run/exabgp
# Копирование файлов
COPY exabgp.conf /app/exabgp.conf
+32 -29
View File
@@ -4,38 +4,41 @@ process load-prefixes {
encoder json;
}
# Настройки CLI
cli {
in /app/run/exabgp.in;
out /app/run/exabgp.out;
}
# Настройки BGP
neighbor 192.168.1.1 {
router-id 192.168.1.100;
local-address 192.168.1.100;
local-as 65000;
peer-as 65001;
# Только исходящие анонсы (не принимаем префиксы)
capability {
graceful-restart;
# Глобальные настройки
group default {
# Настройки CLI
cli {
in /run/exabgp/exabgp.in;
out /run/exabgp/exabgp.out;
}
# Настройки сессии (hold-time автоматически рассчитывает keepalive)
hold-time 90;
# Логирование
api {
processes [load-prefixes];
neighbor-changes;
receive {
parsed;
update;
# Настройки BGP
neighbor 192.168.1.1 {
router-id 192.168.1.100;
local-address 192.168.1.100;
local-as 65000;
peer-as 65001;
# Только исходящие анонсы (не принимаем префиксы)
capability {
graceful-restart;
}
send {
parsed;
update;
# Настройки сессии (hold-time автоматически рассчитывает keepalive)
hold-time 90;
# Логирование
api {
processes [load-prefixes];
neighbor-changes;
receive {
parsed;
update;
}
send {
parsed;
update;
}
}
}
}
+10 -2
View File
@@ -9,10 +9,18 @@ echo "Starting BGP Server..."
# Создание директорий если не существуют
mkdir -p /app/logs
mkdir -p /app/run
mkdir -p /run/exabgp
# Создание named pipes для CLI
if [ ! -p "/app/run/exabgp.in" ] || [ ! -p "/app/run/exabgp.out" ]; then
# Создание named pipes для CLI в стандартном месте
if [ ! -p "/run/exabgp/exabgp.in" ] || [ ! -p "/run/exabgp/exabgp.out" ]; then
echo "Creating named pipes for ExaBGP CLI..."
mkfifo /run/exabgp/exabgp.in /run/exabgp/exabgp.out
chmod 600 /run/exabgp/exabgp.in /run/exabgp/exabgp.out
fi
# Также создаем в /app/run для совместимости
if [ ! -p "/app/run/exabgp.in" ] || [ ! -p "/app/run/exabgp.out" ]; then
echo "Creating named pipes in /app/run for compatibility..."
mkfifo /app/run/exabgp.in /app/run/exabgp.out
chmod 600 /app/run/exabgp.in /app/run/exabgp.out
fi