f-86: deploy: unité two-hostsvc, release et provision du lab #86
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
27dda545cf
commit
0ed7f0dd1d
7 changed files with 58 additions and 16 deletions
|
|
@ -52,6 +52,7 @@ jobs:
|
||||||
- metadata
|
- metadata
|
||||||
- agent
|
- agent
|
||||||
- dhcp
|
- dhcp
|
||||||
|
- two-hostsvc
|
||||||
uses: ./.forgejo/workflows/build.yml
|
uses: ./.forgejo/workflows/build.yml
|
||||||
with:
|
with:
|
||||||
tag: ${{ needs.set-release-target.outputs.release_cible }}
|
tag: ${{ needs.set-release-target.outputs.release_cible }}
|
||||||
|
|
@ -80,6 +81,8 @@ jobs:
|
||||||
name: dhcp@.service
|
name: dhcp@.service
|
||||||
- path: systemd/metadata@.service
|
- path: systemd/metadata@.service
|
||||||
name: metadata@.service
|
name: metadata@.service
|
||||||
|
- path: systemd/two-hostsvc.service
|
||||||
|
name: two-hostsvc.service
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Move asset
|
- name: Move asset
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ start_services () {
|
||||||
|
|
||||||
profile_units () {
|
profile_units () {
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
kvm) echo "agent.service dnsmasq@.service dhcp@.service metadata@.service" ;;
|
kvm) echo "two-hostsvc.service agent.service dnsmasq@.service dhcp@.service metadata@.service" ;;
|
||||||
intel) echo "" ;;
|
intel) echo "" ;;
|
||||||
*) return 1 ;;
|
*) return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -124,7 +124,7 @@ profile_units () {
|
||||||
|
|
||||||
profile_binaries () {
|
profile_binaries () {
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
kvm) echo "agent metadata dhcp run-dnsmasq-in-netns.sh run-dhcp-in-netns.sh" ;;
|
kvm) echo "agent metadata dhcp two-hostsvc run-dnsmasq-in-netns.sh run-dhcp-in-netns.sh" ;;
|
||||||
intel) echo "" ;;
|
intel) echo "" ;;
|
||||||
*) return 1 ;;
|
*) return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
25
systemd/two-hostsvc.service
Normal file
25
systemd/two-hostsvc.service
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
[Unit]
|
||||||
|
Description=two DNS and NTP relay of the VPCs
|
||||||
|
After=network.target
|
||||||
|
Before=agent.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/opt/two/bin/two-hostsvc
|
||||||
|
Restart=on-failure
|
||||||
|
RuntimeDirectory=two/hostsvc
|
||||||
|
RuntimeDirectoryMode=0700
|
||||||
|
RuntimeDirectoryPreserve=yes
|
||||||
|
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_NET_BIND_SERVICE CAP_DAC_READ_SEARCH
|
||||||
|
NoNewPrivileges=yes
|
||||||
|
ProtectSystem=strict
|
||||||
|
ProtectHome=yes
|
||||||
|
PrivateTmp=yes
|
||||||
|
PrivateDevices=yes
|
||||||
|
ProtectKernelModules=yes
|
||||||
|
ProtectControlGroups=yes
|
||||||
|
LockPersonality=yes
|
||||||
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
@ -3,34 +3,38 @@
|
||||||
E2E_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
E2E_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
REPO_DIR="$(cd "${E2E_DIR}/../.." && pwd)"
|
REPO_DIR="$(cd "${E2E_DIR}/../.." && pwd)"
|
||||||
BIN_DIR="${BIN_DIR:-${E2E_DIR}/topologies/bin}"
|
BIN_DIR="${BIN_DIR:-${E2E_DIR}/topologies/bin}"
|
||||||
BINARIES="agent dhcp metadata"
|
BINARIES="agent dhcp metadata two-hostsvc"
|
||||||
|
UNITS="two-hostsvc.service"
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
cat >&2 <<USAGE
|
cat >&2 <<USAGE
|
||||||
usage: ${0##*/} [--clean]
|
usage: ${0##*/} [--clean]
|
||||||
|
|
||||||
sans option : compile ${BINARIES} pour linux/amd64 depuis l'arbre courant dans ${BIN_DIR} ;
|
sans option : compile ${BINARIES} pour linux/amd64 depuis l'arbre courant dans ${BIN_DIR}
|
||||||
le prochain lab les installe par-dessus la release épinglée dans
|
et y copie ${UNITS} ; le prochain lab les installe par-dessus la release
|
||||||
topologies/provision/hypervisor.sh
|
épinglée dans topologies/provision/hypervisor.sh
|
||||||
--clean : vide ${BIN_DIR} ; le prochain lab teste la release seule
|
--clean : vide ${BIN_DIR} ; le prochain lab teste la release seule
|
||||||
USAGE
|
USAGE
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
clean () {
|
clean () {
|
||||||
local binary
|
local file
|
||||||
for binary in ${BINARIES}; do
|
for file in ${BINARIES} ${UNITS}; do
|
||||||
rm -f "${BIN_DIR}/${binary}" || return 1
|
rm -f "${BIN_DIR}/${file}" || return 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
build () {
|
build () {
|
||||||
local binary
|
local binary unit
|
||||||
for binary in ${BINARIES}; do
|
for binary in ${BINARIES}; do
|
||||||
echo "== ${binary}" >&2
|
echo "== ${binary}" >&2
|
||||||
(cd "${REPO_DIR}" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "${BIN_DIR}/${binary}" "./cmd/${binary}") || return 1
|
(cd "${REPO_DIR}" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "${BIN_DIR}/${binary}" "./cmd/${binary}") || return 1
|
||||||
done
|
done
|
||||||
(cd "${BIN_DIR}" && sha256sum ${BINARIES} 2>/dev/null || shasum -a 256 ${BINARIES})
|
for unit in ${UNITS}; do
|
||||||
|
cp "${REPO_DIR}/systemd/${unit}" "${BIN_DIR}/${unit}" || return 1
|
||||||
|
done
|
||||||
|
(cd "${BIN_DIR}" && sha256sum ${BINARIES} ${UNITS} 2>/dev/null || shasum -a 256 ${BINARIES} ${UNITS})
|
||||||
}
|
}
|
||||||
|
|
||||||
main () {
|
main () {
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ nodes:
|
||||||
segments: [underlay, lan], addresses: { underlay: 192.168.14.11, lan: 10.33.0.11 },
|
segments: [underlay, lan], addresses: { underlay: 192.168.14.11, lan: 10.33.0.11 },
|
||||||
frr: frr/hv1.conf, provision: provision/hypervisor.sh,
|
frr: frr/hv1.conf, provision: provision/hypervisor.sh,
|
||||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin },
|
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin },
|
||||||
services: [agent.service] }
|
services: [two-hostsvc.service, agent.service] }
|
||||||
hv2:
|
hv2:
|
||||||
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
||||||
segments: [underlay, lan], addresses: { underlay: 192.168.14.12, lan: 10.33.0.12 },
|
segments: [underlay, lan], addresses: { underlay: 192.168.14.12, lan: 10.33.0.12 },
|
||||||
frr: frr/hv2.conf, provision: provision/hypervisor.sh,
|
frr: frr/hv2.conf, provision: provision/hypervisor.sh,
|
||||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin },
|
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin },
|
||||||
services: [agent.service] }
|
services: [two-hostsvc.service, agent.service] }
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,15 @@ nodes:
|
||||||
segments: [underlay, lan], addresses: { underlay: 192.168.14.11, lan: 10.33.0.11 },
|
segments: [underlay, lan], addresses: { underlay: 192.168.14.11, lan: 10.33.0.11 },
|
||||||
frr: frr/hv1.conf, provision: provision/hypervisor.sh,
|
frr: frr/hv1.conf, provision: provision/hypervisor.sh,
|
||||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin },
|
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin },
|
||||||
services: [agent.service] }
|
services: [two-hostsvc.service, agent.service] }
|
||||||
hv2:
|
hv2:
|
||||||
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
{ role: host, image: debian12, cpus: 4, memory: 16384,
|
||||||
segments: [underlay, lan], addresses: { underlay: 192.168.14.12, lan: 10.33.0.12 },
|
segments: [underlay, lan], addresses: { underlay: 192.168.14.12, lan: 10.33.0.12 },
|
||||||
frr: frr/hv2.conf, provision: provision/hypervisor.sh,
|
frr: frr/hv2.conf, provision: provision/hypervisor.sh,
|
||||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin },
|
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin },
|
||||||
services: [agent.service] }
|
services: [two-hostsvc.service, agent.service] }
|
||||||
hv3:
|
hv3:
|
||||||
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
|
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
|
||||||
addresses: { underlay: 192.168.14.13 }, frr: frr/hv3.conf, provision: provision/hypervisor.sh,
|
addresses: { underlay: 192.168.14.13 }, frr: frr/hv3.conf, provision: provision/hypervisor.sh,
|
||||||
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin },
|
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/dnsmasq.yml, bin: bin },
|
||||||
services: [agent.service] }
|
services: [two-hostsvc.service, agent.service] }
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,17 @@ bash ./deploy.sh --noup_script -i -u "${LAB_UPLINK}" -t "${RELEASE}"
|
||||||
for binary in "${LAB_FILES}"/bin/*; do
|
for binary in "${LAB_FILES}"/bin/*; do
|
||||||
[ -f "${binary}" ] || continue
|
[ -f "${binary}" ] || continue
|
||||||
name=$(basename "${binary}")
|
name=$(basename "${binary}")
|
||||||
|
case "${name}" in *.service) continue ;; esac
|
||||||
install -D -m 0755 "${binary}" "/opt/two/local/bin/${name}"
|
install -D -m 0755 "${binary}" "/opt/two/local/bin/${name}"
|
||||||
ln -sfn "/opt/two/local/bin/${name}" "/opt/two/bin/${name}"
|
ln -sfn "/opt/two/local/bin/${name}" "/opt/two/bin/${name}"
|
||||||
echo "lab: ${name} compilé en local remplace celui de la release ${RELEASE}"
|
echo "lab: ${name} compilé en local remplace celui de la release ${RELEASE}"
|
||||||
done
|
done
|
||||||
|
for unit in "${LAB_FILES}"/bin/*.service; do
|
||||||
|
[ -f "${unit}" ] || continue
|
||||||
|
name=$(basename "${unit}")
|
||||||
|
install -m 0644 "${unit}" "/etc/systemd/system/${name}"
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable "${name}"
|
||||||
|
systemctl restart "${name}"
|
||||||
|
echo "lab: unité ${name} de l'arbre local installée par-dessus la release ${RELEASE}"
|
||||||
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue