Skip to content

Commit

Permalink
Build from source, ENV variables according to hddfancontrol manual, C…
Browse files Browse the repository at this point in the history
…PU Probe (#7)

* new publish workflow

* make the env variables correspond to the help of hddfancontrol

* build from source
  • Loading branch information
fightforlife authored Sep 10, 2022
1 parent 932ce92 commit 7a1343d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
38 changes: 12 additions & 26 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,11 @@
name: Publish Docker image

on:
#for manual start
workflow_dispatch:

#every second day
schedule:
- cron: '0 0 * * 0'

# schedule:
# - cron: '25 10 * * *'
# push:
# branches: [ master ]
# # Publish semver tags as releases.
# tags: [ 'v*.*.*' ]
# pull_request:
# branches: [ master ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

- cron: '0 0 */2 * 0'

jobs:
push_to_registries:
Expand All @@ -37,43 +22,44 @@ jobs:

steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: |
fred92/hddfancontrol
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7,linux/arm/v6
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ FROM python:slim
RUN apt-get update

#install needed packages
RUN apt-get install -y smartmontools hdparm hddtemp fancontrol lm-sensors kmod
RUN apt-get install -y smartmontools hdparm hddtemp fancontrol lm-sensors kmod git

#install hddfancontrol
RUN pip3 install hddfancontrol
RUN pip3 install setuptools
RUN git clone https://github.com/desbma/hddfancontrol
RUN cd hddfancontrol && \
chmod +x setup.py && \
python3 setup.py install
RUN rm -rf hddfancontrol


#start hddtemp daemon and expose port
#EXPOSE 7634
Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ services:
cap_add:
- SYS_MODULE
environment:
- DEVICES=/dev/sdb1 /dev/sdc1 /dev/sdd1
- PWM_DEVICES=/sys/class/hwmon/hwmon2/pwm1 /sys/class/hwmon/hwmon2/pwm2
- PWM_START=70 80
- PWM_STOP=20 30
- DRIVE_FILEPATHS=/dev/sdb1 /dev/sdc1 /dev/sdd1
- FAN_PWM_FILEPATH=/sys/class/hwmon/hwmon2/pwm1 /sys/class/hwmon/hwmon2/pwm2
- FAN_START_VALUE=70 80
- FAN_STOP_VALUE=20 30
- MIN_TEMP=40
- MAX_TEMP=60
- MIN_FAN=0
- INTERVALL=60
- SPINDOWN_TIME=900 (optional!)
- TEMP_QUERY_MODE=smartctl
- LOG_PATH=/var/log/hddfancontrol.log (optional!)
- MIN_FAN_SPEED_PRCT=0
- INTERVAL_S=60
- CPU_PROBE_FILEPATH=/sys/devices/platform/coretemp.0/hwmon/hwmon0/tempY_input
- CPU_TEMP_RANGE=50 70
- SPIN_DOWN_TIME_S=900
- VERBOSITY=debug
- LOG_FILEPATH=/var/log/hddfancontrol.log
- TEMP_QUERY_MODE=smartctl #hddtemp,hdparm,drivetemp,smartctl
```

Expand Down
22 changes: 13 additions & 9 deletions start_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ sensors-detect --auto | sed -n '/# Chip drivers/,/#----cut here----/{//!p;}' | x
#create argument array
declare -a args=()

[[ ! -z $DEVICES ]] && args+=(--drives $DEVICES)
[[ ! -z $PWM_DEVICES ]] && args+=(--pwm $PWM_DEVICES)
[[ ! -z $PWM_START ]] && args+=(--pwm-start-value $PWM_START)
[[ ! -z $PWM_STOP ]] && args+=(--pwm-stop-value $PWM_STOP)
[[ ! -z $DRIVE_FILEPATHS ]] && args+=(--drives $DRIVE_FILEPATHS)
[[ ! -z $FAN_PWM_FILEPATH ]] && args+=(--pwm $FAN_PWM_FILEPATH)
[[ ! -z $FAN_START_VALUE ]] && args+=(--pwm-start-value $FAN_START_VALUE)
[[ ! -z $FAN_STOP_VALUE ]] && args+=(--pwm-stop-value $FAN_STOP_VALUE)
[[ ! -z $MIN_TEMP ]] && args+=(--min-temp $MIN_TEMP)
[[ ! -z $MAX_TEMP ]] && args+=(--max-temp $MAX_TEMP)
[[ ! -z $MIN_FAN ]] && args+=(--min-fan-speed-prct $MIN_FAN)
[[ ! -z $INTERVALL ]] && args+=(-i $INTERVALL)
[[ ! -z $TEMP_QUERY_MODE ]] && args+=(--$TEMP_QUERY_MODE)
[[ ! -z $SPINDOWN_TIME ]] && args+=(--spin-down-time $SPINDOWN_TIME)
[[ ! -z $LOG_PATH ]] && args+=(-l $LOG_PATH)
[[ ! -z $MIN_FAN_SPEED_PRCT ]] && args+=(--min-fan-speed-prct $MIN_FAN_SPEED_PRCT)
[[ ! -z $INTERVAL_S ]] && args+=(-i $INTERVAL_S)
[[ ! -z $CPU_PROBE_FILEPATH ]] && args+=(--cpu-sensor $CPU_PROBE_FILEPATH)
[[ ! -z $CPU_TEMP_RANGE ]] && args+=(--cpu-temp-range $CPU_TEMP_RANGE)
[[ ! -z $SPIN_DOWN_TIME_S ]] && args+=(--spin-down-time $SPIN_DOWN_TIME_S)
[[ ! -z $VERBOSITY ]] && args+=(--verbosity $VERBOSITY) #warning,normal,debug
[[ ! -z $LOG_FILEPATH ]] && args+=(--log-file $LOG_FILEPATH)
[[ ! -z $TEMP_QUERY_MODE ]] && args+=(--$TEMP_QUERY_MODE) #hddtemp,hddtemp-daemon,hdparm,drivetemp,smartctl


echo ${args[@]}

Expand Down

0 comments on commit 7a1343d

Please sign in to comment.