Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added generic docker-compose.yml #213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ docs/_build
.vscode/
.mypy_cache/
.idea/
contrib/.env
8 changes: 7 additions & 1 deletion contrib/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ VOLUME /var/lib/electrumx

RUN mkdir -p "$DB_DIRECTORY" && ulimit -n 1048576

STOPSIGNAL SIGINT

CMD ["/usr/src/app/venv/bin/python", "/usr/src/app/venv/bin/electrumx_server"]

# build it with eg.: `docker build -t electrumx .`
# run it with eg.:
# `docker run -d --net=host -v /home/electrumx/db/:/var/lib/electrumx -e DAEMON_URL="http://youruser:yourpass@localhost:8332" -e REPORT_SERVICES=tcp://example.com:50001 electrumx`
# `docker run -d --net=host \
# -v /home/electrumx/db/:/var/lib/electrumx \
# -e DAEMON_URL="http://youruser:yourpass@localhost:8332" \
# -e REPORT_SERVICES=tcp://example.com:50001 \
# electrumx`
# for a clean shutdown, send TERM signal to the running container eg.: `docker kill --signal="TERM" CONTAINER_ID`
51 changes: 51 additions & 0 deletions contrib/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: "3.7"

services:

electrumx:
container_name: electrumx
#define $UID, $GID in .env file the user to run docker and write in data folder
#user: "$UID:$GID"
environment:
## create a copy of ./dot.env.sample in new .env file
## references: ../docs/environment.rst
#
#CACHE_MB: 2000
#COST_HARD_LIMIT: 10000
#COST_SOFT_LIMIT: 1000
#DAEMON_VERSION:
#DB_ENGINE: leveldb
#MAX_SEND: 1000000
#MAX_SESSIONS: 30000
#PEER_ANNOUNCE:
#REQUEST_TIMEOUT: 30
#SERVICES: "tcp://:50001,ssl://:50002,wss://:50004,rpc://0.0.0.0:8000"
#SSL_CERTFILE: /etc/ssl/certs/electrumx.crt
#SSL_KEYFILE: /etc/ssl/private/electrumx.key
ALLOW_ROOT: true
COIN: Bitcoin
#define $USERPASS in .env file
#define $DAEMON_HOST .env file, use 172.17.0.1 if bitcoincore in the same machine of docker
DAEMON_URL: "http://$USERPASS@$DAEMON_HOST:8332/"
DB_DIRECTORY: /var/lib/electrumx
DB_ENGINE: leveldb
LOG_LEVEL: debug
PEER_DISCOVERY: 'off'
SERVICES: "tcp://:50001"

build:
context: .
args:
VERSION: $VERSION
dockerfile: ./Dockerfile
image: electrumx:latest
restart: "no"
ports:
- "50001:50001"
- "50002:50002"
- "50004:50004"
- "8000:8000"
#volumes:
#define $DATA folder in .env file
#- $DATA:/var/lib/electrumx
#- ./ssl:/etc/ssl
5 changes: 5 additions & 0 deletions contrib/dot.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DATA=/data
UID=1000
GID=1000
DAEMON_HOST=172.17.0.1
USERPASS=user:pass