-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d0ffcb
commit a6990d8
Showing
5 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# smfc in docker | ||
This file explains how `smfc` image can be executed in docker environment. | ||
|
||
Visit the [GitHub repository](https://github.com/petersulyok/smfc) of `smfc` for more details or reporting issues. | ||
|
||
# Usage | ||
|
||
## docker CLI | ||
``` | ||
$ docker run \ | ||
-d \ | ||
--rm \ | ||
--log-driver=journald \ | ||
--privileged=true \ | ||
--name "smfc" \ | ||
-v /dev:/dev:ro \ | ||
-v /run:/run:ro \ | ||
-v /opt/smfc/smfc.conf:/opt/smfc/smfc.conf:ro \ | ||
-e SMFC_ARGS="-l 3" \ | ||
petersulyok/smfc | ||
``` | ||
(see this example in `docker/docker-start.sh`) | ||
|
||
## docker-compose | ||
``` | ||
version: "2" | ||
services: | ||
smfc: | ||
image: petersulyok/smfc | ||
container_name: smfc | ||
network_mode: none | ||
logging: | ||
driver: journald | ||
privileged: true | ||
environment: | ||
- SMFC_ARGS=-l 3 | ||
volumes: | ||
- /dev:/dev:ro | ||
- /run:/run:ro | ||
- /opt/smfc/smfc.conf:/opt/smfc/smfc.conf:ro | ||
- /etc/timezone:/etc/timezone:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
restart: unless-stopped | ||
``` | ||
(see this example in `docker/docker-compose.yaml`) | ||
|
||
## Parameters | ||
Use the following parameters to configure `smfc`: | ||
|
||
| Parameter | type | function | | ||
|-------------|----------------------|------------------------------------------------------| | ||
| `SMFC_ARGS` | environment variable | command-line arguments for `smfc` (-o, -l) | | ||
| `smfc.conf` | volume | configuration file for `smfc`, mapped from host side | | ||
|
||
Please also note: | ||
1. this image should be executed in `privileged` mode with access of `/dev` and `/run` folders | ||
because of the tools (i.e. `ipmitool`, `smartctl` and `hddtemp`) | ||
2. `smfc` log messages are forwarded to the host's `journald` daemon. Feel free to use a different [log driver](https://docs.docker.com/config/containers/logging/configure/) for docker. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM alpine:3.18 | ||
|
||
LABEL org.opencontainers.image.title="smfc" | ||
LABEL org.opencontainers.image.authors="petersulyok" | ||
LABEL org.opencontainers.image.desciption="Super Micro fan control for linux servers." | ||
LABEL org.opencontainers.image.url="https://github.com/petersulyok/smfc" | ||
|
||
RUN <<EOT | ||
set -xe | ||
apk add --no-cache ipmitool python3 smartmontools | ||
apk add --no-cache --virtual .depends git build-base linux-headers automake autoconf gettext-dev | ||
mkdir /tmp/build/ | ||
cd /tmp/build/ | ||
wget -O hddtemp.db.1 http://download.savannah.nongnu.org/releases/hddtemp/hddtemp.db | ||
wget -O hddtemp.db.2 https://gitweb.gentoo.org/repo/gentoo.git/plain/app-admin/hddtemp/files/hddgentoo.db | ||
cat hddtemp.db.1 hddtemp.db.2 > /usr/share/misc/hddtemp.db | ||
wget "https://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess" | ||
wget "https://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub" | ||
git clone https://github.com/vitlav/hddtemp.git | ||
cd hddtemp/ | ||
autoreconf -vif | ||
./configure --prefix=/usr --disable-nls | ||
make | ||
make install | ||
cd / | ||
rm -r /usr/share/man | ||
rm -r /tmp/build | ||
apk del .depends | ||
EOT | ||
|
||
WORKDIR /opt/smfc | ||
ADD --chmod=755 src/smfc.py smfc.py | ||
|
||
CMD /opt/smfc/smfc.py -c /opt/smfc/smfc.conf $SMFC_ARGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
version="3.3.0" | ||
|
||
docker build . -t petersulyok/smfc:$version -t petersulyok/smfc:latest --label "org.opencontainers.image.version=$version" -f Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: "2" | ||
services: | ||
smfc: | ||
image: petersulyok/smfc | ||
container_name: smfc | ||
network_mode: none | ||
logging: | ||
driver: journald | ||
privileged: true | ||
environment: | ||
- SMFC_ARGS=-l 3 | ||
volumes: | ||
- /dev:/dev:ro | ||
- /run:/run:ro | ||
- /opt/smfc/smfc.conf:/opt/smfc/smfc.conf:ro | ||
- /etc/timezone:/etc/timezone:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
# | ||
# docker_start.sh (C) 2023, Peter Sulyok | ||
# This script will start `smfc` image in docker. | ||
# | ||
|
||
docker run \ | ||
-d \ | ||
--rm \ | ||
--log-driver=journald \ | ||
--privileged=true \ | ||
--name "smfc" \ | ||
-v /dev:/dev:ro \ | ||
-v /run:/run:ro \ | ||
-v /etc/timezone:/etc/timezone:ro \ | ||
-v /etc/localtime:/etc/localtime:ro \ | ||
-v /opt/smfc/smfc.conf:/opt/smfc/smfc.conf:ro \ | ||
-e SMFC_ARGS="-l 3" \ | ||
petersulyok/smfc |