Skip to content

Commit d0987e5

Browse files
authored
Remove ION from ANMS images (#231)
* Remove ION from ANMS container images. Only present in testenv. * tweaking health status * reducing image context * Remove inconsistently used DOCKER_CTR_PREFIX variable * Update and expand checkout test * Add REFDM roundtrip test case
1 parent bfebf97 commit d0987e5

File tree

18 files changed

+349
-505
lines changed

18 files changed

+349
-505
lines changed

.dockerignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SCM files
2+
.git/
3+
.gitignore
4+
5+
# Ignore IDE/IntelliJ Files
6+
.idea
7+
*.iml
8+
9+
# Ignore build files
10+
node_modules
11+
/puppet/.modules
12+
# Ignore Compiled Vue App
13+
/anms-ui/release
14+
# Ignore Data Directory
15+
/anms-ui/logs
16+
17+
# Ignore Other Specific Stuff
18+
*-compose.yaml
19+
Containerfile
20+
Dockerfile
21+
Makefile
22+
.dockerignore
23+
gl-sast-report.json
24+
.metrics-dashboard.yml
25+
*.md
26+
*.pdf
27+
*.docx

.env

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#MQTT_PORT=11883
88

99

10-
11-
DOCKER_CTR_PREFIX=
1210
DOCKER_IMAGE_PREFIX=localhost/
1311
DOCKER_IMAGE_TAG=latest
1412

@@ -34,8 +32,8 @@ DB_HEALTHCHECK_USER=healthcheck
3432
DB_HEALTHCHECK_PASSWORD=healthcheck
3533

3634
GRAFANA_CONTAINER_PORT=3000
37-
GRAFANA_HOST_PORT=${DOCKER_CTR_PREFIX}grafana:${GRAFANA_CONTAINER_PORT}
38-
GRAFANA_PROXIES_PATH=localhost/${DOCKER_CTR_PREFIX}grafana
35+
GRAFANA_HOST_PORT=grafana:${GRAFANA_CONTAINER_PORT}
36+
GRAFANA_PROXIES_PATH=localhost/grafana
3937
REDIS_PORT=6379
4038
JS_AMP_PORT=3001
4139
ANMS_UI_HTTP_PORT=9030
@@ -48,7 +46,7 @@ LOGSTASH_MONITORING_PORT=9600
4846
KIBANA_PORT=5601
4947
ADMINER_PORT=8080
5048
RENDERER_PORT=8081
51-
RENDERER_HOST_PORT=${DOCKER_CTR_PREFIX}grafana-image-renderer:${RENDERER_PORT}
49+
RENDERER_HOST_PORT=grafana-image-renderer:${RENDERER_PORT}
5250
ION_MGR_PORT=8089
5351
HTTP_PORT=80
5452

.github/workflows/build-test.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
name: Checkout Test (${{matrix.ctrmgr}})
1818
env:
1919
AUTHNZ_EMU: "demo"
20-
ANMS_COMPOSE_OPTS: "-f docker-compose.yml --profile=full"
20+
COMPOSE_PROFILES: "full"
21+
ANMS_COMPOSE_OPTS: "-f docker-compose.yml"
2122
TESTENV_COMPOSE_OPTS: "-f testenv-compose.yml"
2223
DOCKER_CMD: ${{matrix.ctrmgr}}
2324
AUTHNZ_PORT: 8084
@@ -43,7 +44,7 @@ jobs:
4344
echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}" >> $GITHUB_ENV
4445
- name: Build ANMS
4546
run: |
46-
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build builder-base builder-init builder-acelib
47+
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build builder-base builder-acelib
4748
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build
4849
- name: Build Agents
4950
run: ${DOCKER_CMD} compose ${TESTENV_COMPOSE_OPTS} build
@@ -59,6 +60,7 @@ jobs:
5960
${DOCKER_CMD} compose ${TESTENV_COMPOSE_OPTS} up -d --force-recreate
6061
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} up -d --force-recreate --wait --wait-timeout 600
6162
- name: Status
63+
if: always()
6264
run: |
6365
for BADSTATUS in stopped restarting; do
6466
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} ps --services --filter status=${BADSTATUS} | tee -a /tmp/notgood
@@ -70,14 +72,7 @@ jobs:
7072
# Fail if any names are in the file
7173
! grep '[^[:space:]]' /tmp/notgood
7274
- name: Test
73-
run: |
74-
# Checkout the running gateway+backend
75-
${DOCKER_CMD} build -t checkout-test checkout-test
76-
${DOCKER_CMD} run --network anms -v $PWD:/mnt \
77-
-e XUNIT_OUTFILE=/mnt/testresults.xml \
78-
-e CHECKOUT_BASE_URL=http://authnz/ \
79-
-e SSL_CERT_FILE=/mnt/puppet/modules/apl_test/files/anms/tls/certs/ammos-ca-bundle.crt \
80-
checkout-test
75+
run: ./checkout-test/run.sh
8176
- name: Stop
8277
if: always()
8378
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
.DS_Store
88
.project
99
.cproject
10+
.pydevproject
11+
.settings/
1012

