|
| 1 | +SHELL := /bin/bash |
| 2 | + |
| 3 | +######################################################################################## |
| 4 | +# Environment Checks |
| 5 | +######################################################################################## |
| 6 | + |
| 7 | +CHECK_ENV:=$(shell ./scripts/check-environment.sh) |
| 8 | +ifneq ($(CHECK_ENV),) |
| 9 | +$(error Check environment dependencies.) |
| 10 | +endif |
| 11 | + |
| 12 | + |
| 13 | +######################################################################################## |
| 14 | +# Targets |
| 15 | +######################################################################################## |
| 16 | + |
| 17 | +help: ## Help message |
| 18 | + @awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 19 | + |
| 20 | +helm: ## Install Helm 3 dependency |
| 21 | + @./scripts/install-helm.sh |
| 22 | + |
| 23 | +helm-plugins: ## Install Helm plugins |
| 24 | + @helm plugin install https://github.com/databus23/helm-diff |
| 25 | + |
| 26 | +repos: ## Add Helm repositories for dependencies |
| 27 | + @echo "=> Installing Helm repos" |
| 28 | + @helm repo add grafana https://grafana.github.io/helm-charts |
| 29 | + @helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard |
| 30 | + @helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 31 | + @helm repo update |
| 32 | + @echo |
| 33 | + |
| 34 | +tools: install-prometheus install-loki install-metrics install-dashboard ## Intall/Update Prometheus/Grafana, Loki, Metrics Server, Kubernetes dashboard |
| 35 | + |
| 36 | +pull: ## Git pull node-launcher repository |
| 37 | + @git clean -idf |
| 38 | + @git pull origin $(shell git rev-parse --abbrev-ref HEAD) |
| 39 | + |
| 40 | +update-dependencies: |
| 41 | + @echo "=> Updating Helm chart dependencies" |
| 42 | + @helm dependencies update ./arkeo-stack |
| 43 | + @echo |
| 44 | + |
| 45 | +update-trust-state: ## Updates statesync trusted height/hash and Midgard blockstore hashes from Nine Realms |
| 46 | + @./scripts/update-trust-state.sh |
| 47 | + |
| 48 | +mnemonic: ## Retrieve and display current mnemonic for backup from your THORNode |
| 49 | + @./scripts/mnemonic.sh |
| 50 | + |
| 51 | +password: ## Retrieve and display current password for backup from your THORNode |
| 52 | + @./scripts/password.sh |
| 53 | + |
| 54 | +pods: ## Get THORNode Kubernetes pods |
| 55 | + @./scripts/pods.sh |
| 56 | + |
| 57 | +pre-install: pull update-dependencies ## Pre deploy steps for a THORNode (secret creation) |
| 58 | + @./scripts/pre-install.sh |
| 59 | + |
| 60 | +install: update-dependencies ## Deploy a THORNode |
| 61 | + @./scripts/install.sh |
| 62 | + |
| 63 | +recycle: pull update-dependencies ## Destroy and recreate a THORNode recycling existing daemons to avoid re-sync |
| 64 | + @./scripts/recycle.sh |
| 65 | + |
| 66 | +update: pull update-dependencies ## Update a THORNode to latest version |
| 67 | + @./scripts/update.sh |
| 68 | + |
| 69 | +status: ## Display current status of your THORNode |
| 70 | + @./scripts/status.sh |
| 71 | + |
| 72 | +reset: ## Reset and resync a service from scratch on your THORNode. This command can take a while to sync back to 100%. |
| 73 | + @./scripts/reset.sh |
| 74 | + |
| 75 | +hard-reset-thornode: ## Hard reset and resync thornode service from scratch on your THORNode, leaving no bak/* files. |
| 76 | + @./scripts/hard-reset-thornode.sh |
| 77 | + |
| 78 | +backup: ## Backup specific files from either thornode of bifrost service of a THORNode. |
| 79 | + @./scripts/backup.sh |
| 80 | + |
| 81 | +full-backup: ## Create volume snapshots and backups for both thornode and bifrost services. |
| 82 | + @./scripts/full-backup.sh |
| 83 | + |
| 84 | +restore-backup: ## Restore backup specific files from either thornode of bifrost service of a THORNode. |
| 85 | + @./scripts/restore-backup.sh |
| 86 | + |
| 87 | +snapshot: ## Snapshot a volume for a specific THORNode service. |
| 88 | + @./scripts/snapshot.sh |
| 89 | + |
| 90 | +restore-snapshot: ## Restore a volume for a specific THORNode service from a snapshot. |
| 91 | + @./scripts/restore-snapshot.sh |
| 92 | + |
| 93 | +wait-ready: ## Wait for all pods to be in Ready state |
| 94 | + @./scripts/wait-ready.sh |
| 95 | + |
| 96 | +destroy: ## Uninstall current THORNode |
| 97 | + @./scripts/destroy.sh |
| 98 | + |
| 99 | +export-state: ## Export chain state |
| 100 | + @./scripts/export-state.sh |
| 101 | + |
| 102 | +hard-fork: ## Hard fork chain |
| 103 | + @HARDFORK_BLOCK_HEIGHT=4786559 NEW_GENESIS_TIME='2022-03-22T01:38:16.219785087Z' CHAIN_ID='thorchain-mainnet-v1' IMAGE='registry.gitlab.com/thorchain/thornode:chaosnet-multichain-0.81.4' ./scripts/hard-fork.sh |
| 104 | + |
| 105 | +hard-fork-testnet: ## hard fork testnet |
| 106 | + @HARDFORK_BLOCK_HEIGHT=1821177 NEW_GENESIS_TIME='2022-03-14T19:32:38.219785087Z' CHAIN_ID='thorchain-testnet-v2' IMAGE='registry.gitlab.com/thorchain/thornode:testnet-0.81.2' ./scripts/hard-fork.sh |
| 107 | + |
| 108 | +shell: ## Open a shell for a selected THORNode service |
| 109 | + @./scripts/shell.sh |
| 110 | + |
| 111 | +debug: ## Open a shell for THORNode service mounting volume to debug |
| 112 | + @./scripts/debug.sh |
| 113 | + |
| 114 | +recover-ninerealms: |
| 115 | + @./scripts/recover-ninerealms.sh |
| 116 | + |
| 117 | +watch: ## Watch the THORNode pods in real time |
| 118 | + @./scripts/watch.sh |
| 119 | + |
| 120 | +logs: ## Display logs for a selected THORNode service |
| 121 | + @./scripts/logs.sh |
| 122 | + |
| 123 | +restart: ## Restart a selected THORNode service |
| 124 | + @./scripts/restart.sh |
| 125 | + |
| 126 | +halt: ## Halt a selected THORNode service |
| 127 | + @./scripts/halt.sh |
| 128 | + |
| 129 | +set-node-keys: ## Send a set-node-keys transaction to your THORNode |
| 130 | + @./scripts/set-node-keys.sh |
| 131 | + |
| 132 | +set-version: ## Send a set-version transaction to your THORNode |
| 133 | + @./scripts/set-version.sh |
| 134 | + |
| 135 | +set-ip-address: ## Send a set-ip-address transaction to your THORNode |
| 136 | + @./scripts/set-ip-address.sh |
| 137 | + |
| 138 | +set-monitoring: ## Enable PagerDuty or Deadmans Snitch monitoring via Prometheus/Grafana re-deploy |
| 139 | + @./scripts/set-monitoring.sh |
| 140 | + |
| 141 | +relay: ## Send a message that is relayed to a public Discord channel |
| 142 | + @./scripts/relay.sh |
| 143 | + |
| 144 | +mimir: ## Send a mimir command to set a key/value |
| 145 | + @./scripts/mimir.sh |
| 146 | + |
| 147 | +ban: ## Send a ban command with a node address |
| 148 | + @./scripts/ban.sh |
| 149 | + |
| 150 | +pause: ## Send a pause-chain transaction to your THORNode |
| 151 | + @./scripts/pause.sh |
| 152 | + |
| 153 | +resume: ## Send a resume-chain transaction to your THORNode |
| 154 | + @./scripts/resume.sh |
| 155 | + |
| 156 | +telegram-bot: ## Deploy Telegram bot to monitor THORNode |
| 157 | + @./scripts/telegram-bot.sh |
| 158 | + |
| 159 | +destroy-telegram-bot: ## Uninstall Telegram bot to monitor THORNode |
| 160 | + @./scripts/destroy-telegram-bot.sh |
| 161 | + |
| 162 | +destroy-tools: destroy-prometheus destroy-loki destroy-dashboard ## Uninstall Prometheus/Grafana, Loki, Kubernetes dashboard |
| 163 | + |
| 164 | +install-loki: repos ## Install/Update Loki logs management stack |
| 165 | + @./scripts/install-loki.sh |
| 166 | + |
| 167 | +destroy-loki: ## Uninstall Loki logs management stack |
| 168 | + @./scripts/destroy-loki.sh |
| 169 | + |
| 170 | +install-prometheus: repos ## Install/Update Prometheus/Grafana stack |
| 171 | + @./scripts/install-prometheus.sh |
| 172 | + |
| 173 | +destroy-prometheus: ## Uninstall Prometheus/Grafana stack |
| 174 | + @./scripts/destroy-prometheus.sh |
| 175 | + |
| 176 | +install-metrics: repos ## Install/Update Metrics Server |
| 177 | + @echo "=> Installing Metrics" |
| 178 | + @kubectl get svc -A | grep -q metrics-server || kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml |
| 179 | + @echo |
| 180 | + |
| 181 | +destroy-metrics: ## Uninstall Metrics Server |
| 182 | + @echo "=> Deleting Metrics" |
| 183 | + @kubectl delete -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml |
| 184 | + @echo |
| 185 | + |
| 186 | +install-dashboard: repos ## Install/Update Kubernetes dashboard |
| 187 | + @echo "=> Installing Kubernetes Dashboard" |
| 188 | + @helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard -n kube-system --wait -f ./kubernetes-dashboard/values.yaml |
| 189 | + @kubectl apply -f ./kubernetes-dashboard/dashboard-admin.yaml |
| 190 | + @echo |
| 191 | + |
| 192 | +destroy-dashboard: ## Uninstall Kubernetes dashboard |
| 193 | + @echo "=> Deleting Kubernetes Dashboard" |
| 194 | + @helm delete kubernetes-dashboard -n kube-system |
| 195 | + @echo |
| 196 | + |
| 197 | +grafana: ## Access Grafana UI through port-forward locally |
| 198 | + @echo User: admin |
| 199 | + @echo Password: thorchain |
| 200 | + @echo Open your browser at http://localhost:3000 |
| 201 | + @kubectl -n prometheus-system port-forward service/prometheus-grafana 3000:80 |
| 202 | + |
| 203 | +prometheus: ## Access Prometheus UI through port-forward locally |
| 204 | + @echo Open your browser at http://localhost:9090 |
| 205 | + @kubectl -n prometheus-system port-forward service/prometheus-kube-prometheus-prometheus 9090 |
| 206 | + |
| 207 | +alert-manager: ## Access Alert-Manager UI through port-forward locally |
| 208 | + @echo Open your browser at http://localhost:9093 |
| 209 | + @kubectl -n prometheus-system port-forward service/prometheus-kube-prometheus-alertmanager 9093 |
| 210 | + |
| 211 | +dashboard: ## Access Kubernetes Dashboard UI through port-forward locally |
| 212 | + @echo Open your browser at http://localhost:8000 |
| 213 | + @kubectl -n kube-system port-forward service/kubernetes-dashboard 8000:443 |
| 214 | + |
| 215 | +lint: ## Run linters (development) |
| 216 | + ./scripts/lint.sh |
| 217 | + |
| 218 | +.PHONY: help helm repo pull tools install-loki install-prometheus install-metrics install-dashboard export-state hard-fork destroy-tools destroy-loki destroy-prometheus destroy-metrics prometheus grafana dashboard alert-manager mnemonic update-dependencies reset restart pods deploy update destroy status shell watch logs set-node-keys set-ip-address set-version pause resume telegram-bot destroy-telegram-bot lint |
| 219 | + |
| 220 | +.EXPORT_ALL_VARIABLES: |
0 commit comments