From 2d3a8db6ac4dd93436c34fa3207b95b9f3b16990 Mon Sep 17 00:00:00 2001 From: chemistry_sourabh Date: Thu, 23 Mar 2017 23:01:05 -0400 Subject: [PATCH 1/8] Initial Docker files --- Dockerfile | 50 +++++++++++++++++++++++++++++++++++ Dockerfile_hil | 33 +++++++++++++++++++++++ docker/bmi_config.cfg | 53 +++++++++++++++++++++++++++++++++++++ docker/haas.cfg | 61 +++++++++++++++++++++++++++++++++++++++++++ docker/runbmi.sh | 2 ++ docker/runhil.sh | 3 +++ docker/setupdb.sh | 13 +++++++++ docker/wsgi.conf | 16 ++++++++++++ 8 files changed, 231 insertions(+) create mode 100644 Dockerfile create mode 100644 Dockerfile_hil create mode 100644 docker/bmi_config.cfg create mode 100644 docker/haas.cfg create mode 100644 docker/runbmi.sh create mode 100644 docker/runhil.sh create mode 100644 docker/setupdb.sh create mode 100644 docker/wsgi.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3bfbe9a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +FROM ubuntu + +# RUN echo "deb http://ceph.com/packages/ceph-extras/debian $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/ceph-extras.list +RUN apt-get -y update && apt-get install -y tgt-rbd ceph-common python python-dev python-setuptools build-essential python-pip sudo sqlite3 + +# Dev doesnt need dnsmasq for now, will require for prod +# RUN apt-get install -y dnsmasq + +# TODO update dnsmasq.conf and other stuff when updating for prod + +RUN pip install dumb-init + +RUN useradd -ms /bin/bash bmi +RUN passwd -d bmi +RUN usermod -aG sudo bmi +COPY ims/ /home/bmi/ims/ +COPY tests/ /home/bmi/tests/ +COPY scripts/ /home/bmi/scripts/ +COPY setup.py /home/bmi/setup.py + +WORKDIR /home/bmi +RUN python setup.py install + +RUN mkdir /etc/bmi/ +RUN mkdir /var/log/bmi/ +RUN mkdir /var/lib/tftpboot/ +RUN mkdir /var/lib/tftpboot/pxelinux.cfg/ +RUN mkdir /var/lib/bmi/ + +COPY docker/bmi_config.cfg /etc/bmi/bmiconfig.cfg + +RUN chown bmi:bmi /var/log/bmi/ +RUN chown bmi:bmi /var/lib/tftpboot/ +RUN chown bmi:bmi /var/lib/tftpboot/pxelinux.cfg/ +RUN chown bmi:bmi /var/lib/bmi/ + +COPY docker/runbmi.sh ./runbmi.sh +RUN chmod a+x runbmi.sh + +ENV HAAS_USERNAME=admin +ENV HAAS_PASSWORD=admin + +VOLUME /etc/ceph + +USER bmi +RUN bmi db ls +RUN sqlite3 /var/lib/bmi/bmi.db "insert into project values(1,'bmi_infra','bmi_provision')" + + +CMD dumb-init /home/bmi/runbmi.sh diff --git a/Dockerfile_hil b/Dockerfile_hil new file mode 100644 index 0000000..a19a243 --- /dev/null +++ b/Dockerfile_hil @@ -0,0 +1,33 @@ +FROM centos +RUN yum install -y epel-release +RUN yum -y update && yum install -y bridge-utils gcc httpd ipmitool libvirt libxml2-devel libxslt-devel mod_wsgi net-tools python-pip python-psycopg2 python-virtinst qemu-kvm telnet vconfig virt-install +RUN yum install -y git +RUN yum install -y python-devel +RUN pip install dumb-init + +RUN useradd -ms /bin/bash haas +WORKDIR /root +RUN git clone https://github.com/CCI-MOC/hil.git +WORKDIR /root/hil +RUN python setup.py install +COPY docker/haas.cfg /etc/haas.cfg +COPY docker/haas.cfg ./haas.cfg +# RUN cp examples/haas.cfg.dev-no-hardware ./haas.cfg +RUN haas-admin db create +COPY docker/setupdb.sh ./setupdb.sh +RUN chmod a+x setupdb.sh +RUN ./setupdb.sh + +RUN chmod 666 /home/haas/haas.db +RUN chown haas:haas /home/haas/haas.db + +COPY docker/runhil.sh ./runhil.sh +RUN chmod a+x runhil.sh + +COPY docker/wsgi.conf /etc/httpd/conf.d/wsgi.conf +RUN mkdir /var/www/haas/ +RUN cp ./haas.wsgi /var/www/haas/ + + +EXPOSE 80 +CMD dumb-init /root/hil/runhil.sh diff --git a/docker/bmi_config.cfg b/docker/bmi_config.cfg new file mode 100644 index 0000000..babb518 --- /dev/null +++ b/docker/bmi_config.cfg @@ -0,0 +1,53 @@ +# this section is for basic bmi settings +[bmi] +# uid is given so that images dont clash in ceph pool +uid = 1 +service = False + +# this section is for db settings +[db] +path = /var/lib/bmi/bmi.db + +# This section is filesystem related config +[fs] +id = admin +pool = rbd +conf_file = /etc/ceph/ceph.conf +keyring = /etc/ceph/ceph.client.admin.keyring + +[driver] +net_isolator = +iscsi = +fs = + +# This section is for network isolator (HIL) related config +[net_isolator] +url = 172.17.0.3:80 + +# This section is for iscsi related config +[iscsi] +ip = 127.0.0.1 +password = password + +# this section is for rpc server config +[rpc] +name_server_ip = 127.0.0.1 +name_server_port = 9000 +rpc_server_ip = 127.0.0.1 +rpc_server_port = 9001 + +# this section is for specifying tftp settings +[tftp] +pxelinux_path = /var/lib/tftpboot/pxelinux.cfg/ +ipxe_path = /var/lib/tftpboot/ + +# this section is for http config +[rest_api] +ip = 127.0.0.1 +port = 8000 + +# this section is for logs +[logs] +path = /var/log/bmi/ +debug = True +verbose = False diff --git a/docker/haas.cfg b/docker/haas.cfg new file mode 100644 index 0000000..80f0659 --- /dev/null +++ b/docker/haas.cfg @@ -0,0 +1,61 @@ +# This is an example haas.cfg file suitable for use for development without a +# full set of hardware (switches, nodes, libvirtd...). It can be used as-is, +# but using the vlan_pool allocator may also be desirable (see the comments +# below). +[general] +log_level = debug + +[auth] +require_authentication = False + +[headnode] +trunk_nic = eth0 +base_imgs = img1, img2, img3, img4 +libvirt_endpoint = qemu:///system + +[client] +endpoint = http://127.0.0.1:5000 + +[database] +uri = sqlite:////home/haas/haas.db +#uri = postgresql://:@
/ + +[devel] +dry_run=True + +[extensions] +haas.ext.switches.mock = +haas.ext.obm.mock = + +haas.ext.network_allocators.null = + +# Depending on what you're trying to do, you may want to use the vlan_pool +# network allocator instead of the null allocator. To do this, comment out the +# null allocator extension above, and uncomment the following: +# +# haas.ext.network_allocators.vlan_pool = +# +# [haas.ext.network_allocators.vlan_pool] +# vlans = 100-200, 300-500 + +haas.ext.auth.null = +# Again, depending on what you're doing, you may want to change this to a +# diffefrent authentication backend: +# haas.ext.auth.database = +# haas.ext.auth.keystone = +# +# If using the keystone backend, you'll also need to fill out this section: +# [haas.ext.auth.keystone] +# # This is equivalent to the [keystone_auth] section described at: +# # http://docs.openstack.org/developer/keystonemiddleware/middlewarearchitecture.html +# # +# # Below is a reasoanble configuration *for development*. It is not suitable +# # for production, If for no other reason than because it forces plaintext +# # (non-TLS) connections to keystone: +# auth_url = http://127.0.0.1:35357/v3 +# auth_protocol = http +# username = admin +# password = s3cr3t +# project_name = admin +# admin_user = admin +# admin_password = s3cr3t diff --git a/docker/runbmi.sh b/docker/runbmi.sh new file mode 100644 index 0000000..f295dd2 --- /dev/null +++ b/docker/runbmi.sh @@ -0,0 +1,2 @@ +sudo tgtd & +sleep infinity diff --git a/docker/runhil.sh b/docker/runhil.sh new file mode 100644 index 0000000..199c3c5 --- /dev/null +++ b/docker/runhil.sh @@ -0,0 +1,3 @@ +httpd & +haas serve_networks & +sleep infinity diff --git a/docker/setupdb.sh b/docker/setupdb.sh new file mode 100644 index 0000000..c3a6081 --- /dev/null +++ b/docker/setupdb.sh @@ -0,0 +1,13 @@ +haas serve 5000 & +sleep 1 +haas serve_networks & +haas project_create bmi_infra +haas node_register bmi_node mock mock-host mock-user mock-pass +haas node_register_nic bmi_node bmi_nic aa:bb:cc:dd:ee:ff +haas network_create_simple bmi_provision bmi_infra +haas project_connect_node bmi_infra bmi_node +haas switch_register bmi_switch mock mockhost mockuser mockpass +haas port_register bmi_switch bmi_port +haas port_connect_nic bmi_switch bmi_port bmi_node bmi_nic +haas show_node bmi_node +haas show_network bmi_provision diff --git a/docker/wsgi.conf b/docker/wsgi.conf new file mode 100644 index 0000000..67fdbad --- /dev/null +++ b/docker/wsgi.conf @@ -0,0 +1,16 @@ +LoadModule wsgi_module modules/mod_wsgi.so +WSGISocketPrefix run/wsgi + + + ServerName 172.17.0.3 + AllowEncodedSlashes On + WSGIPassAuthorization On + WSGIDaemonProcess haas user=haas group=haas threads=2 + WSGIScriptAlias / /var/www/haas/haas.wsgi + + WSGIProcessGroup haas + WSGIApplicationGroup %{GLOBAL} + Order deny,allow + Allow from all + + From e71cac805f83587895ec2fbe047890742d25e671 Mon Sep 17 00:00:00 2001 From: chemistry_sourabh Date: Mon, 27 Mar 2017 23:26:17 -0400 Subject: [PATCH 2/8] More fixes to script --- Dockerfile | 3 ++- docker/bmi_config.cfg | 2 +- docker/runbmi.sh | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3bfbe9a..3a5113f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ COPY scripts/ /home/bmi/scripts/ COPY setup.py /home/bmi/setup.py WORKDIR /home/bmi -RUN python setup.py install +RUN python setup.py develop RUN mkdir /etc/bmi/ RUN mkdir /var/log/bmi/ @@ -29,6 +29,7 @@ RUN mkdir /var/lib/bmi/ COPY docker/bmi_config.cfg /etc/bmi/bmiconfig.cfg +RUN chown bmi:bmi /etc/tgt/conf.d/ RUN chown bmi:bmi /var/log/bmi/ RUN chown bmi:bmi /var/lib/tftpboot/ RUN chown bmi:bmi /var/lib/tftpboot/pxelinux.cfg/ diff --git a/docker/bmi_config.cfg b/docker/bmi_config.cfg index babb518..a50d069 100644 --- a/docker/bmi_config.cfg +++ b/docker/bmi_config.cfg @@ -22,7 +22,7 @@ fs = # This section is for network isolator (HIL) related config [net_isolator] -url = 172.17.0.3:80 +url = http://hil:80 # This section is for iscsi related config [iscsi] diff --git a/docker/runbmi.sh b/docker/runbmi.sh index f295dd2..3610024 100644 --- a/docker/runbmi.sh +++ b/docker/runbmi.sh @@ -1,2 +1,3 @@ sudo tgtd & +sudo chown bmi:bmi /etc/ceph/ceph.client.admin.keyring sleep infinity From c15c24767fcf61a0ca0bea553d7dbdd34b46e430 Mon Sep 17 00:00:00 2001 From: Sourabh Bollapragada Date: Mon, 27 Mar 2017 23:47:43 -0400 Subject: [PATCH 3/8] Create docker.md --- docs/docker.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/docker.md diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 0000000..240389d --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,76 @@ +# Docker for Dev + +## Prerequisites + +* Docker + +## Creating Containers + +### Ceph + +To Run Ceph Container execute +``` +docker pull ceph/demo +docker run -d -v ceph:/etc/ceph -e MON_IP=172.17.0.2 -e CEPH_PUBLIC_NETWORK=172.17.0.0/24 --name ceph -h ceph ceph/demo +``` + +Do a ``` docker ps ``` and check if ceph container is running and to check if ceph is running probably do ``` docker exec ceph ceph -s ``` +and if the output contains HEALTH_OK then all is good. + +### HIL + +To build HIL image, first cd to the project root folder then execute +``` +docker build -t hil -f ./Dockerfile_hil +``` + +After Successful build of image execute +``` +docker run -d --name hil -h hil hil +``` +Then run ``` docker ps ``` to check if container is running + +### BMI + +Similar to HIL, first cd to the project root folder then execute +``` +docker build -t bmi . +``` + +After successful build of image execute +``` +docker run -d -v ceph:/etc/ceph --link hil:hil --name bmi -h bmi bmi +``` +Then run ``` docker ps ``` to check if container is running + +Hopefully you have a successful deployment of BMI running on your system in containers!! + +## Running + +Like after system reboot it is advised to start containers in the following order using ``` docker start ``` +* ceph +* hil +* bmi +To get the correct ips. + +## Getting in the container + +To get in the bmi container run the command ``` docker exec -it bmi bash ```, You can configure the container any way you want. BMI is already +installed as develop with production configuration. The src files are in /home/bmi. + +## Post Config Stuff for BMI + +Even though bmi is technically ready to run you will probably need to do some more stuff to run it properly. +* Create new image using ``` rbd create --image-format 2 --size 10 bmi_test ```, this will create a 10 MB blank image called bmi_test in +ceph. +* import the created image using ``` bmi import bmi_infra bmi_test ``` +* Change HIL_DEFAULT_CHANNEL to null in ims/common/constants.py (Temporary) + +This should allow you to run test cases. + +## HIL side stuff +* network = bmi_provision +* node = bmi_node +* nic = bmi_nic +* port = bmi_port +* switch = bmi_switch From e723e27a43a93ed227118961acbdd2f56a858e4b Mon Sep 17 00:00:00 2001 From: Sourabh Bollapragada Date: Mon, 27 Mar 2017 23:49:17 -0400 Subject: [PATCH 4/8] Update docker.md --- docs/docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docker.md b/docs/docker.md index 240389d..638ece0 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -64,7 +64,7 @@ Even though bmi is technically ready to run you will probably need to do some mo * Create new image using ``` rbd create --image-format 2 --size 10 bmi_test ```, this will create a 10 MB blank image called bmi_test in ceph. * import the created image using ``` bmi import bmi_infra bmi_test ``` -* Change HIL_DEFAULT_CHANNEL to null in ims/common/constants.py (Temporary) +* Change HIL_BMI_CHANNEL to null in ims/common/constants.py (Temporary) This should allow you to run test cases. From ed79332a64f395c93203ce40c1d0aeab6e54c102 Mon Sep 17 00:00:00 2001 From: chemistry_sourabh Date: Thu, 20 Apr 2017 21:54:57 -0400 Subject: [PATCH 5/8] Docker changes --- Dockerfile | 9 +++++++++ Dockerfile_hil | 1 - docker/haas.cfg | 14 +++++++------- docker/runbmi.sh | 1 + docker/runhil.sh | 5 +++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a5113f..d7ab191 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,12 +12,15 @@ RUN pip install dumb-init RUN useradd -ms /bin/bash bmi RUN passwd -d bmi +RUN passwd -d root RUN usermod -aG sudo bmi +USER bmi COPY ims/ /home/bmi/ims/ COPY tests/ /home/bmi/tests/ COPY scripts/ /home/bmi/scripts/ COPY setup.py /home/bmi/setup.py +USER root WORKDIR /home/bmi RUN python setup.py develop @@ -43,9 +46,15 @@ ENV HAAS_PASSWORD=admin VOLUME /etc/ceph + USER bmi RUN bmi db ls RUN sqlite3 /var/lib/bmi/bmi.db "insert into project values(1,'bmi_infra','bmi_provision')" +# Dev Stuff +RUN sudo apt-get install -y openssh-server vim git +RUN sudo pip install pytest +RUN mkdir /home/bmi/.ssh +COPY docker/pubkey /home/bmi/.ssh/authorized_keys CMD dumb-init /home/bmi/runbmi.sh diff --git a/Dockerfile_hil b/Dockerfile_hil index a19a243..9818693 100644 --- a/Dockerfile_hil +++ b/Dockerfile_hil @@ -12,7 +12,6 @@ WORKDIR /root/hil RUN python setup.py install COPY docker/haas.cfg /etc/haas.cfg COPY docker/haas.cfg ./haas.cfg -# RUN cp examples/haas.cfg.dev-no-hardware ./haas.cfg RUN haas-admin db create COPY docker/setupdb.sh ./setupdb.sh RUN chmod a+x setupdb.sh diff --git a/docker/haas.cfg b/docker/haas.cfg index 80f0659..8370ab6 100644 --- a/docker/haas.cfg +++ b/docker/haas.cfg @@ -27,21 +27,21 @@ dry_run=True haas.ext.switches.mock = haas.ext.obm.mock = -haas.ext.network_allocators.null = +#haas.ext.network_allocators.null = # Depending on what you're trying to do, you may want to use the vlan_pool # network allocator instead of the null allocator. To do this, comment out the # null allocator extension above, and uncomment the following: # -# haas.ext.network_allocators.vlan_pool = -# -# [haas.ext.network_allocators.vlan_pool] -# vlans = 100-200, 300-500 - haas.ext.auth.null = +haas.ext.network_allocators.vlan_pool = + +[haas.ext.network_allocators.vlan_pool] +vlans = 100-200, 300-500 + # Again, depending on what you're doing, you may want to change this to a # diffefrent authentication backend: -# haas.ext.auth.database = +#haas.ext.auth.database = # haas.ext.auth.keystone = # # If using the keystone backend, you'll also need to fill out this section: diff --git a/docker/runbmi.sh b/docker/runbmi.sh index 3610024..62b394c 100644 --- a/docker/runbmi.sh +++ b/docker/runbmi.sh @@ -1,3 +1,4 @@ sudo tgtd & sudo chown bmi:bmi /etc/ceph/ceph.client.admin.keyring +sudo service ssh start sleep infinity diff --git a/docker/runhil.sh b/docker/runhil.sh index 199c3c5..3f1fd29 100644 --- a/docker/runhil.sh +++ b/docker/runhil.sh @@ -1,3 +1,4 @@ -httpd & -haas serve_networks & +nohup httpd >/dev/null 2>&1 & +sleep 1 +nohup haas serve_networks >/dev/null 2>&1 & sleep infinity From 7ca8ad050e52d6eed285f0b32e76726ea81ff952 Mon Sep 17 00:00:00 2001 From: chemistry_sourabh Date: Thu, 27 Apr 2017 20:56:47 -0400 Subject: [PATCH 6/8] Update docker hil --- Dockerfile_hil | 7 ++----- docker/runhil.sh | 4 ++-- docker/wsgi.conf | 16 ---------------- 3 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 docker/wsgi.conf diff --git a/Dockerfile_hil b/Dockerfile_hil index 9818693..20878d2 100644 --- a/Dockerfile_hil +++ b/Dockerfile_hil @@ -23,10 +23,7 @@ RUN chown haas:haas /home/haas/haas.db COPY docker/runhil.sh ./runhil.sh RUN chmod a+x runhil.sh -COPY docker/wsgi.conf /etc/httpd/conf.d/wsgi.conf -RUN mkdir /var/www/haas/ -RUN cp ./haas.wsgi /var/www/haas/ +RUN cp ./haas.wsgi ./wsgi.py - -EXPOSE 80 +EXPOSE 5000 CMD dumb-init /root/hil/runhil.sh diff --git a/docker/runhil.sh b/docker/runhil.sh index 3f1fd29..2126d4c 100644 --- a/docker/runhil.sh +++ b/docker/runhil.sh @@ -1,4 +1,4 @@ -nohup httpd >/dev/null 2>&1 & +nohup gunicorn -w 5 -b 0.0.0.0:5000 wsgi:application >/dev/null 2>&1 & sleep 1 nohup haas serve_networks >/dev/null 2>&1 & -sleep infinity +sleep infinity \ No newline at end of file diff --git a/docker/wsgi.conf b/docker/wsgi.conf deleted file mode 100644 index 67fdbad..0000000 --- a/docker/wsgi.conf +++ /dev/null @@ -1,16 +0,0 @@ -LoadModule wsgi_module modules/mod_wsgi.so -WSGISocketPrefix run/wsgi - - - ServerName 172.17.0.3 - AllowEncodedSlashes On - WSGIPassAuthorization On - WSGIDaemonProcess haas user=haas group=haas threads=2 - WSGIScriptAlias / /var/www/haas/haas.wsgi - - WSGIProcessGroup haas - WSGIApplicationGroup %{GLOBAL} - Order deny,allow - Allow from all - - From 412b6442d57df1f122fe0d8ebca5f12db7a55322 Mon Sep 17 00:00:00 2001 From: chemistry_sourabh Date: Mon, 15 May 2017 01:46:01 -0400 Subject: [PATCH 7/8] Docker changes --- Dockerfile | 32 +++++++++++++++++--------------- Dockerfile_hil | 4 +++- docker/bmi_config.cfg | 19 ++++++++++++++++++- docker/haas.cfg | 2 +- docker/runhil.sh | 2 +- docker/setupdb.sh | 3 ++- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index d7ab191..e0d8a94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,15 +14,6 @@ RUN useradd -ms /bin/bash bmi RUN passwd -d bmi RUN passwd -d root RUN usermod -aG sudo bmi -USER bmi -COPY ims/ /home/bmi/ims/ -COPY tests/ /home/bmi/tests/ -COPY scripts/ /home/bmi/scripts/ -COPY setup.py /home/bmi/setup.py - -USER root -WORKDIR /home/bmi -RUN python setup.py develop RUN mkdir /etc/bmi/ RUN mkdir /var/log/bmi/ @@ -31,6 +22,7 @@ RUN mkdir /var/lib/tftpboot/pxelinux.cfg/ RUN mkdir /var/lib/bmi/ COPY docker/bmi_config.cfg /etc/bmi/bmiconfig.cfg +ENV BMI_CONFIG=/etc/bmi/bmiconfig.cfg RUN chown bmi:bmi /etc/tgt/conf.d/ RUN chown bmi:bmi /var/log/bmi/ @@ -38,23 +30,33 @@ RUN chown bmi:bmi /var/lib/tftpboot/ RUN chown bmi:bmi /var/lib/tftpboot/pxelinux.cfg/ RUN chown bmi:bmi /var/lib/bmi/ -COPY docker/runbmi.sh ./runbmi.sh -RUN chmod a+x runbmi.sh +COPY docker/runbmi.sh /home/bmi/runbmi.sh +RUN chmod a+x /home/bmi/runbmi.sh ENV HAAS_USERNAME=admin ENV HAAS_PASSWORD=admin VOLUME /etc/ceph +USER bmi +COPY ims/ /home/bmi/ims/ +COPY tests/ /home/bmi/tests/ +COPY scripts/ /home/bmi/scripts/ +COPY setup.py /home/bmi/setup.py + +USER root +WORKDIR /home/bmi +RUN python setup.py develop USER bmi RUN bmi db ls RUN sqlite3 /var/lib/bmi/bmi.db "insert into project values(1,'bmi_infra','bmi_provision')" # Dev Stuff -RUN sudo apt-get install -y openssh-server vim git -RUN sudo pip install pytest -RUN mkdir /home/bmi/.ssh -COPY docker/pubkey /home/bmi/.ssh/authorized_keys +#RUN sudo apt-get install -y openssh-server vim git +#RUN sudo pip install pytest +#RUN mkdir /home/bmi/.ssh +#COPY docker/pubkey /home/bmi/.ssh/authorized_keys + CMD dumb-init /home/bmi/runbmi.sh diff --git a/Dockerfile_hil b/Dockerfile_hil index 20878d2..109a439 100644 --- a/Dockerfile_hil +++ b/Dockerfile_hil @@ -25,5 +25,7 @@ RUN chmod a+x runhil.sh RUN cp ./haas.wsgi ./wsgi.py -EXPOSE 5000 +RUN pip install gunicorn + +EXPOSE 7000 CMD dumb-init /root/hil/runhil.sh diff --git a/docker/bmi_config.cfg b/docker/bmi_config.cfg index a50d069..7543ecc 100644 --- a/docker/bmi_config.cfg +++ b/docker/bmi_config.cfg @@ -22,7 +22,7 @@ fs = # This section is for network isolator (HIL) related config [net_isolator] -url = http://hil:80 +url = http://172.17.0.3:7000 # This section is for iscsi related config [iscsi] @@ -51,3 +51,20 @@ port = 8000 path = /var/log/bmi/ debug = True verbose = False + +[tests] +picasso_url = http://127.0.0.1:8000/ +correct_hil_username = haasadmin +correct_hil_password = admin1234 +incorrect_hil_password = admin123## + +node_name = bmi_node +nic = bmi_nic + +project = bmi_infra +network = bmi_provision + +exist_img_name = bmi_test +new_snap_name = test_snap +not_exist_snap_name = hello +not_exist_img_name = i12 diff --git a/docker/haas.cfg b/docker/haas.cfg index 8370ab6..5365ded 100644 --- a/docker/haas.cfg +++ b/docker/haas.cfg @@ -14,7 +14,7 @@ base_imgs = img1, img2, img3, img4 libvirt_endpoint = qemu:///system [client] -endpoint = http://127.0.0.1:5000 +endpoint = http://127.0.0.1:7000 [database] uri = sqlite:////home/haas/haas.db diff --git a/docker/runhil.sh b/docker/runhil.sh index 2126d4c..e7d77fd 100644 --- a/docker/runhil.sh +++ b/docker/runhil.sh @@ -1,4 +1,4 @@ -nohup gunicorn -w 5 -b 0.0.0.0:5000 wsgi:application >/dev/null 2>&1 & +nohup gunicorn -w 5 -b 0.0.0.0:7000 wsgi:application >/dev/null 2>&1 & sleep 1 nohup haas serve_networks >/dev/null 2>&1 & sleep infinity \ No newline at end of file diff --git a/docker/setupdb.sh b/docker/setupdb.sh index c3a6081..8cb787c 100644 --- a/docker/setupdb.sh +++ b/docker/setupdb.sh @@ -1,6 +1,7 @@ -haas serve 5000 & +haas serve 7000 & sleep 1 haas serve_networks & +sleep 1 haas project_create bmi_infra haas node_register bmi_node mock mock-host mock-user mock-pass haas node_register_nic bmi_node bmi_nic aa:bb:cc:dd:ee:ff From 074ca84dacbf9eaf516dbac17b6a133766c659be Mon Sep 17 00:00:00 2001 From: Sourabh Bollapragada Date: Thu, 22 Jun 2017 00:53:38 -0400 Subject: [PATCH 8/8] Changed hil version --- Dockerfile_hil | 26 ++++++++++++++++++++------ docker/haas.cfg | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Dockerfile_hil b/Dockerfile_hil index 109a439..83588bf 100644 --- a/Dockerfile_hil +++ b/Dockerfile_hil @@ -5,20 +5,33 @@ RUN yum install -y git RUN yum install -y python-devel RUN pip install dumb-init -RUN useradd -ms /bin/bash haas -WORKDIR /root +RUN useradd -ms /bin/bash hil +RUN passwd -d hil +RUN passwd -d root +RUN usermod -aG wheel hil + +WORKDIR /home/hil RUN git clone https://github.com/CCI-MOC/hil.git -WORKDIR /root/hil +WORKDIR /home/hil/hil +RUN git reset --hard 477e12097ce7f379056184d43d8f72dfcbe30b5f RUN python setup.py install COPY docker/haas.cfg /etc/haas.cfg COPY docker/haas.cfg ./haas.cfg + +USER hil RUN haas-admin db create + +USER root COPY docker/setupdb.sh ./setupdb.sh RUN chmod a+x setupdb.sh + +USER hil +ENV HAAS_ENDPOINT=http://127.0.0.1:7000 RUN ./setupdb.sh -RUN chmod 666 /home/haas/haas.db -RUN chown haas:haas /home/haas/haas.db +USER root +RUN chmod 666 /home/hil/haas.db +RUN chown hil:hil /home/hil/haas.db COPY docker/runhil.sh ./runhil.sh RUN chmod a+x runhil.sh @@ -28,4 +41,5 @@ RUN cp ./haas.wsgi ./wsgi.py RUN pip install gunicorn EXPOSE 7000 -CMD dumb-init /root/hil/runhil.sh +USER hil +CMD dumb-init /home/hil/hil/runhil.sh diff --git a/docker/haas.cfg b/docker/haas.cfg index 5365ded..93397d9 100644 --- a/docker/haas.cfg +++ b/docker/haas.cfg @@ -17,7 +17,7 @@ libvirt_endpoint = qemu:///system endpoint = http://127.0.0.1:7000 [database] -uri = sqlite:////home/haas/haas.db +uri = sqlite:////home/hil/haas.db #uri = postgresql://:@
/ [devel]