Open maltokyo opened 3 years ago
This looks like the same problem. But without any long term solution.. https://github.com/lukechilds/docker-electrumx/issues/60
OK, how I solved this (super hacky)
exec /electrumx/electrumx_compact_history
)docker build -t lukechilds/electrumx_temp
) @maltokyo Thanks, I found another way to do that is just do a one-off docker run -it
(interactive shell) on the same image. I ran into issues but this was because I forgot to mount my /data
volume.
docker run -v /path/to/electrum/data:/data -it electrumx /bin/sh
Then inside the container:
cd /electrumx
# You can avoid this if you pass these to your `docker run -it ....` command
export DAEMON_URL="http://rpcuser:rpcpass@x.x.x.x:8332
export COIN=BitcoinSegWit
export NET=mainnet
export PEER_ANNOUNCE=""
export PEER_DISCOVERY=""
export SERVICES="ssl://172.20.0.2:50002"
export REPORT_SERVICES=""
export INITIAL_CONCURRENT=100
export COST_SOFT_LIMIT=100000
export COST_HARD_LIMIT=1000000
export REQUEST_SLEEP=30000
./electrumx_compact_history
Here's a one-liner to perform history compact operations. It should work on any system that has docker installed and that has r/w access to the electrum data set.
docker run --rm --env COIN=BitcoinSegwit --env DB_DIRECTORY=/data -v "${PWD}/electrumx:/data" --entrypoint=/usr/local/bin/electrumx_compact_history lukechilds/electrumx:v1.16.0
Regarding long term solution, I don't think this has much to do with lukechilds' container, it might be helpful to comment on the issue on the electrumx repo, and maybe even the issue on the upstream repo.
If someone is running this on kubernetes with helm charts Id recommend the following with a compacting.enabled set to True in the value files of
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "service.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: volume-mount-hack
image: busybox
command: ["sh", "-c", "chown -R 999:999 /var/lib/electrumx"]
volumeMounts:
- name: electrumx-data
mountPath: /var/lib/electrumx
{{- if .Values.compacting.enabled }}
- name: compacting-hack
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ["/usr/local/bin/electrumx_compact_history"]
volumeMounts:
- name: electrumx-data
mountPath: /var/lib/electrumx
envFrom:
- secretRef:
name: {{ include "service.fullname" . }}-secrets
- configMapRef:
name: {{ include "service.fullname" . }}-configmap
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: ssl-key
mountPath: "/etc/electrumx.key"
subPath: "electrumx.key"
readOnly: true
- name: ssl-cert
mountPath: "/etc/electrumx.cert"
subPath: "electrumx.cert"
readOnly: true
- name: electrumx-data
mountPath: /var/lib/electrumx
envFrom:
- secretRef:
name: {{ include "service.fullname" . }}-secrets
- configMapRef:
name: {{ include "service.fullname" . }}-configmap
ports:
- name: rpc
containerPort: {{ .Values.config.service.rpcPort }}
- name: tcp
containerPort: {{ .Values.config.service.tcpPort }}
I cant work out what to do here, I keep getting this, every time the server starts.. Please advise if you have encountered this.