diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 05dff89..fa83b1d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -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 / - IMAGE_NAME: ${{ github.repository }} - + - cron: '0 0 */2 * 0' jobs: push_to_registries: @@ -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 }} + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 461ef2f..286cfc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 1a27d5f..55620a4 100644 --- a/README.md +++ b/README.md @@ -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 + ``` diff --git a/start_services.sh b/start_services.sh index b14d1fd..54b1e85 100644 --- a/start_services.sh +++ b/start_services.sh @@ -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[@]}