mirror of
https://github.com/lalanza808/xmr.sh.git
synced 2025-05-12 16:32:11 -04:00
Rename script, port and network select
This commit is contained in:
parent
7946a78e73
commit
05fb2e83f3
5 changed files with 108 additions and 13 deletions
1
.env
1
.env
|
@ -9,6 +9,7 @@ TRAEFIK_HTTP_PORT=80
|
||||||
MONEROD_TAG=latest
|
MONEROD_TAG=latest
|
||||||
MONEROD_RPC_PORT=18089
|
MONEROD_RPC_PORT=18089
|
||||||
MONEROD_P2P_PORT=18080
|
MONEROD_P2P_PORT=18080
|
||||||
|
MONEROD_EXTRA_PARAMS=--prune-blockchain
|
||||||
MONEROD_accessControlAllowOriginList=*
|
MONEROD_accessControlAllowOriginList=*
|
||||||
|
|
||||||
#TOR_TAG=latest
|
#TOR_TAG=latest
|
||||||
|
|
10
README.md
10
README.md
|
@ -13,10 +13,14 @@ Tested on:
|
||||||
|
|
||||||
- [x] Add wizard for DNS domain selection.
|
- [x] Add wizard for DNS domain selection.
|
||||||
- [x] Status and node info at finish.
|
- [x] Status and node info at finish.
|
||||||
- [ ] Stagenet / Testnet selection
|
- [ ] Mainnet / Stagenet / Testnet selection
|
||||||
|
- [ ] Pruning option
|
||||||
- [ ] Clearnet TLS port selection
|
- [ ] Clearnet TLS port selection
|
||||||
|
- [ ] Uninstall script
|
||||||
|
- [ ] Documentation
|
||||||
- [x] Make tor service optional
|
- [x] Make tor service optional
|
||||||
- [x] (Optional) block explorer
|
- [x] (Optional) block explorer
|
||||||
- [ ] Grafana with stats
|
- [ ] Grafana dashboard
|
||||||
- [ ] arm64 support
|
- [ ] arm64 support for all images.
|
||||||
|
- [ ] monerod-lws support.
|
||||||
- [ ] monerod-proxy support for fallback nodes.
|
- [ ] monerod-proxy support for fallback nodes.
|
||||||
|
|
|
@ -26,12 +26,12 @@ x-traefik-command-nole: &traefik-command-nole
|
||||||
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
|
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
|
||||||
- "--entrypoints.websecure.address=:${TRAEFIK_TLS_PORT}"
|
- "--entrypoints.websecure.address=:${TRAEFIK_TLS_PORT}"
|
||||||
|
|
||||||
x-monerod-mainnet-command: &monerod-mainnet-command
|
x-monerod-command: &monerod-command
|
||||||
command: >-
|
command: >-
|
||||||
--restricted-rpc --public-node --no-igd --no-zmq
|
--restricted-rpc --public-node --no-igd --no-zmq
|
||||||
--enable-dns-blocklist --rpc-restricted-bind-ip=0.0.0.0
|
--enable-dns-blocklist --rpc-restricted-bind-ip=0.0.0.0
|
||||||
--rpc-restricted-bind-port=${MONEROD_RPC_PORT} --confirm-external-bind
|
--rpc-restricted-bind-port=${MONEROD_RPC_PORT} --confirm-external-bind
|
||||||
--prune-blockchain
|
${MONEROD_EXTRA_PARAMS}
|
||||||
|
|
||||||
x-tor-service: &tor-service
|
x-tor-service: &tor-service
|
||||||
tor:
|
tor:
|
||||||
|
@ -92,7 +92,7 @@ services:
|
||||||
monerod:
|
monerod:
|
||||||
container_name: monerod
|
container_name: monerod
|
||||||
image: sethsimmons/simple-monerod:${MONEROD_TAG}
|
image: sethsimmons/simple-monerod:${MONEROD_TAG}
|
||||||
<<: *monerod-mainnet-command #!monerod-command
|
<<: *monerod-command
|
||||||
ports:
|
ports:
|
||||||
- "${MONEROD_P2P_PORT}:${MONEROD_P2P_PORT}" # Exposes P2P port
|
- "${MONEROD_P2P_PORT}:${MONEROD_P2P_PORT}" # Exposes P2P port
|
||||||
- "${MONEROD_RPC_PORT}"
|
- "${MONEROD_RPC_PORT}"
|
||||||
|
|
|
@ -48,9 +48,10 @@ DOCKER_COMPOSE_INSTALLED=false
|
||||||
DOCKER_COMPOSE_VERSION="v2.5.0"
|
DOCKER_COMPOSE_VERSION="v2.5.0"
|
||||||
DEPENDENCIES="git curl"
|
DEPENDENCIES="git curl"
|
||||||
ONION="Not Available"
|
ONION="Not Available"
|
||||||
TLS_PORT="443"
|
TLS_PORT=""
|
||||||
TLS_DOMAIN=""
|
TLS_DOMAIN=""
|
||||||
TLS_EMAIL=""
|
TLS_EMAIL=""
|
||||||
|
NETWORK="mainnet"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Functions #
|
# Functions #
|
||||||
|
@ -165,12 +166,36 @@ install_xmrsh() {
|
||||||
pushd "${XMRSH_DIR}" >>"${XMRSH_LOG_FILE}" 2>&1 || return
|
pushd "${XMRSH_DIR}" >>"${XMRSH_LOG_FILE}" 2>&1 || return
|
||||||
else
|
else
|
||||||
echo -e "${Ok}"
|
echo -e "${Ok}"
|
||||||
echo -e "${WarnBullet}Warning: xmr.sh already present in ${XMRSH_DIR}" #FIXME: This should probably exit
|
echo -e "${WarnBullet}Warning: xmr.sh already present in ${XMRSH_DIR}" #FIXME: This should exit, when uninstall script ready
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo -e "${Ok}"
|
echo -e "${Ok}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_network() {
|
||||||
|
echo -e "${OkBullet}Select the desired node network (mainnet, testnet, stagenet)"
|
||||||
|
PS3=":: Enter a number: "
|
||||||
|
options=("mainnet" "testnet" "stagenet")
|
||||||
|
select opt in "${options[@]}"; do
|
||||||
|
case $opt in
|
||||||
|
"mainnet")
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"testnet")
|
||||||
|
NETWORK="testnet"
|
||||||
|
sed -i "s/MONEROD_P2P_PORT=.*/MONEROD_P2P_PORT=28080/g" .env
|
||||||
|
sed -i "'/MONEROD_EXTRA_PARAMS/s/$/ --testnet/g' docker-compose.yml" .env
|
||||||
|
;;
|
||||||
|
"stagenet")
|
||||||
|
NETWORK="stagenet"
|
||||||
|
sed -i "s/MONEROD_P2P_PORT=.*/MONEROD_P2P_PORT=38080/g" .env
|
||||||
|
sed -i "'/MONEROD_EXTRA_PARAMS/s/$/ --stagenet/g' docker-compose.yml" .env
|
||||||
|
;;
|
||||||
|
*) echo "Invalid network choice!" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
configure_tls_domain() {
|
configure_tls_domain() {
|
||||||
echo -e "${OkBullet}Enter the desired domain for the Let's Encrypt SSL certificate."
|
echo -e "${OkBullet}Enter the desired domain for the Let's Encrypt SSL certificate."
|
||||||
read -r -e -p " Leave empty to use a self signed certificate []: " TLS_DOMAIN
|
read -r -e -p " Leave empty to use a self signed certificate []: " TLS_DOMAIN
|
||||||
|
@ -195,10 +220,23 @@ configure_tls_domain() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure_tls_port() {
|
||||||
|
echo -e "${OkBullet}Enter the desired TLS/HTTPS port."
|
||||||
|
read -r -e -p " Leave empty to use the default [443]: " TLS_PORT
|
||||||
|
if [ -n "${TLS_PORT}" ]; then
|
||||||
|
while ! echo "${TLS_PORT}" | grep -qP '^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$'; do
|
||||||
|
echo -e "${WarnBullet}Port not valid."
|
||||||
|
read -r -p " Enter again your desired port: " TLS_PORT
|
||||||
|
done
|
||||||
|
# Set port in vars
|
||||||
|
sed -i "s/TRAEFIK_TLS_PORT=.*/TRAEFIK_TLS_PORT=${TLS_PORT}/g" .env
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
configure_cors() {
|
configure_cors() {
|
||||||
echo -e "${OkBullet}Configuring CORS..."
|
echo -e "${OkBullet}Configuring CORS..."
|
||||||
while true; do
|
while true; do
|
||||||
read -r -e -p " Do you want to enabe CORS headers so the node can be used in webapps? [y/n]: " yn
|
read -r -e -p " Do you want to enabe CORS headers so the node can be used in web apps? [y/n]: " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
sed -i '/#!cors/s/# //g' docker-compose.yml
|
sed -i '/#!cors/s/# //g' docker-compose.yml
|
||||||
|
@ -263,10 +301,6 @@ configure_watchtower() {
|
||||||
# PUBLIC_IP=$(curl -s ifconfig.co)
|
# PUBLIC_IP=$(curl -s ifconfig.co)
|
||||||
# }
|
# }
|
||||||
|
|
||||||
validate_domain() {
|
|
||||||
echo "$1" | grep -P '(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)'
|
|
||||||
}
|
|
||||||
|
|
||||||
start_xmrsh() {
|
start_xmrsh() {
|
||||||
echo -ne "${OkBullet}Starting monero node and services... ${Off}"
|
echo -ne "${OkBullet}Starting monero node and services... ${Off}"
|
||||||
docker-compose pull >>"${XMRSH_LOG_FILE}" 2>&1
|
docker-compose pull >>"${XMRSH_LOG_FILE}" 2>&1
|
||||||
|
@ -331,11 +365,17 @@ if [ $DOCKER_INSTALLED = true ] && [ $DOCKER_COMPOSE_INSTALLED = false ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_xmrsh
|
install_xmrsh
|
||||||
|
configure_network
|
||||||
configure_tls_domain
|
configure_tls_domain
|
||||||
|
configure_tls_port
|
||||||
|
# configure_pruning
|
||||||
configure_cors
|
configure_cors
|
||||||
|
|
||||||
configure_tor
|
configure_tor
|
||||||
configure_explorer
|
configure_explorer
|
||||||
configure_watchtower
|
configure_watchtower
|
||||||
|
# configure_monitor
|
||||||
|
# configure_lws
|
||||||
start_xmrsh
|
start_xmrsh
|
||||||
completed
|
completed
|
||||||
|
|
50
uninstall
Executable file
50
uninstall
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Color Aliases #
|
||||||
|
################################################################
|
||||||
|
# Reset
|
||||||
|
Off='\033[0m' # Text Reset
|
||||||
|
|
||||||
|
# Regular Colors
|
||||||
|
Black='\033[0;30m' # Black
|
||||||
|
Red='\033[0;31m' # Red
|
||||||
|
Green='\033[0;32m' # Green
|
||||||
|
Yellow='\033[0;33m' # Yellow
|
||||||
|
Blue='\033[0;34m' # Blue
|
||||||
|
Purple='\033[0;35m' # Purple
|
||||||
|
Cyan='\033[0;36m' # Cyan
|
||||||
|
White='\033[0;37m' # White
|
||||||
|
|
||||||
|
# Background
|
||||||
|
On_Black='\033[40m' # Black
|
||||||
|
On_Red='\033[41m' # Red
|
||||||
|
On_Green='\033[42m' # Green
|
||||||
|
On_Yellow='\033[43m' # Yellow
|
||||||
|
On_Blue='\033[44m' # Blue
|
||||||
|
On_Purple='\033[45m' # Purple
|
||||||
|
On_Cyan='\033[46m' # Cyan
|
||||||
|
On_White='\033[47m' # White
|
||||||
|
|
||||||
|
OkBullet="${Green}${On_Black}:: ${White}${On_Black}"
|
||||||
|
WarnBullet="${Yellow}${On_Black}:: ${White}${On_Black}"
|
||||||
|
ErrBullet="${Red}${On_Black}:: ${White}${On_Black}"
|
||||||
|
Ok="${Green}${On_Black} ok.${Off}"
|
||||||
|
Fail="${Red}${On_Black} failed!${Off}"
|
||||||
|
Nok="${Yellow}${On_Black} nok.${Off}"
|
||||||
|
Stat="${Purple}${On_Black}"
|
||||||
|
StatInfo="${White}${On_Black}"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Vars #
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
XMRSH_DIR="/opt/xmr.sh"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Functions #
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# TBD
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue