Skip to content

Commit

Permalink
Miner v0.5.0 - Syslog, extra args, and custom entrypoint with dumb-in…
Browse files Browse the repository at this point in the history
…it (#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
  • Loading branch information
onelapahead authored Feb 19, 2021
1 parent aa45034 commit 78a636d
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/miner-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ jobs:
- name: build and test
run: |
docker build . -t ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }}
docker run -i ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }} 'nsfminer --help'
docker run -i ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }} 'ethminer --help'
docker run --entrypoint /usr/local/bin/nsfminer -i ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }} '--help'
docker push ghcr.io/hfuss/miner:${{ steps.versions.outputs.dirty-version }}
working-directory: miner

Expand Down
4 changes: 2 additions & 2 deletions charts/miner/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description: A Helm chart for deploying an Ethereum GPU miner on Kubernetes.
maintainers:
- name: hfuss
type: application
version: 0.1.0
appVersion: "0.4.0"
version: 0.2.0
appVersion: "0.5.0"
15 changes: 9 additions & 6 deletions charts/miner/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --report-hashrate
- --syslog
- --exit
{{- if .Values.extraArgs }}
{{- toYaml .Values.extraArgs | nindent 12 }}
{{- end }}
env:
- name: WORKER_ID
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MINE_POOL
value: {{ .Values.config.miningPool | quote }}
- name: MINING_POOLS
value: {{ .Values.miningPools | join " " | quote }}
ports:
- name: jsonrpc
containerPort: 3333
Expand Down
13 changes: 10 additions & 3 deletions charts/miner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ image:
repository: ghcr.io/hfuss/miner
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: v0.4.0
tag: v0.5.0 # TODO v0.5.0

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

config:
miningPool: us1.ethermine.org
miningPools:
- us1.ethermine.org
- us2.ethermine.org
- eu1.ethermine.org
- asia1.ethermine.org

extraArgs: []
# - --eval
# - --failover-timeout=1

serviceAccount:
# Specifies whether a service account should be created
Expand Down
2 changes: 1 addition & 1 deletion gitops/deploys/application-miner-brx-01a.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
source:
repoURL: https://github.com/hfuss/ethernetes
path: charts/miner
targetRevision: latest-miner
targetRevision: main
helm:
values: |
nodeSelector:
Expand Down
9 changes: 9 additions & 0 deletions miner/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Dependencies
- ...

## [v0.5.0]
### Added
- Custom `entrypoint.sh` is copied to the image as `/usr/local/bin/custom-entrypoint.sh` to allow
for extra args and `dumb-init`

### Dependencies
- Latest Ethereum miner [`https://github.com/no-fee-ethereum-mining/[email protected]`](https://github.com/no-fee-ethereum-mining/nsfminer/releases/tag/v1.3.5)


## [v0.4.0]
### Changed
- Decreasing the final image size using the `base` image rather than
Expand Down
19 changes: 11 additions & 8 deletions miner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ RUN mkdir /ethminer
WORKDIR /ethminer

RUN apt-get install -y curl \
&& 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 \
&& 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 \
&& tar -xzvf ethminer.tgz \
&& mv nsfminer /usr/local/bin/ \
&& rm -rf *
&& rm -rf * \
&& 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

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

COPY --from=ethminer /usr/local/bin/nsfminer /usr/local/bin/nsfminer
RUN ln -sf /usr/local/bin/nsfminer /usr/local/bin/ethminer
COPY --from=ethminer /ethminer/dumb-init_*.deb .
RUN ln -sf /usr/local/bin/nsfminer /usr/local/bin/ethminer \
&& dpkg -i dumb-init_*.deb
COPY entrypoint.sh /usr/local/bin/custom-entrypoint.sh

# TODO see if these env vars do anything still
ENV GPU_FORCE_64BIT_PTR=0 \
Expand All @@ -27,11 +31,10 @@ ENV GPU_FORCE_64BIT_PTR=0 \
GPU_MAX_ALLOC_PERCENT=100 \
GPU_SINGLE_ALLOC_PERCENT=100 \
WALLET_ADDRESS=0xf0bEA86827AE84B7a712a4Bc716a15C465be3878 \
MINE_POOL=us1.ethermine.org \
MINING_POOLS="us1.ethermine.org" \
STRATUM_TLS_PORT=5555 \
API_PORT=3333 \
WORKER_ID=rdu-01a
API_PORT=3333

ENTRYPOINT ["sh", "-c"]
CMD ["nsfminer -U -P stratum+tls12://${WALLET_ADDRESS}.${WORKER_ID}@${MINE_POOL}:${STRATUM_TLS_PORT} --report-hashrate --api-port -${API_PORT}"]
ENTRYPOINT ["/usr/local/bin/custom-entrypoint.sh"]
CMD ["--help"]
EXPOSE ${API_PORT}/tcp
2 changes: 1 addition & 1 deletion miner/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.5.0
16 changes: 16 additions & 0 deletions miner/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

miningPools=($MINING_POOLS)
poolArgs=""
for pool in "${miningPools[@]}"; do
poolArgs="${poolArgs} -P stratum+ssl://${WALLET_ADDRESS}.${HOSTNAME}@${pool}:${STRATUM_TLS_PORT}"
done

# negative port number indicates API is in read-only mode preventing miner from being tampered with
# ensure SIGINTs get mapped to SIGTERMs
exec dumb-init --rewrite 15:2 nsfminer \
-U \
${poolArgs} \
--api-port "-${API_PORT}" $@

0 comments on commit 78a636d

Please sign in to comment.