Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autostart? #66

Open
Rothammel opened this issue May 14, 2023 · 1 comment
Open

autostart? #66

Rothammel opened this issue May 14, 2023 · 1 comment
Labels
question Further information is requested

Comments

@Rothammel
Copy link

how can I perform an autostart via systemd

@fphammerle fphammerle added the question Further information is requested label May 22, 2023
@fphammerle
Copy link
Owner

rough untested(!) draft:

  1. install podman
  2. create file /etc/systemd/system/systemctl-mqtt-podman-container.service with following content:
[Unit]
After=dbus.socket
Requires=dbus.socket
[Service]
Type=notify
NotifyAccess=all
ExecStartPre=/usr/sbin/apparmor_parser /somewhere/docker-apparmor-profile
ExecStart=/usr/bin/podman run --cidfile %t/%n.ctr-id \
    --rm --detach --sdnotify conmon --log-driver journald \
    --name systemctl_mqtt \
    -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:rw \
    --hostname %H --userns host --user 0 \
    --security-opt no-new-privileges --security-opt apparmor=systemctl-mqtt \
    docker.io/fphammerle/systemctl-mqtt:0.5.0-amd64@sha256:34dcb878dbd66315de6fbf97ceb29e8fec549b7269c6c828c4c889a54a091f14 \
    systemctl-mqtt ...
ExecStop=/usr/bin/podman stop --cidfile %t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm --cidfile %t/%n.ctr-id 
ExecStopPost=rm %t/%n.ctr-id
[Install]
WantedBy=multi-user.target
  1. sudo systemctl daemon-reload
  2. sudo systemctl enable systemctl-mqtt-podman-container.service
  3. sudo systemctl start systemctl-mqtt-podman-container.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants