diff --git a/ci/docker_sources/hil_container/Dockerfile b/ci/docker_sources/hil_container/Dockerfile new file mode 100644 index 0000000..fed26de --- /dev/null +++ b/ci/docker_sources/hil_container/Dockerfile @@ -0,0 +1,69 @@ +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 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 -b v0.3 + +WORKDIR /home/hil/hil + +RUN pip install --upgrade pip setuptools + +RUN python setup.py install + +COPY hil.cfg /etc/hil.cfg + +COPY hil.cfg /home/hil/hil + +USER hil + +RUN hil-admin db create + +USER root + +RUN chmod 666 /home/hil/hil.db + +RUN chown hil:hil /home/hil/hil.db + +COPY setupdb.sh setupdb.sh + +RUN chmod a+x setupdb.sh + +USER hil + +ENV HIL_ENDPOINT=http://127.0.0.1:7000 + +RUN source ./setupdb.sh + +USER root + +RUN cp hil.wsgi wsgi.py + +RUN pip install gunicorn + +COPY runhil.sh runhil.sh + +RUN chmod a+x runhil.sh + +EXPOSE 7000 + +user hil + +CMD dumb-init /home/hil/hil/runhil.sh diff --git a/ci/docker_sources/hil_container/hil.cfg b/ci/docker_sources/hil_container/hil.cfg new file mode 100644 index 0000000..778bae0 --- /dev/null +++ b/ci/docker_sources/hil_container/hil.cfg @@ -0,0 +1,36 @@ +[general] +log_level = debug + +[auth] +require_authentication = True + +[headnode] +trunk_nic = eth0 +base_imgs = img1, img2, img3, img4 +libvirt_endpoint = qemu:///system + +[client] +endpoint = http://127.0.0.1:7000 + +[database] +uri = sqlite:////home/hil/hil.db +#uri = postgresql://:@
/ + +[devel] +dry_run=True + +[extensions] +hil.ext.switches.mock = +hil.ext.obm.mock = + +#hil.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: +# +hil.ext.auth.database = +hil.ext.network_allocators.vlan_pool = + +[hil.ext.network_allocators.vlan_pool] +vlans = 100-200, 300-500 diff --git a/ci/docker_sources/hil_container/runhil.sh b/ci/docker_sources/hil_container/runhil.sh new file mode 100644 index 0000000..e510ba4 --- /dev/null +++ b/ci/docker_sources/hil_container/runhil.sh @@ -0,0 +1,4 @@ +nohup gunicorn -w 5 -b 0.0.0.0:7000 wsgi:application >/dev/null 2>&1 & +sleep 1 +nohup hil-admin serve-networks >/dev/null 2>&1 & +sleep infinity diff --git a/ci/docker_sources/hil_container/setupdb.sh b/ci/docker_sources/hil_container/setupdb.sh new file mode 100644 index 0000000..c534dc8 --- /dev/null +++ b/ci/docker_sources/hil_container/setupdb.sh @@ -0,0 +1,33 @@ +export HIL_USERNAME=haasadmin + +export HIL_PASSWORD=admin1234 + +hil-admin run-dev-server -p 7000 & + +sleep 5 + +hil-admin serve-networks & + +sleep 5 + +hil-admin create-admin-user haasadmin admin1234 + +hil project create bmi_infra + +hil node register bmi_node mock mock-host mock-user mock-pass + +hil node nic register bmi_node bmi_nic aa:bb:cc:dd:ee:ff + +hil network create bmi_provision bmi_infra + +hil project node add bmi_infra bmi_node + +hil switch register bmi_switch mock mockhost mockuser mockpass + +hil port register bmi_switch gi1/0/1 + +hil port nic add bmi_switch gi1/0/1 bmi_node bmi_nic + +hil node show bmi_node + +hil network show bmi_provision