1113
# Python intermediates
1214
__pycache__

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ To restart the system, use the 'up' and 'down' commands as described in the prev
126126

127127
The top-level `docker-compose.yml` uses the environment defined by the sibling file `.env`. Note: If using the legacy/deprecated build.sh script, that script may additionally override some environment variables.
128128

129-
Two principal options of the compose configuration, which are both defaulted to empty text, are:
129+
The principal options of the compose configuration are:
130130

131131
* `DOCKER_IMAGE_PREFIX` which controls any image name prefix added to all ANMS images.
132132
For a local build, this can be left empty, but for builds intended to be pushed to a Docker image registry this can be set to the full path on the registry before the image names (e.g. `DOCKER_IMAGE_PREFIX=some.host.example.com:5000/path/to/images`).
133-
133+
* `HOST_SOCKDIR` which controls the source of the bind mount on `amp-manager` container for its transport socket. This can either be a volume name, for inter-container or non-root user use, or an absolute path on the host filesystem, used in the production deployment.
134134

135135

136136
### AMP Database Querying

base.Dockerfile

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ ENV APP_USER=anms
3939
RUN groupadd -r -g 9999 ${APP_USER} && \
4040
useradd -m -r -g ${APP_USER} -u 9999 ${APP_USER}
4141

42-
43-
# This image uses systemd init process to manage local services.
44-
# Derived image targets choose which servies are enabled.
45-
#
46-
FROM registry.access.redhat.com/ubi9/ubi-init:9.2 AS anms-init
47-
48-
# Optional APL network configuration from
49-
# https://aplprod.servicenowservices.com/sp?id=kb_article&sys_id=c0de6fe91b83d85071b143bae54bcb34
50-
RUN ( \
51-
curl -sL http://apllinuxdepot.jhuapl.edu/linux/APL-root-cert/JHUAPL-MS-Root-CA-05-21-2038-B64-text.cer -o /etc/pki/ca-trust/source/anchors/JHUAPL-MS-Root-CA-05-21-2038-B64-text.crt && \
52-
update-ca-trust && \
53-
echo "Root CA added" \
54-
) || true
55-
ENV PIP_CERT=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
56-
ENV PIP_DEFAULT_TIMEOUT=300
57-
RUN dnf -y install container-tools
58-
# Container service config
59-
RUN systemctl disable dnf-makecache.timer
60-
61-
6242
# This image includes common libraries used by the aricodec and anms-core
6343
# containers.
6444
# Sets environment:

checkout-test/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ FROM localhost/anms-base
2626
RUN --mount=type=cache,target=/var/cache/yum \
2727
dnf install -y iputils python3 python3-pip python3-wheel
2828

29-
COPY requirements.txt /usr/src/checkout-test/
29+
COPY requirements.txt /usr/local/src/checkout-test/
3030
RUN --mount=type=cache,target=/root/.cache/pip \
31-
pip3 install -r /usr/src/checkout-test/requirements.txt
32-
COPY . /usr/src/checkout-test
31+
pip3 install -r /usr/local/src/checkout-test/requirements.txt
32+
COPY *.sh *.py /usr/local/src/checkout-test
3333

3434
# First argument is the base URL to test
35-
ENTRYPOINT ["/usr/src/checkout-test/run.sh"]
35+
ENTRYPOINT ["/usr/local/src/checkout-test/entrypoint.sh"]

