Skip to content

Commit 37e645c

Browse files
committed
Improve xmr packages and create default wallet
1 parent 6ce4332 commit 37e645c

File tree

7 files changed

+58
-65
lines changed

7 files changed

+58
-65
lines changed

docker-compose/testnet/xmr.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ services:
33
monerod:
44
build: ../../packages/nodechain-monerod
55
image: monerod
6-
command: --stagenet --p2p-bind-ip=0.0.0.0 --p2p-bind-port=38080 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=38081 --non-interactive --confirm-external-bind
6+
command: --stagenet --p2p-bind-ip=0.0.0.0 --p2p-bind-port=38080 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=38081 --non-interactive --confirm-external-bind --prune-blockchain
77
volumes:
88
- ${BLOCKCHAIN_PATH}/bitmonero:/home/monero/.bitmonero
9-
user: "${UID}:${GID}"
109

1110
wallet:
1211
build: ../../packages/nodechain-monero-wallet
1312
image: monero-wallet
14-
command: --daemon-address=monerod:38081 --stagenet --disable-rpc-login --trusted-daemon --rpc-bind-port=38088 --non-interactive
13+
command: --daemon-address=monerod:38081 --stagenet --disable-rpc-login --trusted-daemon --rpc-bind-port=38088 --non-interactive --log-level=4
1514
volumes:
1615
- ${BLOCKCHAIN_PATH}/bitmonero:/home/monero/.bitmonero
1716
depends_on:
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
21
FROM ubuntu:latest
32
# Create a user if required
43
RUN useradd -r monero
54
# Setup and cleanup of the packages required
65
RUN apt-get update \
7-
&& apt-get install -y wget \
6+
&& apt-get install -y curl \
87
&& rm -rf /var/lib/apt/lists/*
98
# Declare the environment variables (version, path, data-dir etc)
10-
ENV MONERO_VERSION=0.17.2.3
9+
ENV MONERO_VERSION=0.17.3.0
10+
ENV MONERO_SHA256=ac18ce3d1189410a5c175984827d5d601974733303411f6142296d647f6582ce
1111
ENV MONERO_DATA=/home/monero/.bitmonero
1212
# Get the compiled binaries and extract them
13-
RUN wget https://dlsrc.getmonero.org/cli/monero-linux-x64-v${MONERO_VERSION}.tar.bz2
14-
RUN tar -xf *.tar.bz2 -C /opt
13+
RUN curl https://dlsrc.getmonero.org/cli/monero-linux-x64-v$MONERO_VERSION.tar.bz2 -O &&\
14+
echo "$MONERO_SHA256 monero-linux-x64-v$MONERO_VERSION.tar.bz2" | sha256sum -c - &&\
15+
tar -xvf monero-linux-x64-v$MONERO_VERSION.tar.bz2 -C /opt
16+
# RUN wget https://dlsrc.getmonero.org/cli/monero-linux-x64-v${MONERO_VERSION}.tar.bz2
17+
# RUN tar -xf *.tar.bz2 -C /opt
1518
# Cleanup the workspace
1619
RUN rm *.tar.bz2
1720
# Append the bin folder to the %PATH%
@@ -20,11 +23,10 @@ ENV PATH=/opt/monero-x86_64-linux-gnu-v${MONERO_VERSION}:$PATH
2023
VOLUME ["/home/monero/.bitmonero"]
2124
# Expose required ports (both testnet & mainnet)
2225
EXPOSE 18088 28088 38088
23-
24-
COPY swapper-stagenet swapper
25-
COPY swapper-stagenet.keys swapper.keys
26+
# Copy wallet directory
27+
COPY /wallet-dir /wallet-dir
2628
# Copy and define the entrypoint
27-
COPY entrypoint.sh ./entrypoint.sh
29+
COPY entrypoint.sh /entrypoint.sh
2830
ENTRYPOINT ["sh", "/entrypoint.sh"]
2931
# Define the default command
3032
CMD ["monero-wallet-rpc"]

packages/nodechain-monero-wallet/entrypoint.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ if [ $(echo "$1" | cut -c1) = "-" ]; then
77
set -- monero-wallet-rpc "$@"
88
fi
99

10-
1110
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "monero-wallet-rpc" ]; then
1211
mkdir -p "$MONERO_DATA"
12+
mv "./wallet-dir" "$MONERO_DATA/wallet-dir"
1313
chmod 700 "$MONERO_DATA"
1414
chown -R monero "$MONERO_DATA"
15-
mv swapper "$MONERO_DATA/swapper"
16-
mv swapper.keys "$MONERO_DATA/swapper.keys"
1715

1816
echo "$0: setting data directory to $MONERO_DATA"
1917

20-
set -- "$@" --log-file="$MONERO_DATA/debug.log" --wallet-file="$MONERO_DATA/swapper" --password="swapper"
18+
set -- "$@" --wallet-dir="$MONERO_DATA/wallet-dir" --log-file="$MONERO_DATA/debug.log" # --config-file="$MONERO_DATA/monero-wallet-cli.conf"
2119
fi
2220

2321
echo

packages/nodechain-monerod/Dockerfile

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
1-
# Usage: docker run --restart=always -v /var/data/blockchain-xmr:/root/.bitmonero -p 18080:18080 -p 18081:18081 --name=monerod -td kannix/monero-full-node
2-
FROM debian:bullseye-slim AS build
3-
4-
ENV MONERO_VERSION=0.17.2.3 MONERO_SHA256=8069012ad5e7b35f79e35e6ca71c2424efc54b61f6f93238b182981ba83f2311
5-
6-
RUN apt-get update && apt-get install -y curl bzip2 gosu
7-
8-
WORKDIR /root
9-
1+
FROM ubuntu:latest
2+
# Create a user if required
3+
RUN useradd -r monero
4+
# Setup and cleanup of the packages required
5+
RUN apt-get update \
6+
&& apt-get install -y curl \
7+
&& rm -rf /var/lib/apt/lists/*
8+
# Declare the environment variables (version, path, data-dir etc)
9+
ENV MONERO_VERSION=0.17.3.0
10+
ENV MONERO_SHA256=ac18ce3d1189410a5c175984827d5d601974733303411f6142296d647f6582ce
11+
ENV MONERO_DATA=/home/monero/.bitmonero
12+
# Get the compiled binaries and extract them
1013
RUN curl https://dlsrc.getmonero.org/cli/monero-linux-x64-v$MONERO_VERSION.tar.bz2 -O &&\
1114
echo "$MONERO_SHA256 monero-linux-x64-v$MONERO_VERSION.tar.bz2" | sha256sum -c - &&\
12-
tar -xvf monero-linux-x64-v$MONERO_VERSION.tar.bz2 &&\
13-
rm monero-linux-x64-v$MONERO_VERSION.tar.bz2 &&\
14-
cp ./monero-x86_64-linux-gnu-v$MONERO_VERSION/monerod . &&\
15-
rm -r monero-*
16-
17-
FROM debian:bullseye-slim
18-
19-
RUN useradd -ms /bin/bash monero && mkdir -p /home/monero/.bitmonero && chown -R monero:monero /home/monero/.bitmonero
20-
USER monero
21-
WORKDIR /home/monero
22-
23-
COPY --chown=monero:monero --from=build /root/monerod /home/monero/monerod
24-
25-
VOLUME /home/monero/.bitmonero
26-
27-
EXPOSE 18080 18081 18082 38080 38081
28-
29-
30-
COPY --chown=monero:monero entrypoint.sh ./entrypoint.sh
31-
RUN chmod +x entrypoint.sh
32-
ENTRYPOINT ["/home/monero/entrypoint.sh"]
33-
34-
ENTRYPOINT ["./monerod"]
35-
36-
CMD ["monero-wallet-rpc"]
15+
tar -xvf monero-linux-x64-v$MONERO_VERSION.tar.bz2 -C /opt
16+
# RUN wget https://dlsrc.getmonero.org/cli/monero-linux-x64-v${MONERO_VERSION}.tar.bz2
17+
# RUN tar -xf *.tar.bz2 -C /opt
18+
# Cleanup the workspace
19+
RUN rm *.tar.bz2
20+
# Append the bin folder to the %PATH%
21+
ENV PATH=/opt/monero-x86_64-linux-gnu-v${MONERO_VERSION}:$PATH
22+
# Mount volume
23+
VOLUME ["/home/monero/.bitmonero"]
24+
# Expose required ports (both testnet & mainnet)
25+
EXPOSE 18080 18081 28080 28081 38080 38081
26+
# Copy and define the entrypoint
27+
COPY entrypoint.sh /entrypoint.sh
28+
ENTRYPOINT ["sh", "/entrypoint.sh"]
29+
# Define the default command
30+
CMD ["monerod"]
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
set -e
33

4-
# if thrown flags immediately,
5-
# assume they want to run the blockchain daemon
6-
if [ "${1:0:1}" = '-' ]; then
7-
set -- monerod "$@"
4+
if [ $(echo "$1" | cut -c1) = "-" ]; then
5+
echo "$0: assuming arguments for monerod"
6+
7+
set -- monerod "$@"
88
fi
99

10-
# if they are running the blockchain daemon,
11-
# make efficient use of memory
12-
if [ "$1" = 'monerod' ]; then
13-
numa='numactl --interleave=all'
14-
if $numa true &> /dev/null; then
15-
set -- $numa "$@"
16-
fi
17-
exec "$@"
10+
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "monerod" ]; then
11+
mkdir -p "$MONERO_DATA"
12+
chmod 700 "$MONERO_DATA"
13+
chown -R monero "$MONERO_DATA"
14+
15+
echo "$0: setting data directory to $MONERO_DATA"
16+
17+
set -- "$@" --data-dir="$MONERO_DATA" # --non-interactive --config-file="$MONERO_DATA/monerod.conf"
1818
fi
1919

20-
# otherwise, don't get in their way
21-
exec "$@"
20+
echo
21+
exec "$@"

0 commit comments

Comments
 (0)