Skip to content

Commit

Permalink
moonraker: allow host control via systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuf committed Mar 23, 2022
1 parent aa85c2b commit b6bdc8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/moonraker.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ klippy_uds_address: /opt/run/klipper.sock
config_path: /opt/cfg

[machine]
provider: none
provider: systemd_cli

[database]
database_path: /opt/db
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ services:
image: mkuf/moonraker:nightly
container_name: moonraker
restart: unless-stopped
pid: host
logging:
driver: none
command:
Expand All @@ -64,11 +65,13 @@ services:
klipper:
condition: service_started
volumes:
- ./config:/opt/cfg
- /run/dbus:/run/dbus
- /run/systemd:/run/systemd
- run:/opt/run
- gcode:/opt/gcode
- log:/opt/log
- moonraker-db:/opt/db
- ./config:/opt/cfg
profiles:
- fluidd
- mainsail
Expand Down
16 changes: 11 additions & 5 deletions docker/moonraker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ RUN apt update \
libopenjp2-7 \
python3-libgpiod \
curl \
libcurl4-openssl-dev \
libssl-dev \
libcurl4 \
libssl1.1 \
liblmdb0 \
libsodium-dev \
zlib1g-dev \
libsodium23 \
zlib1g \
iproute2 \
&& apt clean
systemd \
sudo \
&& apt clean

WORKDIR /opt
COPY --from=build /opt/moonraker ./moonraker
Expand All @@ -39,6 +41,10 @@ RUN groupadd moonraker --gid 1000 \
&& usermod moonraker --append --groups dialout \
&& chown -R moonraker:moonraker /opt/*

RUN ln -s /bin/systemctl /sbin/shutdown \
&& ln -s /bin/systemctl /sbin/reboot \
&& echo -n "moonraker ALL = NOPASSWD: /bin/systemctl, /sbin/shutdown, /sbin/reboot" > /etc/sudoers.d/moonraker

## Start Moonraker
USER moonraker
EXPOSE 7125
Expand Down

0 comments on commit b6bdc8d

Please sign in to comment.