diff --git a/Dockerfile b/Dockerfile index 91a6d2e..b85d78c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,17 @@ -# NodeJS Builder container -FROM buildpack-deps:bullseye-curl as nodejs-builder - -RUN apt-get update && \ - apt-get install -y xz-utils python && \ - rm -rf /var/lib/apt/lists/* - -RUN curl https://nodejs.org/dist/v14.18.1/node-v14.18.1-linux-arm64.tar.xz --output node-v14.18.1-linux-arm64.tar.xz -RUN tar xvf node-v14.18.1-linux-arm64.tar.xz - -# urbit-bitcoin-rpc Builder container -FROM buildpack-deps:bullseye as urbit-rpc-builder - -ADD https://api.github.com/repos/urbit/urbit-bitcoin-rpc/git/refs/heads/master version.json -RUN git clone -b master https://github.com/urbit/urbit-bitcoin-rpc.git urbit-bitcoin-rpc - -# urbit-bitcoin-node container -FROM debian:bullseye-slim - -# These buildargs can be set during container build time with --build-arg UID=[uid] +FROM debian:buster-slim ARG UID=1000 ARG GID=1000 -ARG USERNAME=user +ARG username=umbrel +RUN apt-get update && apt-get install -y curl +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash +RUN apt-get update && apt-get --no-install-recommends intall -y curl wget vim gnupg procps nginx apt-utils sudo nodejs git sudo -RUN apt-get update && \ - apt-get install -y iproute2 sudo && \ - rm -rf /var/lib/apt/lists/* - -# Allow the new user write access to /etc/hosts -RUN groupadd -g $GID -o $USERNAME && \ - useradd -m -u $UID -g $GID -o -d /home/$USERNAME -s /bin/bash $USERNAME && \ - echo "$USERNAME ALL=(ALL:ALL) NOPASSWD: /usr/bin/append-to-hosts" | tee -a /etc/sudoers - -# Copy files from the builder containers -COPY --from=nodejs-builder /node-v14.18.1-linux-arm64/ /usr/local/ -COPY --from=urbit-rpc-builder /urbit-bitcoin-rpc/* / -COPY --from=urbit-rpc-builder /urbit-bitcoin-rpc/src /src +ADD https://api.github.com/repos/urbit/urbit-bitcoin-rpc/git/refs/heads/master version.json +RUN git clone -b master https://github.com/urbit/urbit-bitcoin-rpc.git urbit-bitcoin-rpc -# Overwrite two files in the dist with our local slightly modified versions ADD /rpc/mainnet-start.sh /mainnet-start.sh ADD /rpc/server.js /src/server.js +ADD nginx.conf /etc/nginx/conf.d/nginx.conf RUN npm install express RUN npm audit fix @@ -48,7 +21,3 @@ USER $USERNAME EXPOSE 50002 ENTRYPOINT ["/mainnet-start.sh"] - - - - diff --git a/bin/append-to-hosts.sh b/bin/append-to-hosts.sh deleted file mode 100644 index 03439e5..0000000 --- a/bin/append-to-hosts.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# edit hosts as non-root -echo "$@" >> /etc/hosts diff --git a/docker-compose.yaml b/docker-compose.yaml index 7d2b1ae..1cf7b57 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,12 +6,12 @@ services: restart: on-failure stop_grace_period: 1m ports: - - 50002:50002 + - 55555:50002 environment: - $ELECTRUM_IP: $ELECTRUM_IP - $ELECTRUM_PORT: $ELECTRUM_PORT - $BITCOIN_IP: $BITCOIN_IP - $BITCOIN_RPC_PORT: $BITCOIN_RPC_PORT - $BITCOIN_RPC_USER: $BITCOIN_RPC_USER - $BITCOIN_RPC_PASS: $BITCOIN_RPC_PASS - $BITCOIN_RPC_AUTH: $BITCOIN_RPC_AUTH + ELECTRUM_IP: $ELECTRUM_IP + ELECTRUM_PORT: $ELECTRUM_PORT + BITCOIN_IP: $BITCOIN_IP + BITCOIN_RPC_PORT: $BITCOIN_RPC_PORT + BITCOIN_RPC_USER: $BITCOIN_RPC_USER + BITCOIN_RPC_PASS: $BITCOIN_RPC_PASS + BITCOIN_RPC_AUTH: $BITCOIN_RPC_AUTH diff --git a/index/index.html b/index/index.html new file mode 100644 index 0000000..8ed0a3b --- /dev/null +++ b/index/index.html @@ -0,0 +1,132 @@ + +
+This app will allow you to connect your Urbit's Bitcoin wallet to your Umbrel.
+Urbit's Bitcoin wallet talks to the blockchain like this:
+[%btc-wallet] <--> [%btc-provider] <--> [Full node]
+ You need to connect %btc-wallet to a configured provider before you can use it. %btc-wallet and %btc-provider may or may not be on the same ship.
+Connecting your ship
+First configure your provider:
+dojo> |rein %bitcoin [& %btc-provider]
+dojo> =network %main
+dojo> :btc-provider +bitcoin!btc-provider/command [%set-credentials api-url='http://127.0.0.1:55555' network]
+ You should see a new block announcement in the dojo. (If your ship is on another host, change the IP address.)
+ Whitelisting clients
+By default, only your provider's @p will be whitelisted for use. You can whitelist any other ship or groups of ships using the following commands.
+:: Individual ships ::
+dojo> :btc-provider +bitcoin!btc-provider/command [%add-whitelist [%users users=(sy ~[~wallet-hodler])]]
+
+:: Group members (provider ship must be a member) ::
+dojo> :btc-provider +bitcoin!btc-provider/command [%add-whitelist [%groups groups=(sy ~[[~sampel %group-name]])]]
+
+:: %kids ::
+dojo> :btc-provider +bitcoin!btc-provider/command [%add-whitelist %kids ~]
+
+:: Public whitelisting ::
+dojo> :btc-provider +bitcoin!btc-provider/command [%add-whitelist %public ~]
+
+