Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions ci/docker_sources/hil_container/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we copying it to three places?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this, only need it in two places


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
36 changes: 36 additions & 0 deletions ci/docker_sources/hil_container/hil.cfg
Original file line number Diff line number Diff line change
@@ -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://<username>:<password>@<address>/<dbname>

[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
4 changes: 4 additions & 0 deletions ci/docker_sources/hil_container/runhil.sh
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions ci/docker_sources/hil_container/setupdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export HIL_USERNAME=haasadmin

export HIL_PASSWORD=admin1234

hil-admin run-dev-server -p 7000 &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of confused, why are you running it here again when you already run gunicorn on port 7000 in runhi.sh

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is just to turn on hil so the database could get setup. I've tried to keep it close as possible to the old hil container setup too

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this complain that the something is already running on port 7000?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well this bit gets run before the gunicorn server, so it should be the gunicorn one that's complaining. Since we throw out the output though I think we just don't see it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. I am fine with either running the flasks' built-in dev server (using the hil-admin command) or the gunicorn server. But we shouldn't run both because it leads to confusion and only one will fail anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I address this in the thread above, but these commands in setupdb get killed somewhere along the way before gunicorn & the second serve-networks call

@ianballou ianballou Oct 12, 2018

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah probably has to do with why runhil.sh has the sleep infinity in it. I think when setupdb.sh exits even though there's the & it kills the servers.
Edit: might also be when I switch users the terminal closes


sleep 5

hil-admin serve-networks &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing with this guy.


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