Skip to content

Commit

Permalink
refactor: split docker compose into server | dpu files
Browse files Browse the repository at this point in the history
Signed-off-by: Suraj Shirvankar <[email protected]>
  • Loading branch information
h0lyalg0rithm authored and sandersms committed Sep 18, 2024
1 parent dae834d commit 65e62d1
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 87 deletions.
93 changes: 93 additions & 0 deletions docker-compose.dpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2022-2023 Dell Inc, or its subsidiaries.
---
version: '3.7'

services:
nmap:
image: docker.io/instrumentisto/nmap:7.94
networks:
- opi
command: --script broadcast-dhcp-discover

nmapmdnsclient:
image: docker.io/instrumentisto/nmap:7.94
networks:
- opi
command: --script=dns-service-discovery -p 5353 avahi

client:
image: docker.io/modularitycontainers/dhcp-client:latest
cap_add:
- CAP_NET_RAW
volumes:
- dhcp-leases-folder:/var/lib/dhclient/
- ./dhcp/dhclient.conf:/etc/dhcp/dhclient.conf
networks:
- opi
command: dhclient -d -v

agent3: &agent
image: ghcr.io/opiproject/opi-sztp-client:main
build:
context: sztp-agent
depends_on:
bootstrap:
condition: service_healthy
redirecter:
condition: service_healthy
setup-cert:
condition: service_completed_successfully
volumes:
- client-certs:/certs
- dhcp-leases-folder:/var/lib/dhclient/
- /etc/os-release:/etc/os-release
- /etc/ssh:/etc/ssh
networks:
- opi
command: ['/opi-sztp-agent', 'daemon',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/third_my_cert.pem',
'--device-private-key', '/certs/third_private_key.pem',
'--serial-number', 'third-serial-number']

agent2:
<<: *agent
command: ['/opi-sztp-agent', 'daemon',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/second_my_cert.pem',
'--device-private-key', '/certs/second_private_key.pem',
'--serial-number', 'second-serial-number']

agent1:
<<: *agent
command: ['/opi-sztp-agent', 'daemon',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/first_my_cert.pem',
'--device-private-key', '/certs/first_private_key.pem',
'--serial-number', 'first-serial-number']

agent4:
<<: *agent
command: ['/opi-sztp-agent', 'daemon',
'--bootstrap-url', 'https://redirecter:8080/restconf/operations/ietf-sztp-bootstrap-server:get-bootstrapping-data',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/first_my_cert.pem',
'--device-private-key', '/certs/first_private_key.pem',
'--serial-number', 'first-serial-number']

agent5:
<<: *agent
command: ['/opi-sztp-agent', 'run',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/first_my_cert.pem',
'--device-private-key', '/certs/first_private_key.pem',
'--serial-number', 'first-serial-number']

volumes:
client-certs:
dhcp-leases-folder:
90 changes: 3 additions & 87 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
---
version: '3.7'

services:
include:
- docker-compose.dpu.yml

services:
bootstrap:
image: docker.io/opiproject/sztpd:0.0.15
depends_on:
Expand Down Expand Up @@ -80,18 +82,6 @@ services:
- opi
command: sh -e -u -x -c 'touch /var/lib/dhcp/dhcpd.leases && eval "echo \"$$(cat /opt/dhcpd.conf.template)\"" > /etc/dhcp/dhcpd.conf && dhcpd -d'

nmap:
image: docker.io/instrumentisto/nmap:7.94
networks:
- opi
command: --script broadcast-dhcp-discover

nmapmdnsclient:
image: docker.io/instrumentisto/nmap:7.94
networks:
- opi
command: --script=dns-service-discovery -p 5353 avahi

setup-cert:
image: docker.io/alpine/openssl:3.3.1
volumes:
Expand Down Expand Up @@ -171,79 +161,6 @@ services:
cp /certs/ta_cert_chain.pem /usr/local/apache2/conf/ssl.crt/ca-bundle.crt
httpd-foreground
'
client:
image: docker.io/modularitycontainers/dhcp-client:latest
cap_add:
- CAP_NET_RAW
volumes:
- dhcp-leases-folder:/var/lib/dhclient/
- ./dhcp/dhclient.conf:/etc/dhcp/dhclient.conf
networks:
- opi
command: dhclient -d -v

agent3: &agent
image: ghcr.io/opiproject/opi-sztp-client:main
build:
context: sztp-agent
depends_on:
bootstrap:
condition: service_healthy
redirecter:
condition: service_healthy
setup-cert:
condition: service_completed_successfully
volumes:
- client-certs:/certs
- dhcp-leases-folder:/var/lib/dhclient/
- /etc/os-release:/etc/os-release
- /etc/ssh:/etc/ssh
networks:
- opi
command: ['/opi-sztp-agent', 'daemon',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/third_my_cert.pem',
'--device-private-key', '/certs/third_private_key.pem',
'--serial-number', 'third-serial-number']

agent2:
<<: *agent
command: ['/opi-sztp-agent', 'daemon',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/second_my_cert.pem',
'--device-private-key', '/certs/second_private_key.pem',
'--serial-number', 'second-serial-number']

agent1:
<<: *agent
command: ['/opi-sztp-agent', 'daemon',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/first_my_cert.pem',
'--device-private-key', '/certs/first_private_key.pem',
'--serial-number', 'first-serial-number']

agent4:
<<: *agent
command: ['/opi-sztp-agent', 'daemon',
'--bootstrap-url', 'https://redirecter:8080/restconf/operations/ietf-sztp-bootstrap-server:get-bootstrapping-data',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/first_my_cert.pem',
'--device-private-key', '/certs/first_private_key.pem',
'--serial-number', 'first-serial-number']

agent5:
<<: *agent
command: ['/opi-sztp-agent', 'run',
'--dhcp-lease-file', '/var/lib/dhclient/dhclient.leases',
'--bootstrap-trust-anchor-cert', '/certs/opi.pem',
'--device-end-entity-cert', '/certs/first_my_cert.pem',
'--device-private-key', '/certs/first_private_key.pem',
'--serial-number', 'first-serial-number']

avahi:
image: docker.io/flungo/avahi:latest
environment:
Expand Down Expand Up @@ -282,7 +199,6 @@ volumes:
tpm-data:
server-certs:
client-certs:
dhcp-leases-folder:

networks:
opi:
Expand Down

0 comments on commit 65e62d1

Please sign in to comment.