Skip to content

Commit 62dc15e

Browse files
BrianSiposDavid Linko
andauthored
Added parallel light compose config (#196)
* Added parallel light compose config. Refactored all ION to outside of ANMS deployment. * updated sockdir for amp-manager and ion-manger to and external volume * Move host mount source to env config * Update README.md --------- Co-authored-by: David Linko <david.linko@jhuapl.edu>
1 parent 2c1dd22 commit 62dc15e

File tree

10 files changed

+396
-162
lines changed

10 files changed

+396
-162
lines changed

.env

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ RENDERER_PORT=8081
5151
RENDERER_HOST_PORT=${DOCKER_CTR_PREFIX}grafana-image-renderer:${RENDERER_PORT}
5252
ION_MGR_PORT=8089
5353
HTTP_PORT:80
54-
SOCKDIR=/var/tmp/nm
54+
55+
# Path (or volume name) on the host
56+
HOST_SOCKDIR=sockdir
57+
# Mount path on the containers
58+
CTR_SOCKDIR=/var/tmp/nm
5559

5660
ADM_PATH=deps/dtnma-adms

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
*~
55
#*
66
.#*
7+
.DS_Store
8+
.project
9+
.cproject
710

811
# Python intermediates
912
__pycache__
@@ -21,7 +24,3 @@ node_modules
2124
package-lock.json
2225

2326
ion/configs/**/logs
24-
25-
docker_data/grafana_vol
26-
27-
.DS_Store

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,27 @@ Choose the appropriate docker, podman or podman-compose commands in the directio
8787
- Clone this repository recursively (`git clone --recursive https://github.com/NASA-AMMOS/anms.git`)
8888
- Setup Volume containing PKI configuration (certificate chains and private keys):
8989
- `./create_volume.sh ./puppet/modules/apl_test/files/anms/tls`
90-
- Build Core Images using either:
91-
- `docker compose build`
92-
- `podman compose build`
93-
- `podman-compose --podman-build-args='--format docker' build`
90+
- Build Core Images using one of the following:
91+
- `docker compose -f docker-compose.yml build`
92+
- `podman compose -f docker-compose.yml build`
93+
- `podman-compose --podman-build-args='--format docker' -f docker-compose.yml build`
9494
- Note: The docker format argument here enables suppoort for HEALTHCHECK. If omitted, the system will run but will be unable to report the health of the system. This flag does not appear necessary when using the no-dash version of compose.
95-
- Build Agent images
95+
- Build test environemnt images using one of the following:
9696
- `docker compose -f testenv-compose.yml build`
9797
- `podman compose -f testenv-compose.yml build`
98-
- `podman-compose -f testenv-compose.yml --podman-build-args='--format docker' build`
99-
- Start System. Note: You may omit the `-d` argument to keep logs in the foreground.
100-
- `docker compose up -d`
101-
- `podman compose up -d`
102-
- Start additional ION Agent Nodes
98+
- `podman-compose --podman-build-args='--format docker' -f testenv-compose.yml build`
99+
- Start System using one of the following:
100+
- `docker compose -f docker-compose.yml up -d`
101+
- `podman compose -f docker-compose.yml up -d`
102+
- Start ION nodes for manager and test agents using one of the following:
103103
- `docker compose -f testenv-compose.yml up -d`
104104
- `podman compose -f testenv-compose.yml up -d`
105105

106+
### Alternative "light" Deployment
107+
108+
In the above steps, replacing `docker-compose.yml` with `light-compose.yml` will cause a "light" deployment of the ANMS focused on browser-less API-only ANMS users.
109+
This compose config is explained in more detail in the ANMS Product Guide, but simply removes containers that only support web-browser user agents.
110+
106111
### Alternative Build.sh setup script (deprecated, docker-only)
107112
The ANMS repository contains a build script which will build and run multiple Docker containers.
108113
These containers comprise the ANMS software and services, including demonstration AMP agents running on non-ANMS containers.

create_volume.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ do
4545
done
4646

4747
${DOCKER_CMD} stop ${CTRNAME} >/dev/null
48+
49+
# creating socket volume
50+
${DOCKER_CMD} volume create sockdir

deps/reftools.Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ COPY --chmod=755 dtnma-tools/systemd/service_is_running.sh /usr/local/bin/servic
106106
# Test tools
107107
RUN apt-get update && apt-get install -y \
108108
curl git tshark postgresql-client
109-
RUN pip3 install --break-system-packages git+https://github.com/JHUAPL-DTNMA/dtnma-ace.git@apl-fy24
110-
RUN git clone --branch apl-fy24 https://github.com/JHUAPL-DTNMA/dtnma-adms.git /usr/local/share/ace/adms
111109

112110
# REFDA and REFDM to test
113111
RUN apt-get update && apt-get install -y \
@@ -146,6 +144,7 @@ EXPOSE 8089/tcp
146144
HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \
147145
CMD ["service_is_running", "refdm-proxy"]
148146

147+
149148
FROM testenv AS ion-manager
150149

151150
# Systemd services
@@ -158,6 +157,8 @@ RUN systemctl enable ion bpecho@4 ion-app-proxy dumpcap && \
158157
# Runtime config for this container
159158
COPY dtnma-tools/integration-test-ion/node-*.rc /etc/ion/
160159
COPY test-ion-configs/mgr.rc etc/ion/
160+
161+
EXPOSE 1113/udp
161162
EXPOSE 4556/udp
162163

163164
HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \
@@ -180,6 +181,7 @@ COPY test-ion-configs/agent-3.rc /etc/ion/node-3.rc
180181
# COPY test-ion-configs/agent-2.rc etc/ion/
181182
# COPY test-ion-configs/agent-3.rc etc/ion/
182183

184+
EXPOSE 1113/udp
183185
EXPOSE 4556/udp
184186

185187
HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \

docker-compose.yml

Lines changed: 52 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,18 @@ name: anms
3030
networks:
3131
default:
3232
name: ${DOCKER_CTR_PREFIX}anms
33-
attachable: true
3433
driver_opts:
3534
com.docker.network.bridge.name: br-${DOCKER_CTR_PREFIX}anms
3635
com.docker.network.driver.mtu: 65535
37-
ipam:
38-
config:
39-
- subnet: 10.5.0.0/16
40-
gateway: 10.5.0.1
36+
4137
volumes:
4238
grafana-data: {}
4339
postgres-data: {}
4440
opensearch: {}
4541
ammos-tls:
4642
external: true
4743
sockdir:
48-
# shared sockets
49-
44+
external: true
5045

5146
services:
5247
builder-base:
@@ -88,8 +83,7 @@ services:
8883
AGENT_NAME: ${CAM_AGENT_NAME}
8984
AGENT_PASSWORD: ${CAM_AGENT_PASSWORD}
9085
CAM_GW_URL: "https://${ANMS_GW_FQDN}:443/"
91-
PROXY_URLS: "core,http://anms-core:5555 grafana,http://grafana:3000 grafana/api/live,http://grafana:3000 renderer,http://grafana-image-renderer:8081 adminer,http://adminer:8080 nm,http://ion-manager:8089 http://anms-ui:9030"
92-
NOT_ENFORCED_URLS: "http://nginx/favicon.ico"
86+
PROXY_URLS: "core,http://anms-core:5555 grafana,http://grafana:3000 grafana/api/live,http://grafana:3000 renderer,http://grafana-image-renderer:8081 adminer,http://adminer:8080 nm,http://amp-manager:8089 http://anms-ui:9030"
9387
volumes:
9488
- ammos-tls:/ammos/etc/pki/tls:ro
9589

@@ -179,50 +173,6 @@ services:
179173
mqtt-broker:
180174
condition: service_healthy
181175

182-
grafana:
183-
hostname: grafana
184-
image: ${DOCKER_IMAGE_PREFIX}anms-grafana:${DOCKER_IMAGE_TAG}
185-
build:
186-
# NOTE: Custom image currently needed only for SSL-cert purposes
187-
context: grafana
188-
restart: unless-stopped
189-
security_opt:
190-
- "label=type:grafana.process"
191-
ports:
192-
- "${GRAFANA_PORT:-3000}:3000"
193-
depends_on:
194-
- grafana-image-renderer
195-
environment:
196-
- GF_RENDERING_SERVER_URL=http://${RENDERER_HOST_PORT}/render
197-
- GF_RENDERING_CALLBACK_URL=http://${GRAFANA_HOST_PORT}/
198-
- GF_SERVER_ROOT_URL=http://${ANMS_GW_FQDN}/grafana/
199-
volumes:
200-
- "grafana-data:/var/lib/grafana"
201-
202-
grafana-image-renderer:
203-
hostname: grafana-image-renderer
204-
image: docker.io/grafana/grafana-image-renderer
205-
restart: unless-stopped
206-
security_opt:
207-
- "label=type:grafana-image-renderer.process"
208-
ports:
209-
- "${RENDERER_PORT:-8081}:8081"
210-
211-
redis:
212-
hostname: redis
213-
image: docker.io/library/redis:6.0-alpine
214-
restart: unless-stopped
215-
security_opt:
216-
- "label=type:redis.process"
217-
ports:
218-
- "${REDIS_PORT:-6379}:6379"
219-
healthcheck:
220-
test: ["CMD", "redis-cli" ,"-h", "localhost", "ping"]
221-
interval: 15s
222-
timeout: 60s
223-
retries: 5
224-
command: redis-server --databases 1 --bind 0.0.0.0 --port ${REDIS_PORT:-6379}
225-
226176
aricodec:
227177
hostname: aricodec
228178
image: ${DOCKER_IMAGE_PREFIX}aricodec:${DOCKER_IMAGE_TAG}
@@ -272,6 +222,51 @@ services:
272222
DB_PASSWORD: ${DB_PASSWORD}
273223
DB_NAME: ${DB_NAME}
274224
REDIS_URI_HOSTNAME: redis
225+
226+
grafana:
227+
hostname: grafana
228+
image: ${DOCKER_IMAGE_PREFIX}anms-grafana:${DOCKER_IMAGE_TAG}
229+
build:
230+
# NOTE: Custom image currently needed only for SSL-cert purposes
231+
context: grafana
232+
restart: unless-stopped
233+
security_opt:
234+
- "label=type:grafana.process"
235+
ports:
236+
- "${GRAFANA_PORT:-3000}:3000"
237+
depends_on:
238+
- grafana-image-renderer
239+
environment:
240+
- GF_RENDERING_SERVER_URL=http://${RENDERER_HOST_PORT}/render
241+
- GF_RENDERING_CALLBACK_URL=http://${GRAFANA_HOST_PORT}/
242+
- GF_SERVER_ROOT_URL=http://${ANMS_GW_FQDN}/grafana/
243+
volumes:
244+
- "grafana-data:/var/lib/grafana"
245+
246+
grafana-image-renderer:
247+
hostname: grafana-image-renderer
248+
image: docker.io/grafana/grafana-image-renderer
249+
restart: unless-stopped
250+
security_opt:
251+
- "label=type:grafana-image-renderer.process"
252+
ports:
253+
- "${RENDERER_PORT:-8081}:8081"
254+
255+
redis:
256+
hostname: redis
257+
image: docker.io/library/redis:6.0-alpine
258+
restart: unless-stopped
259+
security_opt:
260+
- "label=type:redis.process"
261+
ports:
262+
- "${REDIS_PORT:-6379}:6379"
263+
healthcheck:
264+
test: ["CMD", "redis-cli" ,"-h", "localhost", "ping"]
265+
interval: 15s
266+
timeout: 60s
267+
retries: 5
268+
command: redis-server --databases 1 --bind 0.0.0.0 --port ${REDIS_PORT:-6379}
269+
275270
anms-core:
276271
hostname: anms-core
277272
image: ${DOCKER_IMAGE_PREFIX}anms-core:${DOCKER_IMAGE_TAG}
@@ -295,22 +290,13 @@ services:
295290
builder-acelib:
296291
# Not expected to run, but needed here to ensure build dependency
297292
condition: service_started
298-
ion-manager:
293+
amp-manager:
299294
condition: service_started
300295
postgres:
301296
condition: service_healthy
302297
mqtt-broker:
303298
condition: service_healthy
304299

305-
adminer:
306-
hostname: adminer
307-
image: docker.io/library/adminer:latest
308-
restart: unless-stopped
309-
security_opt:
310-
- "label=type:adminer.process"
311-
ports:
312-
- "${ADMINER_PORT:-8080}:8080"
313-
314300
amp-manager:
315301
hostname: amp-manager
316302
build:
@@ -322,94 +308,21 @@ services:
322308
depends_on:
323309
postgres:
324310
condition: service_healthy
325-
ion-manager:
326-
condition: service_started
311+
# no strict dependence on testenv, but operational dependence
327312
privileged: true
328313
tty: true
329314
cap_add:
330315
- NET_ADMIN
331316
- NET_RAW
332317
- SYS_NICE
333318
volumes:
334-
- "sockdir:${SOCKDIR}"
319+
- "${HOST_SOCKDIR}:${CTR_SOCKDIR}"
335320
environment:
336321
container: docker
337322
DTNMA_LOGLEVEL: debug
338-
AMP_PROXY_SOCKET: "${SOCKDIR}/proxy.sock"
323+
AMP_PROXY_SOCKET: "${CTR_SOCKDIR}/proxy.sock"
339324
DB_HOST: postgres
340325
DB_USER: ${DB_USER}
341326
DB_PASSWORD: ${DB_PASSWORD}
342327
DB_NAME: ${DB_NAME}
343328

344-
ion-manager:
345-
hostname: ion-manager
346-
build:
347-
context: deps
348-
dockerfile: reftools.Dockerfile
349-
target: ion-manager
350-
depends_on: {}
351-
privileged: true
352-
tty: true
353-
cap_add:
354-
- NET_ADMIN
355-
- NET_RAW
356-
- SYS_NICE
357-
volumes:
358-
- "/var/tmp/pcap:/var/log/pcap"
359-
- "sockdir:${SOCKDIR}"
360-
environment:
361-
container: docker
362-
DTNMA_LOGLEVEL: debug
363-
AMP_PROXY_SOCKET: "${SOCKDIR}/proxy.sock"
364-
ION_NODE_NUM: 1
365-
MGR_NODE_NUM: 1
366-
DUMPCAP_OUTFILE: /var/log/pcap/manager.pcap
367-
DUMPCAP_OPTS: -i lo -i eth0
368-
networks:
369-
default:
370-
ipv4_address: 10.5.0.101
371-
372-
# ion-manager:
373-
# hostname: ion-manager
374-
# image: ${DOCKER_IMAGE_PREFIX}ion-manager:${DOCKER_IMAGE_TAG}
375-
# build:
376-
# context: deps
377-
# dockerfile: reftools.Dockerfile
378-
# target: ion-manager
379-
# restart: unless-stopped
380-
# security_opt:
381-
# - "label=type:ion-manager.process"
382-
# ports:
383-
# - "1113:1113/udp"
384-
# - "4556:4556/udp"
385-
# - "${ION_MGR_PORT:-8089}:8089"
386-
# networks:
387-
# default:
388-
# ipv4_address: 10.5.0.101
389-
# extra_hosts:
390-
# - ion-agent2:10.5.0.102
391-
# - ion-agent3:10.5.0.103
392-
# depends_on:
393-
# builder-init:
394-
# # Not expected to run, but needed here to ensure build dependency
395-
# condition: service_started
396-
# postgres:
397-
# condition: service_healthy
398-
# privileged: true
399-
# tty: true
400-
# cap_add:
401-
# - NET_ADMIN
402-
# - NET_RAW
403-
# - SYS_NICE
404-
# environment:
405-
# container: docker
406-
# ION_NODE_NUM: 1
407-
# MGR_NODE_NUM: 1
408-
# DB_HOST: postgres
409-
# DB_USER: ${DB_USER}
410-
# DB_PASSWORD: ${DB_PASSWORD}
411-
# DB_NAME: ${DB_NAME}
412-
413-
414-
415-

0 commit comments

Comments
 (0)