Skip to content

Commit

Permalink
Revert generating global_prefs_override.xml with PREF_ variables,…
Browse files Browse the repository at this point in the history
… that doesn't work well.
  • Loading branch information
MentalFS committed Feb 12, 2024
1 parent 5a6a84e commit 222b638
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ CMD ["boinc", "--allow_remote_gui_rpc"]
ENV ENV=/start \
CPU_USAGE_LIMIT=100 \
MAX_NCPUS_PCT=100 \
PREF_RUN_GPU_IF_USER_ACTIVE=1 \
PREF_RUN_IF_USER_ACTIVE=1 \
PREF_SUSPEND_CPU_USAGE=50 \
PREF_SUSPEND_IF_NO_RECENT_INPUT=0 \
HEALTHCHECK_PATTERN=EXECUTING
HEALTHCHECK --interval=1m CMD boinccmd --get_tasks | egrep -q "${HEALTHCHECK_PATTERN}" && exit 0 || exit 1

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ When the GUI RPC Port is routed, it is also possible to control the client remot
|---------------------------------|-------------|------------------------------------------------------------------------------------------------|
| `GUI_RPC_AUTH` | *empty* | The password for GUI RPC, empty means no password |
| `HOST_VENUE` | *empty* | Host venue type: `none`, `home`, `school` or `work` |
| `CPU_USAGE_LIMIT` | `100` | Load percentage to use, *empty* uses website preferences |
| `MAX_NCPUS_PCT` | `100` | Percentage of CPU cores to use, *empty* uses website preferences |
| `PREF_*` | *empty* | Variables starting with `PREF_` will be translated to a setting in `global_prefs_override.xml` |
| `GLOBAL_PREFERENCES_XML` | *empty* | Raw XML tags to inject into `global_prefs_override.xml` |
| `HEALTHCHECK_PATTERN` | `EXECUTING` | Will make the conainer unhealthy when no task is executing. Set to `.` to avoid. |
| `CPU_USAGE_LIMIT` | `100` | Load percentage to use, *empty* uses website preferences |
| `CPU_SCHEDULING_PERIOD_MINUTES` | *empty* | Switch between tasks/projects every X minutes |
| `WORK_BUF_MIN_DAYS` | *empty* | Store at least enough tasks to keep the computer busy for this long (in Days, decimal number) |
| `WORK_BUF_ADDITIONAL_DAYS` | *empty* | Store additional tasks above the minimum level (in Days, decimal number) |
| `HEALTHCHECK_PATTERN` | `EXECUTING` | Will make the conainer unhealthy when no task is executing, set to `.` to avoid that |

## Download

Expand Down Expand Up @@ -68,6 +69,7 @@ docker exec -it boinc boinctui
## Notes

* `global_prefs_override.xml` will be overwritten to use environment variables.
* Apparently the order in `global_prefs_override.xml` matters, be aware of that when using `GLOBAL_PREFERENCES_XML`.
* The client will start with `--allow_remote_gui_rpc`, allowing all hosts to connect to the GUI RPC.
* GPUs are usable with `--gpus`, `--privileged` (not recommended) or `--device /dev/dri:/dev/dri` depending on GPU model.
* Docker can restrict CPU load with `--cpus`, which is most likely preferable to using `CPU_USAGE_LIMIT`.
Expand Down
27 changes: 13 additions & 14 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
if [ "`whoami`"=="boinc" ]; then
# Setup environment
echo "${GUI_RPC_AUTH}" > /etc/boinc-client/gui_rpc_auth.cfg

[ -n "${CPU_SCHEDULING_PERIOD_MINUTES}" ] && export PREF_CPU_SCHEDULING_PERIOD_MINUTES="${CPU_SCHEDULING_PERIOD_MINUTES}"
[ -n "${CPU_USAGE_LIMIT}" ] && export PREF_CPU_USAGE_LIMIT="${CPU_USAGE_LIMIT}"
[ -n "${MAX_NCPUS_PCT}" ] && export PREF_MAX_NCPUS_PCT="${MAX_NCPUS_PCT}"
PREFS_OVERRIDE_FILE="/var/lib/boinc-client/global_prefs_override.xml"
echo "<global_preferences>" > "${PREFS_OVERRIDE_FILE}"
[ -n "${HOST_VENUE}" ] && echo "<host_venue>$([ "${HOST_VENUE}" = "none" ] || echo "${HOST_VENUE}")</host_venue>" >> "${PREFS_OVERRIDE_FILE}"
env | egrep -o '^PREF_[^=]+' | sort | while read PREF; do
KEY="$(echo "${PREF#PREF_}" | tr '[:upper:]' '[:lower:]')"
eval VALUE="\${$PREF}"
echo "<${KEY}>${VALUE}</${KEY}>" >> "${PREFS_OVERRIDE_FILE}"
done
[ -n "${GLOBAL_PREFERENCES_XML}" ] && echo "${GLOBAL_PREFERENCES_XML}" >> "${PREFS_OVERRIDE_FILE}"
echo "</global_preferences>" >> "${PREFS_OVERRIDE_FILE}"
cat > "/var/lib/boinc-client/global_prefs_override.xml" <<- END
<global_preferences>
${HOST_VENUE:+"<host_venue>$([ "${HOST_VENUE}" = "none" ] || echo "${HOST_VENUE}")</host_venue>"}
<run_if_user_active>1</run_if_user_active>
<run_gpu_if_user_active>1</run_gpu_if_user_active>
${MAX_NCPUS_PCT:+"<max_ncpus_pct>${MAX_NCPUS_PCT}</max_ncpus_pct>"}
${CPU_USAGE_LIMIT:+"<cpu_usage_limit>${CPU_USAGE_LIMIT}</cpu_usage_limit>"}
<suspend_cpu_usage>50</suspend_cpu_usage>
<suspend_if_no_recent_input>0</suspend_if_no_recent_input>
${CPU_SCHEDULING_PERIOD_MINUTES:+"<cpu_scheduling_period_minutes>${CPU_SCHEDULING_PERIOD_MINUTES}</cpu_scheduling_period_minutes>"}
${WORK_BUF_MIN_DAYS:+"<work_buf_min_days>${WORK_BUF_MIN_DAYS}</work_buf_min_days>"}
${WORK_BUF_ADDITIONAL_DAYS:+"<work_buf_additional_days>${WORK_BUF_ADDITIONAL_DAYS}</work_buf_additional_days>"}
</global_preferences>
cat > "/var/lib/boinc-client/.boinctui.cfg" <<- END
<boinctui_cfg>
Expand Down

0 comments on commit 222b638

Please sign in to comment.