Skip to content

Commit 78a636d

Browse files
authored
Miner v0.5.0 - Syslog, extra args, and custom entrypoint with dumb-init (#22)
* Miner v0.5.0 - Syslog, extra args, and custom entrypoint with dumb-init * fixing image build and test * Fixing dumb-init * testing new miner image * removing worker_id * debugging new image * new image * no need to specify tls version * hmm * fixing scheme and supporting multiple pools * latest miner * nocolor seems to trump syslog ? * Final image and working chart
1 parent aa45034 commit 78a636d

File tree

9 files changed

+60
-23
lines changed

9 files changed

+60
-23
lines changed

.github/workflows/miner-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ jobs:
3939
- name: build and test
4040
run: |
4141
docker build . -t ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }}
42-
docker run -i ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }} 'nsfminer --help'
43-
docker run -i ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }} 'ethminer --help'
42+
docker run --entrypoint /usr/local/bin/nsfminer -i ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }} '--help'
4443
docker push ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }}
4544
working-directory: miner
4645

charts/miner/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ description: A Helm chart for deploying an Ethereum GPU miner on Kubernetes.
44
maintainers:
55
- name: hfuss
66
type: application
7-
version: 0.1.0
8-
appVersion: "0.4.0"
7+
version: 0.2.0
8+
appVersion: "0.5.0"

charts/miner/templates/statefulset.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@ spec:
3434
{{- toYaml .Values.securityContext | nindent 12 }}
3535
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3636
imagePullPolicy: {{ .Values.image.pullPolicy }}
37+
args:
38+
- --report-hashrate
39+
- --syslog
40+
- --exit
41+
{{- if .Values.extraArgs }}
42+
{{- toYaml .Values.extraArgs | nindent 12 }}
43+
{{- end }}
3744
env:
38-
- name: WORKER_ID
39-
valueFrom:
40-
fieldRef:
41-
fieldPath: metadata.name
42-
- name: MINE_POOL
43-
value: {{ .Values.config.miningPool | quote }}
45+
- name: MINING_POOLS
46+
value: {{ .Values.miningPools | join " " | quote }}
4447
ports:
4548
- name: jsonrpc
4649
containerPort: 3333

charts/miner/values.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ image:
22
repository: ghcr.io/hfuss/miner
33
pullPolicy: Always
44
# Overrides the image tag whose default is the chart appVersion.
5-
tag: v0.4.0
5+
tag: v0.5.0 # TODO v0.5.0
66

77
imagePullSecrets: []
88
nameOverride: ""
99
fullnameOverride: ""
1010

11-
config:
12-
miningPool: us1.ethermine.org
11+
miningPools:
12+
- us1.ethermine.org
13+
- us2.ethermine.org
14+
- eu1.ethermine.org
15+
- asia1.ethermine.org
16+
17+
extraArgs: []
18+
# - --eval
19+
# - --failover-timeout=1
1320

1421
serviceAccount:
1522
# Specifies whether a service account should be created

gitops/deploys/application-miner-brx-01a.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
source:
1111
repoURL: https://github.com/hfuss/ethernetes
1212
path: charts/miner
13-
targetRevision: latest-miner
13+
targetRevision: main
1414
helm:
1515
values: |
1616
nodeSelector:

miner/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1515
### Dependencies
1616
- ...
1717

18+
## [v0.5.0]
19+
### Added
20+
- Custom `entrypoint.sh` is copied to the image as `/usr/local/bin/custom-entrypoint.sh` to allow
21+
for extra args and `dumb-init`
22+
23+
### Dependencies
24+
- Latest Ethereum miner [`https://github.com/no-fee-ethereum-mining/nsfminer@v1.3.5`](https://github.com/no-fee-ethereum-mining/nsfminer/releases/tag/v1.3.5)
25+
26+
1827
## [v0.4.0]
1928
### Changed
2029
- Decreasing the final image size using the `base` image rather than

miner/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ RUN mkdir /ethminer
1010
WORKDIR /ethminer
1111

1212
RUN apt-get install -y curl \
13-
&& curl -sL -o ethminer.tgz https://github.com/no-fee-ethereum-mining/nsfminer/releases/download/v1.2.4/nsfminer_1.2.4-ubuntu_18.04-cuda_11.2-opencl.tgz \
13+
&& curl -sL -o ethminer.tgz https://github.com/no-fee-ethereum-mining/nsfminer/releases/download/v1.3.5/nsfminer_1.3.5-ubuntu_18.04-cuda_11.2-opencl.tgz \
1414
&& tar -xzvf ethminer.tgz \
1515
&& mv nsfminer /usr/local/bin/ \
16-
&& rm -rf *
16+
&& rm -rf * \
17+
&& curl -sL https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_amd64.deb -o dumb-init_1.2.5_amd64.deb
1718

1819
FROM docker.io/nvidia/cuda:11.2.0-base-ubuntu18.04 as final
1920

2021
COPY --from=ethminer /usr/local/bin/nsfminer /usr/local/bin/nsfminer
21-
RUN ln -sf /usr/local/bin/nsfminer /usr/local/bin/ethminer
22+
COPY --from=ethminer /ethminer/dumb-init_*.deb .
23+
RUN ln -sf /usr/local/bin/nsfminer /usr/local/bin/ethminer \
24+
&& dpkg -i dumb-init_*.deb
25+
COPY entrypoint.sh /usr/local/bin/custom-entrypoint.sh
2226

2327
# TODO see if these env vars do anything still
2428
ENV GPU_FORCE_64BIT_PTR=0 \
@@ -27,11 +31,10 @@ ENV GPU_FORCE_64BIT_PTR=0 \
2731
GPU_MAX_ALLOC_PERCENT=100 \
2832
GPU_SINGLE_ALLOC_PERCENT=100 \
2933
WALLET_ADDRESS=0xf0bEA86827AE84B7a712a4Bc716a15C465be3878 \
30-
MINE_POOL=us1.ethermine.org \
34+
MINING_POOLS="us1.ethermine.org" \
3135
STRATUM_TLS_PORT=5555 \
32-
API_PORT=3333 \
33-
WORKER_ID=rdu-01a
36+
API_PORT=3333
3437

35-
ENTRYPOINT ["sh", "-c"]
36-
CMD ["nsfminer -U -P stratum+tls12://${WALLET_ADDRESS}.${WORKER_ID}@${MINE_POOL}:${STRATUM_TLS_PORT} --report-hashrate --api-port -${API_PORT}"]
38+
ENTRYPOINT ["/usr/local/bin/custom-entrypoint.sh"]
39+
CMD ["--help"]
3740
EXPOSE ${API_PORT}/tcp

miner/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.5.0

miner/entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
miningPools=($MINING_POOLS)
6+
poolArgs=""
7+
for pool in "${miningPools[@]}"; do
8+
poolArgs="${poolArgs} -P stratum+ssl://${WALLET_ADDRESS}.${HOSTNAME}@${pool}:${STRATUM_TLS_PORT}"
9+
done
10+
11+
# negative port number indicates API is in read-only mode preventing miner from being tampered with
12+
# ensure SIGINTs get mapped to SIGTERMs
13+
exec dumb-init --rewrite 15:2 nsfminer \
14+
-U \
15+
${poolArgs} \
16+
--api-port "-${API_PORT}" $@

0 commit comments

Comments
 (0)