Skip to content

Instantly share code, notes, and snippets.

@ubunteroz
Created March 22, 2022 17:22
Show Gist options
  • Save ubunteroz/f92e4fdca6d241dac675f96067fa4fef to your computer and use it in GitHub Desktop.
Save ubunteroz/f92e4fdca6d241dac675f96067fa4fef to your computer and use it in GitHub Desktop.
Akash SDL for Deploying monero-pool
---
version: "2.0"
services:
monero-pool:
image: ghcr.io/ubunteroz/monero-pool:0.17-3
expose:
- port: 4242
as: 4242
to:
- global: true
- port: 4243
as: 4243
to:
- global: true
- port: 28092
as: 28092
to:
- global: true
env:
- MONERO_ARGS=--testnet
- MONERO_WALLET_ARGS=--testnet
- MONERO_POOL_WALLET=9tRe6v9cHkX7LZTS4hampTAai5kT1rLzddNkKKAiTAg1cg3GHB8zVkv8pBjQ9uzWpwQMZgxn99BDtR3Fy5HRGKURJ3AxUNH
- MONERO_POOL_WALLET_SEED=swept upper silk slackens oval nostril narrate dude match pledge inwardly cuisine point soothe excess drunk mouth upgrade zero friendly catch alkaline sapling simplest upper
- MONERO_FEE_WALLET=9unzQP9GZKKWgdHPkQwMFVhHMdr9EPFw4eN4gm9E58mWLorVXSLKAWkQhBSxckQwNsdnBczkeC2XBDEfgJMW2CNXNk45NDv
profiles:
compute:
monero-pool-profile:
resources:
cpu:
units: 8.0
memory:
size: 16Gi
storage:
size: 100Gi
placement:
akash:
pricing:
monero-pool-profile:
denom: uakt
amount: 1000
deployment:
monero-pool:
akash:
profile: monero-pool-profile
count: 1
# BASE IMAGE
FROM ubuntu:20.04 AS base
ARG monero_version=0.17
ENV DEBIAN_FRONTEND=noninteractive
# Environment variables
ENV MONERO_ARGS="--testnet"
ENV MONERO_WALLET_ARGS="--testnet"
ENV MONERO_POOL_WALLET="9tRe6v9cHkX7LZTS4hampTAai5kT1rLzddNkKKAiTAg1cg3GHB8zVkv8pBjQ9uzWpwQMZgxn99BDtR3Fy5HRGKURJ3AxUNH"
ENV MONERO_POOL_WALLET_SEED="swept upper silk slackens oval nostril narrate dude match pledge inwardly cuisine point soothe excess drunk mouth upgrade zero friendly catch alkaline sapling simplest upper"
ENV MONERO_FEE_WALLET="9unzQP9GZKKWgdHPkQwMFVhHMdr9EPFw4eN4gm9E58mWLorVXSLKAWkQhBSxckQwNsdnBczkeC2XBDEfgJMW2CNXNk45NDv"
RUN apt-get update
# BUILDER IMAGE
FROM base AS builder
# Build deps for Monero
RUN apt-get install -y --no-install-recommends git build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev ccache doxygen graphviz
RUN apt-get install -y ca-certificates
# Build Monero
RUN mkdir -p /root/monero
RUN cd /root/monero && git clone https://github.com/monero-project/monero.git .
RUN cd /root/monero && git checkout release-v${monero_version} && git submodule init && git submodule update
RUN cd /root/monero && make -j4 release-static
# Build deps for Monero Pool
RUN apt-get install -y liblmdb-dev libevent-dev libjson-c-dev uuid-dev xxd
# Build Monero Pool
RUN mkdir -p /root/monero-pool
RUN cd /root/monero-pool && git clone --depth=1 https://github.com/jtgrassie/monero-pool.git .
RUN cd /root/monero-pool && MONERO_ROOT=/root/monero make -j4 release
# FINAL IMAGE
FROM base
RUN apt-get install -y tini curl libgssapi-krb5-2 liblmdb0 libevent-2.1-7 libjson-c4 uuid libunbound8 libboost-filesystem1.71.0 libboost-thread1.71.0 libboost-regex1.71.0 libhidapi-libusb0 libevent-core-2.1-7 libsodium23 && apt-get clean
# Copy resulting binaries & conf to /usr/local/{bin|etc}
COPY --from=builder /root/monero/build/Linux/release-v${monero_version}/release/bin/monerod /usr/local/bin/
COPY --from=builder /root/monero/build/Linux/release-v${monero_version}/release/bin/monero-wallet-rpc /usr/local/bin/
COPY --from=builder /root/monero-pool/build/release/monero-pool /usr/local/bin/
COPY --from=builder /root/monero-pool/build/release/pool.conf /usr/local/etc/
# Copy entrypoint script to /usr/local/bin
COPY ./run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/run.sh
ENTRYPOINT ["tini", "--", "/usr/local/bin/run.sh"]
EXPOSE 4242 4243 28092
#!/bin/bash
DATA_MONERO=/data/monero
DATA_WALLET=/data/wallet
DATA_WALLET_LOG=/data/wallet.log
DATA_POOL=/data/pool
set -x
echo Updating monero-pool config...
sed -i "s/wallet-rpc-port\(.*\)/wallet-rpc-port = 28088/" /usr/local/etc/pool.conf
sed -i "s/pool-wallet\(.*\)/pool-wallet = $MONERO_POOL_WALLET/" /usr/local/etc/pool.conf
sed -i "s/pool-fee-wallet\(.*\)/pool-fee-wallet = $MONERO_FEE_WALLET/" /usr/local/etc/pool.conf
sed -i "s/block-notified\(.*\)/block-notified = 0/" /usr/local/etc/pool.conf
sed -i "s/data-dir\(.*\)/data-dir = \/data\/pool/" /usr/local/etc/pool.conf
echo Running Monero daemon...
mkdir -p $DATA_MONERO
/usr/local/bin/monerod --detach --data-dir $DATA_MONERO \
--rpc-bind-ip 127.0.0.1 --rpc-bind-port 28081 \
--rpc-restricted-bind-ip 0.0.0.0 --rpc-restricted-bind-port 28092 --confirm-external-bind $MONERO_ARGS
echo Sleeping for 10 secs...
sleep 10
echo Running Monero wallet RPC daemon...
mkdir -p $DATA_WALLET
/usr/local/bin/monero-wallet-rpc --detach --wallet-dir $DATA_WALLET \
--log-file $DATA_WALLET_LOG --max-log-file-size 10485000 --max-log-files 10 \
--daemon-address 127.0.0.1:28081 --trusted-daemon \
--rpc-bind-ip 127.0.0.1 --rpc-bind-port 28088 --disable-rpc-login $MONERO_WALLET_ARGS
echo Sleeping for 10 secs...
sleep 10
echo Restoring wallet from mnemonic seed...
curl http://127.0.0.1:28088/json_rpc -d \
"{\"jsonrpc\":\"2.0\", \"id\":\"0\", \"method\":\"restore_deterministic_wallet\", \"params\":{\"filename\":\"pool_wallet\", \"password\":\"\", \"seed\":\"$MONERO_POOL_WALLET_SEED\"}}" \
-H "Content-Type: application/json"
echo Sleeping for 10 secs...
sleep 10
echo Running Monero pool...
mkdir -p $DATA_POOL
/usr/local/bin/monero-pool --config-file /usr/local/etc/pool.conf $@
@must479
Copy link

must479 commented Mar 22, 2022

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment