Skip to content
Closed
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
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ Live instance: [matreon.sprovoost.nl](https://matreon.sprovoost.nl/)

You need to run [c-lightning](https://github.com/ElementsProject/lightning) and [Lightning Charge](https://github.com/ElementsProject/lightning-charge) somewhere.

## Deploy with Docker

Install [Docker](https://docs.docker.com/install/).

Work in progress. For now it just launches `bitcoind` and syncs the node:

Create a directory to store the blockchain, wallet info, etc:

```sh
mkdir matreon-vol
pushd matreon-vol
mkdir bitcoin
popd
```

Build the docker image:

```sh
docker build docker -t matreon:latest
```

Run docker:

```sh
docker run --rm --name matreon -v $(PWD)/matreon-vol/bitcoin:/home/bitcoin/.bitcoin -it matreon:latest -printtoconsole
```

## Deploy to Heroku

Create a new Heroku app `app-name` and add the Sendgrid Add-On.
Expand Down
48 changes: 48 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM debian:stable-slim

RUN useradd -r bitcoin \
&& apt-get update -y \
&& apt-get install -y curl gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& set -ex \
&& for key in \
B42F6819007F00F88E364FD4036A9C25BF357DD4 \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \
done

ENV GOSU_VERSION=1.10

RUN curl -o /usr/local/bin/gosu -fSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture) \
&& curl -o /usr/local/bin/gosu.asc -fSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture).asc \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu

ENV BITCOIN_VERSION=0.16.0
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH

RUN curl -SL https://bitcoin.org/laanwj-releases.asc | gpg --import \
&& curl -SLO https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc \
&& curl -SLO https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \
&& gpg --verify SHA256SUMS.asc \
&& grep " bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \
&& tar -xzf *.tar.gz -C /opt \
&& rm *.tar.gz *.asc

COPY entrypoint.sh /entrypoint.sh

VOLUME ["/home/bitcoin/.bitcoin"]

COPY bitcoin.conf /home/bitcoin/.bitcoin/bitcoin.conf

EXPOSE 8332 8333

ENTRYPOINT ["/entrypoint.sh"]

CMD ["bitcoind"]
2 changes: 2 additions & 0 deletions docker/bitcoin.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
listen=0
prune=2000
26 changes: 26 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh
set -e

if [ $(echo "$1" | cut -c1) = "-" ]; then
echo "$0: assuming arguments for bitcoind"

set -- bitcoind "$@"
fi

if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "bitcoind" ]; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
chown -R bitcoin "$BITCOIN_DATA"

echo "$0: setting data directory to $BITCOIN_DATA"

set -- "$@" -datadir="$BITCOIN_DATA"
fi

if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then
echo
exec gosu bitcoin "$@"
fi

echo
exec "$@"