Code Monkey home page Code Monkey logo

Comments (5)

dorveille avatar dorveille commented on June 13, 2024 1

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.

from docker-electrumx.

maltokyo avatar maltokyo commented on June 13, 2024

This looks like the same problem. But without any long term solution..
#60

from docker-electrumx.

maltokyo avatar maltokyo commented on June 13, 2024

OK, how I solved this (super hacky)

  1. Stop the container
  2. Clone this git repo onto your server/computer
  3. Change the init file to run the compaction (change last line to this: exec /electrumx/electrumx_compact_history )
  4. Build a new image from the clone from using (for example docker build -t lukechilds/electrumx_temp )
  5. Then run this new image, and it will do everything needed. Shut down when finished (check logs to make sure it is finished)
  6. Revert back to the normal image.

from docker-electrumx.

4oo4 avatar 4oo4 commented on June 13, 2024

@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:[email protected]: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

from docker-electrumx.

tuwid avatar tuwid commented on June 13, 2024

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 }}   
  

from docker-electrumx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.