checkout-test/entrypoint.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
##
3+
## Copyright (c) 2023 The Johns Hopkins University Applied Physics
4+
## Laboratory LLC.
5+
##
6+
## This file is part of the Asynchronous Network Management System (ANMS).
7+
##
8+
## Licensed under the Apache License, Version 2.0 (the "License");
9+
## you may not use this file except in compliance with the License.
10+
## You may obtain a copy of the License at
11+
## http://www.apache.org/licenses/LICENSE-2.0
12+
## Unless required by applicable law or agreed to in writing, software
13+
## distributed under the License is distributed on an "AS IS" BASIS,
14+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
## See the License for the specific language governing permissions and
16+
## limitations under the License.
17+
##
18+
## This work was performed for the Jet Propulsion Laboratory, California
19+
## Institute of Technology, sponsored by the United States Government under
20+
## the prime contract 80NM0018D0004 between the Caltech and NASA under
21+
## subcontract 1658085.
22+
##
23+
24+
# Run similar to:
25+
# COMPOSE_PROFILES=full CHECKOUT_BASE_URL=https://authnz/ ./entrypoint.sh
26+
set -e
27+
28+
export COMPOSE_PROFILES
29+
export CHECKOUT_BASE_URL
30+
31+
SELFDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
32+
TIMELIMIT=30
33+
34+
CURLOPTS=""
35+
if [ -n "${SSL_CERT_FILE}" ]
36+
then
37+
echo "Using custom CA from ${SSL_CERT_FILE}"
38+
CURLOPTS="${CURLOPTS} --cacert ${SSL_CERT_FILE}"
39+
fi
40+
41+
if [ -z "${CHECKOUT_BASE_URL}" ]; then
42+
echo "Must define CHECKOUT_BASE_URL environment"
43+
exit 1
44+
fi
45+
echo "Waiting for ${CHECKOUT_BASE_URL} to be available..."
46+
for IX in $(seq ${TIMELIMIT}); do
47+
if curl -sSl $CURLOPTS "${CHECKOUT_BASE_URL}" >/dev/null; then
48+
break
49+
fi
50+
if [ ${IX} -eq ${TIMELIMIT} ]; then
51+
echo "No HTTP access after ${IX} seconds!"
52+
exit 1
53+
fi
54+
sleep 1
55+
done
56+
echo
57+
58+
echo "Running tests..."
59+
TESTARGS="--verbose"
60+
if [ -n "${XUNIT_OUTFILE}" ]; then
61+
TESTARGS="${TESTARGS} --junitxml=${XUNIT_OUTFILE}"
62+
fi
63+
python3 -m pytest ${TESTARGS} "${SELFDIR}" "$@"

checkout-test/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ requests
33
websockets
44
werkzeug
55
sslscan
6+
cryptography
7+
pyopenssl

checkout-test/run.sh

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,14 @@
2121
## subcontract 1658085.
2222
##
2323

24-
# Run similar to:
25-
# CHECKOUT_BASE_URL=http://authnz-emu/ ./run.sh
26-
set -e
24+
# Checkout the running gateway+backend by attaching to the 'anms' network
2725

28-
export CHECKOUT_BASE_URL
29-
SELFDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
30-
TIMELIMIT=30
26+
DOCKER_CMD=${DOCKER_CMD:-docker}
3127

32-
CURLOPTS=""
33-
if [ -n "${SSL_CERT_FILE}" ]
34-
then
35-
CURLOPTS="${CURLOPTS} --cacert ${SSL_CERT_FILE}"
36-
fi
37-
38-
if [ -z "${CHECKOUT_BASE_URL}" ]; then
39-
echo "Must define CHECKOUT_BASE_URL environment"
40-
exit 1
41-
fi
42-
echo "Waiting for ${CHECKOUT_BASE_URL} to be available..."
43-
for IX in $(seq ${TIMELIMIT}); do
44-
if curl -sSl $CURLOPTS "${CHECKOUT_BASE_URL}" >/dev/null; then
45-
break
46-
fi
47-
if [ ${IX} -eq ${TIMELIMIT} ]; then
48-
echo "No HTTP access after ${IX} seconds!"
49-
exit 1
50-
fi
51-
sleep 1
52-
done
53-
echo
54-
55-
echo "Running tests..."
56-
TESTARGS="--verbose"
57-
if [ -n "${XUNIT_OUTFILE}" ]; then
58-
TESTARGS="${TESTARGS} --junitxml=${XUNIT_OUTFILE}"
59-
fi
60-
python3 -m pytest ${TESTARGS} "${SELFDIR}"
28+
${DOCKER_CMD} build -t checkout-test checkout-test
29+
${DOCKER_CMD} run --network anms -v $PWD:/mnt \
30+
-e XUNIT_OUTFILE=/mnt/testresults.xml \
31+
-e COMPOSE_PROFILES=${COMPOSE_PROFILES} \
32+
-e CHECKOUT_BASE_URL=https://authnz/ \
33+
-e SSL_CERT_FILE=/mnt/puppet/modules/apl_test/files/anms/tls/certs/ammos-ca-bundle.crt \
34+
checkout-test "$@"

0 commit comments

Comments
 (0)