Skip to content

Commit

Permalink
feat: added first setup actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaile committed Feb 26, 2024
1 parent 977bd18 commit b547dac
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
10 changes: 10 additions & 0 deletions imageroot/actions/configure-module/20configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

install -m 644 "${AGENT_INSTALL_DIR}/dnsmasq.service" "/etc/systemd/system/${MODULE_ID}.service"
systemctl daemon-reload
systemctl enable --now "${MODULE_ID}.service"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
import os
import agent



# open firewall for DNS and DHCP
agent.assert_exp(agent.add_public_service(os.environ['MODULE_ID'], ["53/udp", "67/udp"]))
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
import os
import agent



# close firewall for DNS and DHCP
agent.assert_exp(agent.remove_public_service(os.environ['MODULE_ID']))
36 changes: 36 additions & 0 deletions imageroot/dnsmasq.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[Unit]
Description=DNSmasq podman container
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
EnvironmentFile=/var/lib/nethserver/%N/state/environment
Restart=on-failure
TimeoutStopSec=70
ExecStart=/usr/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--sdnotify=conmon \
-d \
--replace \
--name=dnsmasq \
--network=host \
--cap-add=NET_ADMIN,NET_RAW \
--volume=/var/lib/nethserver/%N/dnsmasq.d:/etc/dnsmasq.d:Z \
${DNSMASQ_IMAGE}
ExecStop=/usr/bin/podman stop \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm \
-f \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all

[Install]
WantedBy=default.target

0 comments on commit b547dac

Please sign in to comment.