-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy: add Makefile for easier docker deploy
- Loading branch information
1 parent
c93adba
commit 402c5e3
Showing
6 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
sitemap | ||
data | ||
docker-compose.yml | ||
backend/mempool-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# If you see pwd_unknown showing up check permissions | ||
PWD ?= pwd_unknown | ||
|
||
# DATABASE DEPLOY FOLDER CONFIG - default ./data | ||
ifeq ($(data),) | ||
DATA := data | ||
export DATA | ||
else | ||
DATA := $(data) | ||
export DATA | ||
endif | ||
|
||
.PHONY: help | ||
help: | ||
@echo '' | ||
@echo '' | ||
@echo ' Usage: make [COMMAND]' | ||
@echo '' | ||
@echo ' make all # build init mempool and electrs' | ||
@echo ' make init # setup some useful configs' | ||
@echo ' make mempool # build q dockerized mempool.space' | ||
@echo ' make electrs # build a docker electrs image' | ||
@echo '' | ||
|
||
.PHONY: init | ||
init: | ||
@echo '' | ||
mkdir -p $(DATA) $(DATA)/mysql $(DATA)/mysql/db-scripts $(DATA)/mysql/data | ||
install -v mariadb-structure.sql $(DATA)/mysql/db-scripts | ||
#REF: https://github.com/mempool/mempool/blob/master/docker/README.md | ||
cat docker/docker-compose.yml > docker-compose.yml | ||
cat backend/mempool-config.sample.json > backend/mempool-config.json | ||
.PHONY: mempool | ||
mempool: init | ||
@echo '' | ||
docker-compose up --force-recreate --always-recreate-deps | ||
@echo '' | ||
.PHONY: electrs | ||
electrum: | ||
#REF: https://hub.docker.com/r/beli/electrum | ||
@echo '' | ||
docker build -f docker/electrum/Dockerfile . | ||
@echo '' | ||
.PHONY: all | ||
all: init | ||
make mempool | ||
####################### | ||
-include Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# For additional configs/scripting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
version: "3.7" | ||
|
||
services: | ||
|
||
electrum: | ||
build: | ||
context: . | ||
dockerfile: docker/electrum/Dockerfile | ||
user: "1000:1000" | ||
restart: on-failure | ||
command: "" | ||
ports: | ||
- 50001:50001 | ||
- 50002:50002 | ||
- 4224:4224 | ||
- 8332:8332 | ||
environment: | ||
ELECTRUM: "electrum" | ||
# add electrs configs | ||
web: | ||
image: mempool/frontend:latest | ||
user: "1000:1000" | ||
restart: on-failure | ||
stop_grace_period: 1m | ||
command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'" | ||
ports: | ||
- 80:8080 | ||
environment: | ||
FRONTEND_HTTP_PORT: "8080" | ||
BACKEND_MAINNET_HTTP_HOST: "api" | ||
api: | ||
image: mempool/backend:latest | ||
user: "1000:1000" | ||
restart: on-failure | ||
stop_grace_period: 1m | ||
command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh" | ||
volumes: | ||
- ./data:/backend/cache | ||
environment: | ||
RPC_HOST: "127.0.0.1" | ||
RPC_PORT: "8332" | ||
RPC_USER: "mempool" | ||
RPC_PASS: "mempool" | ||
ELECTRUM_HOST: "127.0.0.1" | ||
ELECTRUM_PORT: "50002" | ||
ELECTRUM_TLS: "false" | ||
MYSQL_HOST: "db" | ||
MYSQL_PORT: "3306" | ||
MYSQL_DATABASE: "mempool" | ||
MYSQL_USER: "mempool" | ||
MYSQL_PASS: "mempool" | ||
BACKEND_MAINNET_HTTP_PORT: "8999" | ||
CACHE_DIR: "/backend/cache" | ||
MEMPOOL_CLEAR_PROTECTION_MINUTES: "20" | ||
db: | ||
image: mariadb:10.5.8 | ||
user: "1000:1000" | ||
restart: on-failure | ||
stop_grace_period: 1m | ||
volumes: | ||
- ./mysql/data:/var/lib/mysql | ||
- ./mysql/db-scripts:/docker-entrypoint-initdb.d | ||
environment: | ||
MYSQL_DATABASE: "mempool" | ||
MYSQL_USER: "mempool" | ||
MYSQL_PASSWORD: "mempool" | ||
MYSQL_ROOT_PASSWORD: "admin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM ubuntu:18.04 | ||
MAINTAINER mempool.space developers | ||
EXPOSE 50002 | ||
|
||
# runs as UID 1000 GID 1000 inside the container | ||
|
||
ENV VERSION 4.0.9 | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gpg gpg-agent dirmngr \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget xpra python3-pyqt5 python3-wheel python3-pip python3-setuptools libsecp256k1-0 libsecp256k1-dev python3-numpy python3-dev build-essential \ | ||
&& wget /tmp/Electrum-${VERSION}.tar.gz https://download.electrum.org/${VERSION}/Electrum-${VERSION}.tar.gz \ | ||
&& wget /tmp/Electrum-${VERSION}.tar.gz.asc https://download.electrum.org/${VERSION}/Electrum-${VERSION}.tar.gz.asc \ | ||
&& gpg --verify /tmp/Electrum-${VERSION}.tar.gz.asc \ | ||
&& pip3 install /tmp/Electrum-${VERSION}.tar.gz \ | ||
&& test -f /usr/local/bin/electrum \ | ||
&& rm -vrf /tmp/Electrum-${VERSION}.tar.gz /tmp/Electrum-${VERSION}.tar.gz.asc ${HOME}/.gnupg \ | ||
&& apt-get purge --autoremove -y python3-wheel python3-pip python3-setuptools python3-dev build-essential libsecp256k1-dev curl gpg gpg-agent dirmngr \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* \ | ||
&& useradd -d /home/mwmpool -m mempool \ | ||
&& mkdir /electrum \ | ||
&& ln -s /electrum /home/mempool/.electrum \ | ||
&& chown mempool:mempool /electrum | ||
|
||
USER mempool | ||
ENV HOME /home/mempool | ||
WORKDIR /home/mempool | ||
VOLUME /electrum | ||
|
||
CMD ["/usr/bin/xpra", "start", ":100", "--start-child=/usr/local/bin/electrum", "--bind-tcp=0.0.0.0:50002","--daemon=yes", "--notifications=no", "--mdns=no", "--pulseaudio=no", "--html=off", "--speaker=disabled", "--microphone=disabled", "--webcam=no", "--printing=no", "--dbus-launch=", "--exit-with-children"] | ||
ENTRYPOINT ["electrum"] |