Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.
雾雨 edited this page Sep 10, 2020 · 28 revisions

Barrel config

  • barrel.conf is the config file, and it should be placed under /etc/eru/
  • Remember to modify calico enviroment variables according to your calico configs
# ETCD endpoints addresses is required,
# you may put multiple addresses split by a comma
ETCD_ENDPOINTS=http://127.0.0.1:2379

# the following line is the host addresses of barrel
# multiple addresses should be split by a comma
# if you want to use default address of docker, remember to change dockerd socket config
# if not provided it will have default value of 'unix:///var/run/docker.sock'
# If you want to enable https, you should also provided with tls certs(see section #TLS certs )
BARREL_HOSTS=unix:///var/run/barrel.sock,https://127.0.0.1:8000

# the following line is the dockerd unix socket path
# if not provided it will have default value of 'unix:///var/run/dockerd.sock'
DOCKERD_SOCKET_PATH=/var/run/docker.sock

# If you want to enable tls, fill the fields below
BARREL_TLS_CERT_FILE_PATH=${path-to-cert-file}
BARREL_TLS_KEY_FILE_PATH=${path-to-cert-key-file}

# Log level, should be DEBUG, INFO, WARN or ERROR
BARREL_LOG_LEVEL=INFO

# Calico environment variables, edit them according to your calico config
CALICO_LIBNETWORK_NAMESPACE=
CALICO_LIBNETWORK_VETH_MTU=
CALICO_LIBNETWORK_LABEL_ENDPOINTS=
CALICO_LIBNETWORK_CREATE_PROFILES=
CALICO_LIBNETWORK_LABEL_POLL_TIMEOUT=
CALICO_LIBNETWORK_IFPREFIX=cali    # Default value is 'cali'

Systemd config

Barrel should be wanted by docker daemon Following is a sample of barrel systemd config

[Unit]
Description=Eru Docker Proxy
After=network.target 
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
# set GOMAXPROCS to number of processors
EnvironmentFile=-/etc/eru/barrel.conf
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/eru-barrel"
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
WantedBy=docker.service

Replace docker daemon default socket by barrel unix socket

  1. You should edit barrel conf by the guide of the following barrel.conf sample
  2. You should edit docker daemon config(/etc/docker/daemon.json)
{
	"hosts": ["unix:///var/run/dockerd.sock","tcp://127.0.0.1:9076"],
	"tlsverify": true,
    	"tlscacert": "/etc/docker/tls/ca.pem",
    	"tlscert": "/etc/docker/tls/server-cert.pem",
    	"tlskey": "/etc/docker/tls/server-key.pem",
	"cluster-store": "etcd://127.0.0.1:2379"
}
  1. You should edit systemd config of docker.socket
[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/dockerd.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target
Clone this wiki locally