You are here: Home / Projects / EVE / adam / Запуск adam

Запуск adam

by Petr Fedchenkov last modified Jan 21, 2020 07:45 PM

Окружение:

Ubuntu 18.04
docker 18.09.9 (sudo apt install docker.io)
go 1.13.5 (sudo snap install --classic go)
sudo apt install make qemu-utils qemu-system-x86

В директории, где клонирован репозиторий adam (терминал 1)

IP=`hostname -I|cut -d' ' -f1`
dir=$PWD
touch ~/.rnd

rm -rf run
mkdir -p run/adam
mkdir run/config
cd run/adam

openssl genrsa -out rootCA.key 4096
openssl req -x509 -new -nodes -key rootCA.key -sha256 -subj "/C=RU/ST=SPB/O=MyOrg, Inc./CN=test" -days 1024 -out rootCA.crt 

openssl ecparam -name prime256v1 -genkey -out server-key.pem
openssl req -new -sha256 -key server-key.pem -subj "/C=RU/ST=SPB/O=MyOrg, Inc./CN=mydomain.com" -reqexts SAN -config <(cat /etc/ssl/openssl.cnf \
        <(printf "\n[SAN]\nsubjectAltName=DNS:mydomain.com,IP:$IP")) \
        -out server.csr
openssl x509 -req -extfile <(printf "subjectAltName=DNS:mydomain.com,IP:$IP") -days 365 -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.pem

openssl ecparam -name prime256v1 -genkey -out onboard.key
openssl req -new -sha256 -key onboard.key -subj "/C=RU/ST=SPB/O=MyOrg, Inc./CN=onboard" -out onboard.pem.csr
openssl x509 -req -in onboard.pem.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out onboard.pem -days 500 -sha256

cp rootCA.crt ../config/root-certificate.pem

cp onboard.pem ../config/onboard.cert.pem
cp onboard.key ../config/onboard.key.pem

sudo sh -c "echo $IP mydomain.com>../config/hosts"
sudo sh -c "echo mydomain.com:8080>../config/server"

sudo chmod 644 ../config/*.pem

В другом терминале (терминал 2) (В директории, где клонирован репозиторий adam)

docker run -v $PWD/run:/adam/run -p 8080:8080 lfedge/adam server --conf-dir ./run/config/adam

В терминале 1

cd $dir
docker run -v $PWD/run:/adam/run lfedge/adam admin --server https://$IP:8080 onboard add --path /adam/run/config/onboard.cert.pem
sudo sh -c "echo '*'>run/adam/onboard/onboard/onboard-serials.txt"

Запуск EVE (директории, где склонирован проект EVE)

Работает с тэгом 4.5.2:
git checkout 4.5.2
docker pull lfedge/eve-vtpm:4.5.2
docker tag lfedge/eve-vtpm:4.5.2 lfedge/eve-vtpm:23b5fcad9c77a7c8ff7c0740998abdd273b39f7e-amd64
Внести правки в Makefile (подсети не должны совпадать с хостовыми: в файле из гита заданы 192.168.1.0/24 и 192.168.2.0/24) Включить поддержку вложенной виртуализации:
sudo sed -i 's/SandyBridge /SandyBridge,vmx=on /g' Makefile
sudo make ACCEL=TRUE CONF_DIR=../adam/run/config/ live
sudo make ACCEL=TRUE CONF_DIR=../adam/run/config/ run

ЛОГ adam

2020/01/09 13:36:55 EVE-compatible configuration directory output to ./run/config
2020/01/09 13:36:55 Starting adam:
2020/01/09 13:36:55 	IP:Port: 0.0.0.0:8080
2020/01/09 13:36:55 	storage: file
2020/01/09 13:36:55 	database: ./run/adam
2020/01/09 13:36:55 	server cert: run/adam/server.pem
2020/01/09 13:36:55 	server key: run/adam/server-key.pem
2020/01/09 13:44:39 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/ping
2020/01/09 13:44:39 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/ping
2020/01/09 13:44:59 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/ping
2020/01/09 13:44:59 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/config
2020/01/09 13:44:59 unknown device cert
2020/01/09 13:45:00 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/config
2020/01/09 13:45:00 unknown device cert
2020/01/09 13:45:01 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/config
2020/01/09 13:45:01 unknown device cert
2020/01/09 13:45:01 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/register
2020/01/09 13:45:01 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/config
2020/01/09 13:45:02 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/config
2020/01/09 13:45:02 unknown device cert
2020/01/09 13:45:03 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/config
2020/01/09 13:45:03 unknown device cert
2020/01/09 13:45:04 CN=onboard,O=MyOrg\, Inc.,ST=SPB,C=RU requested /api/v1/edgedevice/config
2020/01/09 13:45:04 unknown device cert
2020/01/09 13:45:04 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/config
2020/01/09 13:45:15 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:15 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:18 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:18 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/info
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/metrics
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/info
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/ping
2020/01/09 13:45:21 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/config
2020/01/09 13:45:24 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:24 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/config
2020/01/09 13:45:24 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:27 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs
2020/01/09 13:45:27 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/info
2020/01/09 13:45:27 CN=onboard,O=Zededa\, Inc,L=Santa Clara,ST=California,C=US requested /api/v1/edgedevice/logs