uninstall, local volumes

This commit is contained in:
vdo 2022-06-01 14:45:45 +01:00
parent 6d3b92486e
commit 8d18119be2
9 changed files with 71 additions and 42 deletions

View file

@ -17,13 +17,13 @@ Other distributions with docker pre-installed would probably be compatible as we
- [x] Add wizard for DNS domain selection.
- [x] Status and node info at finish.
- [x] Mainnet / Stagenet / Testnet selection
- [ ] Pruning option
- [x] Pruning enabled
- [x] Clearnet TLS port selection
- [ ] Uninstall script
- [ ] Documentation
- [x] Make tor service optional
- [x] (Optional) block explorer
- [x] Block explorer (disabled)
- [x] Grafana dashboard
- [ ] arm64 support for all images.
- [ ] monerod-lws support.
- [ ] monerod-lws support
- [ ] monerod-proxy support.

4
data/grafana/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
data/letsencrypt/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
data/monero/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
data/prometheus/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
data/tor/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View file

@ -43,7 +43,7 @@ x-tor-service: &tor-service
environment:
MONEROD_TOR_SERVICE_HOSTS: "${TOR_HTTP_PORT}:monerod:${MONEROD_RESTRICTED_RPC_PORT}"
volumes:
- tor-keys:/var/lib/tor/hidden_service/
- ./data/tor:/var/lib/tor/hidden_service/
x-explorer-service: &explorer-service
explorer:
@ -51,7 +51,7 @@ x-explorer-service: &explorer-service
container_name: explorer
restart: unless-stopped
volumes:
- monerod-data:/home/monero/.bitmonero
- ./data/monero:/home/monero/.bitmonero
ports:
- ${EXPLORER_PORT}
depends_on:
@ -77,6 +77,7 @@ x-monero-exporter-service: &monero-exporter-service
x-grafana-service: &grafana-service
grafana:
user: "1000"
command:
- -config=/etc/grafana/grafana.ini
container_name: grafana
@ -84,6 +85,7 @@ x-grafana-service: &grafana-service
ports:
- 3000
volumes:
- ./data/grafana:/var/lib/grafana
- ./config/grafana/grafana.ini:/etc/grafana/grafana.ini:ro
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
- ./config/grafana/dashboards:/var/lib/grafana/dashboards:ro
@ -103,7 +105,7 @@ x-grafana-service: &grafana-service
x-prometheus-service: &prometheus-service
prometheus:
user: root # root user needed to use an external volume
user: "1000"
command:
- --config.file=/etc/prometheus/config.yaml
- --storage.tsdb.path=/data
@ -111,7 +113,7 @@ x-prometheus-service: &prometheus-service
container_name: prometheus
image: bitnami/prometheus:${PROMETHEUS_TAG}
volumes:
- prometheus-data:/data
- ./data/prometheus:/data
- ./config/prometheus/config.yaml:/etc/prometheus/config.yaml:ro
x-watchtower-service: &watchtower-service
@ -132,7 +134,7 @@ services:
- ${TRAEFIK_HTTP_PORT}:${TRAEFIK_HTTP_PORT}
- ${TRAEFIK_TLS_PORT}:${TRAEFIK_TLS_PORT}
volumes:
# - "./letsencrypt:/letsencrypt" #!le
- "./data/letsencrypt:/letsencrypt" #!le
- "/var/run/docker.sock:/var/run/docker.sock:ro"
<<: *traefik-command-nole #!traefik-command
restart: always
@ -143,7 +145,7 @@ services:
ports:
- "${MONEROD_P2P_PORT}:${MONEROD_P2P_PORT}" # Exposes P2P port
volumes:
- "monerod-data:/home/monero/.bitmonero"
- "./data/monero:/home/monero/.bitmonero"
labels:
- "traefik.enable=true"
# - "traefik.http.routers.monerod.rule=(Host(`${DOMAIN}`) && PathPrefix(`/`))" #!le
@ -163,8 +165,3 @@ services:
# <<: *grafana-service #!grafana
# <<: *prometheus-service #!prometheus
# <<: *watchtower-service #!watchtower
volumes:
monerod-data: {}
# tor-keys: {} #!tor
# prometheus-data: {} #!prometheus

18
install
View file

@ -1,30 +1,20 @@
#!/bin/bash
################################################################
# Color Aliases #
# Colors #
################################################################
# 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
On_Black='\033[40m' # Black
OkBullet="${Green}${On_Black}:: ${White}${On_Black}"
WarnBullet="${Yellow}${On_Black}:: ${White}${On_Black}"
@ -165,6 +155,7 @@ install_xmrsh() {
git clone -b "${XMRSH_BRANCH}" "${XMRSH_URL}" "${XMRSH_DIR}" >>"${XMRSH_LOG_FILE}" 2>&1
check_return $?
pushd "${XMRSH_DIR}" >>"${XMRSH_LOG_FILE}" 2>&1 || return
chown -R "1000:1000" ./data
else
echo -e "${Ok}"
echo -e "${WarnBullet}Warning: xmr.sh already present in ${XMRSH_DIR}" #FIXME: This should exit, when uninstall script ready
@ -405,7 +396,8 @@ configure_tls_port
configure_cors
configure_tor
configure_explorer
# Deployment of explorer disabled until it's stable.
# configure_explorer
configure_watchtower
configure_grafana
# configure_lws

View file

@ -1,30 +1,20 @@
#!/bin/bash
################################################################
# Color Aliases #
# Colors #
################################################################
# 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
On_Black='\033[40m' # Black
OkBullet="${Green}${On_Black}:: ${White}${On_Black}"
WarnBullet="${Yellow}${On_Black}:: ${White}${On_Black}"
@ -32,19 +22,49 @@ 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"
XMRSH_LOG_FILE="/tmp/xmr.sh-$(date +%Y%m%d-%H%M%S).log"
################################################################
# Functions #
################################################################
# TBD
check_return() {
if [ "$1" -ne 0 ]; then
echo -e "${Fail}"
echo -e "${ErrBullet}Installation failed. Check the logs in ${XMRSH_LOG_FILE}${Off}"
exit "$1"
fi
}
uninstall() {
pushd $XMRSH_DIR || check_return $?
echo -e "${OkBullet}Uninstalling xmr.sh..."
docker-compose down >>"${XMRSH_LOG_FILE}" 2>&1
check_return $?
while true; do
read -r -e -p " Do you want to keep the data directory with the blockchain and other data files? [y/n]: " yn
case $yn in
[Yy]*)
rm -rf !("data")
check_return $?
break
;;
[Nn]*)
popd || check_return $?
rm -rf ./*
check_return $?
break
;;
*) echo " Please answer yes or no." ;;
esac
done
echo -e "${OkBullet}Uninstall complete."
}
exit 0