Skip to content

Commit

Permalink
tests: attempt to configure HTTPS comms for the test battery
Browse files Browse the repository at this point in the history
* Add a new docker image with cylc-uiserver/cylc-hub installed.
* Start the hub on a configured port.
  • Loading branch information
oliver-sanders authored and dwsutherland committed Feb 1, 2023
1 parent 9c31e85 commit 0a4231f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
28 changes: 28 additions & 0 deletions dockerfiles/cylc-uiserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

FROM cylc-dev

LABEL version="1.0" \
description="Cylc with with UIS / hub installed."

# TODO: this installs from master, we we are on a maintainance branch we will
# need to pick an appropriate UIS branch
RUN . $HOME/.bashrc && \
pip install "cylc-uiserver[hub] @ git+https://github.com/cylc/cylc-uiserver"

ENTRYPOINT . $HOME/.bashrc && \
cylc hub --port=8042
21 changes: 19 additions & 2 deletions etc/bin/swarm
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Port Mapping:
Comms Method:
* +0 - "tcp" & "ssh"
* +1 - "poll"
* +2 - "https"
__USAGE__
exit 0
}
Expand Down Expand Up @@ -246,16 +247,25 @@ fi
POLL_OPTS=(
'-e' 'HOST_HOSTNAME=false'
)

# docker run opts for HTTPS/hub comms
HTTPS_OPTS=(
# expose the hub port in the image (hardcoded) to the host OS
'-p' '44000:8042'
"${TCP_OPTS[@]}"
)

# the lowest port to use for communicating with containers
BASE_PORT=42220

# wrapper for running containers with the required options
_run () {
# run a container
local fs="$1" # i.e. indep, shared
local comms="$2" # i.e. tcp, poll
local comms="$2" # i.e. tcp, poll, https
local detached="${3:-false}" # i.e. true, false
local port
local image='cylc-remote:latest'

# set the detach args
local opts=()
Expand Down Expand Up @@ -283,6 +293,10 @@ _run () {
elif [[ $comms == poll ]]; then
opts+=("${POLL_OPTS[@]}")
(( port += 1 ))
elif [[ $comms == https ]]; then
opts+=("${HTTPS_OPTS[@]}")
(( port += 2 ))
image='cylc-uiserver:latest'
else
echo "invalid comms method '$comms'" >&2
exit 1
Expand All @@ -294,7 +308,7 @@ _run () {
-t --privileged \
-p "$port:22" \
"${opts[@]}" \
cylc-remote:latest
"${image}"
}

# build all docker images
Expand All @@ -305,6 +319,9 @@ build () {
docker build . \
-f dockerfiles/cylc-remote/Dockerfile \
-t cylc-remote:latest
docker build . \
-f dockerfiles/cylc-uiserver/Dockerfile \
-t cylc-uiserver:latest
}

# configure the system so we can use these images as cylc platforms
Expand Down
12 changes: 12 additions & 0 deletions etc/conf/global.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[[_local_background_indep_tcp]]
hosts = localhost
install target = localhost

[[_remote_background_indep_tcp]]
hosts = _remote_background_indep_tcp
#[[_remote_background_indep_ssh]]
Expand All @@ -16,6 +17,7 @@
# NOTE: at submission uses the same container as background
job runner = at
hosts = _remote_background_indep_tcp

[[_remote_background_indep_poll]]
hosts = _remote_background_indep_poll
communication method = poll
Expand All @@ -28,6 +30,16 @@
communication method = poll
execution polling intervals = 5*PT1S, PT5S
submission polling intervals = PT3S

[[_remote_background_indep_https]]
hosts = _remote_background_indep_https
communication method = https
[[_remote_at_indep_https]]
# NOTE: at submission uses the same container as background
job runner = at
hosts = _remote_background_indep_https
communication method = https

#[[_remote_background_shared_tcp]]
# hosts = _remote_background_shared_tcp
#[[_remote_background_shared_ssh]]
Expand Down
3 changes: 3 additions & 0 deletions etc/conf/ssh_config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Host _remote_background_indep_ssh
Host _remote_background_indep_poll
Port 42221

Host _remote_background_indep_https
Port 42222

Host _remote_background_shared_tcp
Port 42230

Expand Down

0 comments on commit 0a4231f

Please sign in to comment.