Tuesday, November 17, 2015

Deploy kolla all in one node from source

Dock 1.8.2 and ansible 1.9.4

sudo apt-get install docker-engine=1.8.2-0~trusty



Note when updating ansible, be sure to not only update the source tree, but also the “submodules” in git which point at Ansible’s own modules (not the same kind of modules, alas).
$ git pull --rebase
$ git submodule update --init --recursive

install Kolla Python dependencies

git clone https://git.openstack.org/openstack/kolla
cd kolla
sudo pip install -r requirements.txt
apt-get install -y python-dev python-pip libffi-dev libssl-dev
pip install -U python-openstackclient

Post-Install Setup

ssh-keygen -t rsa -C "ansi@ansi.com"

 ssh-copy-id deployer@host

Building behind a proxy


To use this feature, create a file called .header, with the following content for example:
ENV http_proxy=https://evil.corp.proxy:80
ENV https_proxy=https://evil.corp.proxy:80
Then create another file called .footer, with the following content:
ENV http_proxy=""
ENV https_proxy=""
Finally, pass them to the build script using the -i and -I flags:
tools/build.py -i .header -I .footer  keystone

build ubuntu binary image has bug , only centos works

Can’t build base image because docker fails to install systemd, the workaround is 
add -s devicemapper to DOCKER_OPTS(/etc/default/docker) 
--insecure-registry 172.22.2.81:4000 to DOCKER_OPTS

DOCKER_OPTS="-s devicemapper --insecure-registry 172.22.2.81:4000"

Deploy a v2 register container

docker run -d -p 4000:5000 --restart=always --name registry registry:2

build images from source and push images to local registry

tools/build.py --registry localhost:4000 --base ubuntu --type source  --push  keystone 

tools/build.py  --base ubuntu --type source  -p <proflile> (kolla-build.conf)

Deploy using local image

cp etc/kolla /etc/
./tools/kolla-ansible deploy
use locally built images for an AIO to set the value 'docker_pull_policy: "missing"' in the globals.yml

[ansible-playbook -i inventory/all-in-one -e @/etc/kolla/globals.yml -e @./etc/kolla/passwords.yml site.yml --tags  rabbitmq,mariadb]

]


Disable service deployment

Modify ansible/group-vars/all.yml(or overridden in 'etc/kolla/globals.yml' ) , disable haproxy
enable_haproxy: "no"

#stop all container them remove 
$docker stop $(docker ps -a -q)
$docker rm -v $(docker ps -a -q -f status=exited)
#remoe all iamges
$docker rmi -f $(docker images -q)


$. /etc/default/docker
$ sudo docker -d -D $OPT
Warning: '-d' is deprecated, it will be removed soon. See usage.
WARN[0000] please use 'docker daemon' instead.
INFO[0000] API listen on /var/run/docker.sock

FATA[0000] Error starting daemon: error initializing graphdriver: "/var/lib/docker" contains other graphdrivers: devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)

$sudo rm -rf /var/lib/docker/devicemapper/



docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_db -a "login_host='16.158.50.191' login_port='3306' login_user='root' login_password='password' name='keystone'"



Rsyslog container log  all service :

    docker exec -it rsyslog bash

The logs from all services in all containers may be read from
/var/log/SERVICE_NAME

POST-DEPLOY 

OPENRC

ansible-playbook -vvvv -i inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml post-deploy.yml






No comments:

Post a Comment