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

Storing data on host #1

Open
neutralvibes opened this issue Mar 18, 2018 · 1 comment
Open

Storing data on host #1

neutralvibes opened this issue Mar 18, 2018 · 1 comment

Comments

@neutralvibes
Copy link

neutralvibes commented Mar 18, 2018

First of all. This is great work.

As rpimonitor stores its rrd data in /var/lib/rpimonitor/stat/. If you like your containers to be able to be recreated without losing data, as I do, a suggestion would be to add a volume mapping to a localhost folder.

--volume=/your-local-path:/var/lib/rpimonitor/stat/
The rrd files will be stored locally and the container can be removed and recreated at will.

A systemd file could then be used which removed the container when stopped and recreates it started.

[Unit]
Description=rpi-monitor
Requires=docker.service
After=docker.service

[Service]
Restart=always
RestartSec=10s

ExecStart=/usr/bin/docker run --name=%n \
-p=8888:8888 \
--device=/dev/vchiq \
--restart=always \
--device=/dev/vcsm \
--volume=/opt/vc:/opt/vc \
--volume=/boot:/boot \
--volume=/sys:/dockerhost/sys:ro \
--volume=/etc:/dockerhost/etc:ro \
--volume=/proc:/dockerhost/proc:ro \
--volume=/usr/lib:/dockerhost/usr/lib:ro \
--volume=/var/lib/rpimonitor/stat/:/var/lib/rpimonitor/stat/ \
michaelmiklis/rpi-monitor:latest

ExecStop=/usr/bin/docker stop -t 2 %n ; /usr/bin/docker rm -f %n

[Install]
WantedBy=multi-user.target


@lloydjatkinson
Copy link

Having a volume for persistence should be in the Quick Start snippet, because otherwise it's pretty pointless.

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

No branches or pull requests

2 participants