├── .gitignore ├── docker ├── ergo-explorer-backend-utx-tracker.Dockerfile ├── ergo-explorer-frontend.Dockerfile ├── ergo-explorer-backend-chain-grabber.Dockerfile ├── yoroi-backend.Dockerfile ├── ergo-explorer-backend-utx-broadcaster.Dockerfile ├── fluentd.Dockerfile ├── ergo-explorer-backend-api.Dockerfile ├── ergo-node.Dockerfile ├── kiana.Dockerfile ├── elasticsearch.Dockerfile └── ergo-postgresql.Dockerfile ├── .env ├── compose ├── explorer-frontend.yml ├── yoroi-backend.yml ├── common.yml ├── monitoring.yml └── explorer-backend.yml ├── conf ├── yoroi-backend.js ├── grafana │ └── datasources.yml ├── ergo-node.conf ├── promtail.yml └── ergo-backend.conf ├── README.md ├── .github ├── ergo-bootstrap.svg └── ergo-bootstrap-init.svg └── ergo-bootstrap /.gitignore: -------------------------------------------------------------------------------- 1 | docker-compose.yml 2 | -------------------------------------------------------------------------------- /docker/ergo-explorer-backend-utx-tracker.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA ergo-explorer-backend -f $ERGO_NIX 4 | 5 | ENTRYPOINT ergo-utx-tracker $0 -------------------------------------------------------------------------------- /docker/ergo-explorer-frontend.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA ergo-explorer-frontend -f $ERGO_NIX 4 | 5 | ENTRYPOINT ergo-explorer-frontend 6 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # The following pins to a specific version of ergo-nix 2 | ERGO_NIX_SOURCE=https://github.com/ergoplatform/ergo-nix/archive/c9c543b887c6ccffd6f26cdbe38f3bc0782f8651.tar.gz 3 | -------------------------------------------------------------------------------- /docker/ergo-explorer-backend-chain-grabber.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA ergo-explorer-backend -f $ERGO_NIX 4 | 5 | ENTRYPOINT ergo-chain-grabber $0 -------------------------------------------------------------------------------- /docker/yoroi-backend.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA yoroi-ergo-backend -f $ERGO_NIX 4 | 5 | EXPOSE 3001 6 | 7 | ENTRYPOINT yoroi-ergo-backend 8 | -------------------------------------------------------------------------------- /docker/ergo-explorer-backend-utx-broadcaster.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA ergo-explorer-backend -f $ERGO_NIX 4 | 5 | ENTRYPOINT ergo-utx-broadcaster $0 -------------------------------------------------------------------------------- /docker/fluentd.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grafana/fluent-plugin-grafana-loki:master 2 | 3 | RUN fluent-gem install fluent-plugin-docker 4 | RUN fluent-gem install fluent-plugin-docker_metadata_filter -------------------------------------------------------------------------------- /docker/ergo-explorer-backend-api.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA ergo-explorer-backend -f $ERGO_NIX 4 | 5 | EXPOSE 8080 6 | 7 | ENTRYPOINT ergo-explorer-api $0 -------------------------------------------------------------------------------- /docker/ergo-node.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nixos/nix 2 | ARG ERGO_NIX 3 | RUN nix-env -iA ergo-node -f $ERGO_NIX 4 | 5 | EXPOSE 9030 6 | EXPOSE 9053 7 | 8 | WORKDIR /home/ergo 9 | ENTRYPOINT ergo $0 $1 $2 $3 $4 10 | -------------------------------------------------------------------------------- /docker/kiana.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.elastic.co/logstash/logstash:7.6.1 2 | 3 | ENV ES_HOST http://localhost:9200 4 | ENV REDIS_HOST localhost 5 | ENV REDIS_PORT 6379 6 | 7 | RUN mkdir -p /usr/share/logstash/logs 8 | RUN rm -f /usr/share/logstash/pipeline/logstash.conf -------------------------------------------------------------------------------- /compose/explorer-frontend.yml: -------------------------------------------------------------------------------- 1 | # Ergo Explorer frontend 2 | ergo-explorer-frontend: 3 | build: 4 | context: docker 5 | dockerfile: ergo-explorer-frontend.Dockerfile 6 | args: 7 | - ERGO_NIX=$ERGO_NIX_SOURCE 8 | ports: 9 | - "5000:5000" 10 | -------------------------------------------------------------------------------- /conf/yoroi-backend.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | server: { 3 | port: 3001, 4 | corsOrigins: ['*'], 5 | corsAllowHeaders: ['yoroi-version', 'yoroi-locale'], 6 | corsExposeHeaders: ['yoroi-version', 'yoroi-locale'], 7 | }, 8 | logLevel: 'debug', 9 | backend: { 10 | explorer: 'http://ergo-explorer-api:8080', 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /docker/elasticsearch.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.elastic.co/elasticsearch/elasticsearch:7.6.1 2 | 3 | USER elasticsearch 4 | 5 | ENV http.host=0.0.0.0 6 | ENV network.host=localhost 7 | ENV xpack.security.enabled=false 8 | ENV bootstrap.memory_lock=true 9 | 10 | ENV ES_JAVA_OPTS="-Xms512m -Xmx512m" 11 | ENV ES_MASTER true 12 | ENV ES_DATA true 13 | ENV ES_MIN_MASTER_NODES 1 14 | ENV ES_CLUSTER_NAME ps-local-elasticsearch -------------------------------------------------------------------------------- /conf/grafana/datasources.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: Loki log collector 5 | type: loki 6 | url: http://loki:3100/ 7 | jsonData: 8 | tlsSkipVerify: true 9 | - name: Ergo explorer PostgreSQL database 10 | type: postgres 11 | url: ergo-postgresql:5432 12 | user: ergo 13 | database: ergo 14 | jsonData: 15 | sslmode: "disable" 16 | secureJsonData: 17 | password: ergo 18 | -------------------------------------------------------------------------------- /compose/yoroi-backend.yml: -------------------------------------------------------------------------------- 1 | # Yoroi backend 2 | yoroi-backend: 3 | build: 4 | context: docker 5 | dockerfile: yoroi-backend.Dockerfile 6 | args: 7 | - ERGO_NIX=$ERGO_NIX_SOURCE 8 | volumes: 9 | - "${PWD}/conf/yoroi-backend.js:/etc/yoroi-backend.js" 10 | environment: 11 | - NODE_CONFIG_RUNTIME_JSON=/etc/yoroi-backend.js 12 | ports: 13 | - "3001:3001" 14 | links: 15 | - "ergo-explorer-api" 16 | -------------------------------------------------------------------------------- /conf/ergo-node.conf: -------------------------------------------------------------------------------- 1 | ergo { 2 | directory = ${ergo.directory}"/.ergo" 3 | node { 4 | mining = false 5 | } 6 | wallet.secretStorage.secretDir = ${ergo.directory}"/wallet/keystore" 7 | } 8 | 9 | scorex { 10 | restApi { 11 | # Hex-encoded Blake2b256 hash of an API key. 12 | # Should be 64-chars long Base16 string. 13 | # below is the hash of the string 'hello' 14 | # replace with your actual hash 15 | apiKeyHash = "324dcf027dd4a30a932c441f365a25e86b173defa4b8e58948253471b81b72cf" 16 | } 17 | } -------------------------------------------------------------------------------- /docker/ergo-postgresql.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres 2 | 3 | ARG SCHEMA=https://raw.githubusercontent.com/ergoplatform/explorer-backend/master/modules/explorer-core/src/main/resources/db/V1__Node_data.sql 4 | 5 | ENV POSTGRES_DB ergo 6 | # Please note we're exposing the password here, 7 | # so never shared this container outside the cluster. 8 | ENV POSTGRES_PASSWORD ergo 9 | ENV POSTGRES_USER ergo 10 | 11 | ADD $SCHEMA /docker-entrypoint-initdb.d 12 | RUN chown postgres /docker-entrypoint-initdb.d/*sql 13 | 14 | EXPOSE 5432 -------------------------------------------------------------------------------- /compose/common.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | volumes: 4 | ergo_node_storage: 5 | ergo_postgresql_storage: 6 | 7 | services: 8 | # Ergo blockchain node 9 | ergo-node: 10 | build: 11 | context: docker 12 | dockerfile: ergo-node.Dockerfile 13 | args: 14 | - ERGO_NIX=$ERGO_NIX_SOURCE 15 | volumes: 16 | - "ergo_node_storage:/home/ergo/.ergo" 17 | - "${PWD}/conf/ergo-node.conf:/etc/ergo-node.conf" 18 | command: --mainnet -c /etc/ergo-node.conf 19 | expose: 20 | - "9030" 21 | - "9053" 22 | ports: 23 | - "9053:9053" 24 | - "9030:9030" 25 | -------------------------------------------------------------------------------- /conf/promtail.yml: -------------------------------------------------------------------------------- 1 | server: 2 | http_listen_port: 9080 3 | grpc_listen_port: 0 4 | 5 | positions: 6 | filename: /tmp/positions.yaml 7 | 8 | clients: 9 | - url: http://loki:3100/loki/api/v1/push 10 | 11 | scrape_configs: 12 | - job_name: systemd-journal 13 | pipeline_stages: 14 | - docker: 15 | journal: 16 | path: /var/log/journal 17 | relabel_configs: 18 | - source_labels: 19 | - __journal__systemd_unit 20 | target_label: systemd_unit 21 | - source_labels: 22 | - __journal__hostname 23 | target_label: nodename 24 | - source_labels: 25 | - __journal_syslog_identifier 26 | target_label: syslog_identifier 27 | -------------------------------------------------------------------------------- /compose/monitoring.yml: -------------------------------------------------------------------------------- 1 | loki: 2 | image: grafana/loki:latest 3 | ports: 4 | - "3100:3100" 5 | command: -config.file=/etc/loki/local-config.yaml 6 | promtail: 7 | image: grafana/promtail:update-libsystem-dev-0bd2ca6 8 | volumes: 9 | - /var/log/journal/:/var/log/journal/ 10 | - /run/log/journal/:/run/log/journal/ 11 | - /etc/machine-id:/etc/machine-id 12 | - "${PWD}/conf/promtail.yml:/etc/promtail/config.yml" 13 | command: -config.file=/etc/promtail/config.yml 14 | grafana: 15 | image: grafana/grafana:latest 16 | ports: 17 | - "3000:3000" 18 | volumes: 19 | - "${PWD}/conf/grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml" 20 | -------------------------------------------------------------------------------- /conf/ergo-backend.conf: -------------------------------------------------------------------------------- 1 | poll-interval = 15s 2 | master-nodes-addresses = [ "http://ergo-node:9053" ] 3 | http.port = 8080 4 | http.host = "0.0.0.0" 5 | db.url = "jdbc:postgresql://ergo-postgresql:5432/ergo" 6 | db.user = "ergo" 7 | db.pass = "ergo" 8 | db.cp-size = 8 9 | redis.url = "redis://ergo-redis:6379" 10 | utx-cache.transaction-ttl = 48h 11 | tick-interval = 15s 12 | requests.max-entities-per-request = 10000 13 | requests.max-entities-per-heavy-request = 1000 14 | protocol { 15 | network-prefix = 0 16 | genesis-address = "2Z4YBkDsDvQj8BX7xiySFewjitqp2ge9c99jfes2whbtKitZTxdBYqbrVZUvZvKv6aqn9by4kp3LE1c26LCyosFnVnm6b6U1JYvWpYmL2ZnixJbXLjWAWuBThV1D6dLpqZJYQHYDznJCk49g5TUiS4q8khpag2aNmHwREV7JSsypHdHLgJT7MGaw51aJfNubyzSKxZ4AJXFS27EfXwyCLzW1K6GVqwkJtCoPvrcLqmqwacAWJPkmh78nke9H4oT88XmSbRt2n9aWZjosiZCafZ4osUDxmZcc5QVEeTWn8drSraY3eFKe8Mu9MSCcVU" 17 | monetary { 18 | fixed-rate-period = 525600 19 | fixed-rate = 75000000000 20 | founders-initial-reward = 7500000000 21 | epoch-length = 64800 22 | one-epoch-reduction = 3000000000 23 | miner-reward-delay = 720 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /compose/explorer-backend.yml: -------------------------------------------------------------------------------- 1 | # Databases required by the Ergo explorer backends 2 | ergo-postgresql: 3 | build: 4 | context: docker 5 | dockerfile: ergo-postgresql.Dockerfile 6 | volumes: 7 | - "ergo_postgresql_storage:/var/lib/postgresql/data" 8 | expose: 9 | - "5432" 10 | ergo-redis: 11 | image: redis:latest 12 | expose: 13 | - "6379" 14 | 15 | # Ergo Explorer backend services 16 | ergo-explorer-api: 17 | build: 18 | context: docker 19 | dockerfile: ergo-explorer-backend-api.Dockerfile 20 | args: 21 | - ERGO_NIX=$ERGO_NIX_SOURCE 22 | volumes: 23 | - "${PWD}/conf/ergo-backend.conf:/etc/ergo-backend.conf" 24 | command: /etc/ergo-backend.conf 25 | ports: 26 | - "8080:8080" 27 | links: 28 | - "ergo-node" 29 | - "ergo-postgresql" 30 | - "ergo-redis" 31 | 32 | ergo-explorer-backend-chain-grabber: 33 | build: 34 | context: docker 35 | dockerfile: ergo-explorer-backend-chain-grabber.Dockerfile 36 | args: 37 | - ERGO_NIX=$ERGO_NIX_SOURCE 38 | volumes: 39 | - "${PWD}/conf/ergo-backend.conf:/etc/ergo-backend.conf" 40 | command: /etc/ergo-backend.conf 41 | links: 42 | - "ergo-node" 43 | - "ergo-postgresql" 44 | - "ergo-redis" 45 | 46 | ergo-explorer-utx-tracker: 47 | build: 48 | context: docker 49 | dockerfile: ergo-explorer-backend-utx-tracker.Dockerfile 50 | args: 51 | - ERGO_NIX=$ERGO_NIX_SOURCE 52 | volumes: 53 | - "${PWD}/conf/ergo-backend.conf:/etc/ergo-backend.conf" 54 | command: /etc/ergo-backend.conf 55 | links: 56 | - "ergo-node" 57 | - "ergo-postgresql" 58 | - "ergo-redis" 59 | 60 | ergo-explorer-utx-broadcaster: 61 | build: 62 | context: docker 63 | dockerfile: ergo-explorer-backend-utx-broadcaster.Dockerfile 64 | args: 65 | - ERGO_NIX=$ERGO_NIX_SOURCE 66 | volumes: 67 | - "${PWD}/conf/ergo-backend.conf:/etc/ergo-backend.conf" 68 | command: /etc/ergo-backend.conf 69 | links: 70 | - "ergo-node" 71 | - "ergo-postgresql" 72 | - "ergo-redis" 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Ergo Bootstrap 4 | 5 | Ergo bootstrap tool, build on top of [ergo-nix](https://github.com/ergoplatform/ergo-nix), will help you to quickly deploy an Ergo blockchain cluster with a handful of useful tools you might need to start developing your dApps. 6 | 7 |

8 | Key Features • 9 | Installation • 10 | How To Use • 11 | Support • 12 | Credits 13 |

14 | 15 | ## Key Features 16 | 17 | * Ergo node, a full blockchain node, the reference client implementation. 18 | * Ergo backends 19 | * Explorer API, provides a set of HTTP API methods for querying chain/off-chain data. 20 | * UTX watcher, dumps unconfirmed transactions from mempool to local database. 21 | * UTX broadcaster, broadcasts unconfirmed transactions to Ergo nodes. 22 | * Chain grabber, scans blockchain and dumps aggregated data to database. 23 | * Yoroi backend, a wrapper for the Ergo explorer API providing light wallets endpoints. 24 | * Ergo frontends 25 | * Ergo node panel, build-in 26 | * Ergo explorer, a browser for viewing activity on the underlying blockchain network. 27 | 28 | ## Installation 29 | 30 | The bootstrap cluster is supposed to be a development tool and we do not recommend using it as a production deployment. 31 | 32 | You need to have `docker` and `docker-compose` installed on your system. We recommend at least 8GB of memory. 33 | 34 | ```bash 35 | # Clone this repository 36 | $ git clone https://github.com/ergoplatform/ergo-bootstrap 37 | 38 | # Go into the repository 39 | $ cd ergo-bootstrap 40 | 41 | # Run the bootstrap script 42 | $ ./ergo-bootstrap 43 | Usage: ./ergo-bootstrap {init|start|stop|status|destroy} 44 | 45 | init Initialize a ergo bootstrap cluster 46 | start Start the cluster 47 | stop Stop the cluster 48 | status Get status of an initialized cluster 49 | destroy Destroy the current cluster 50 | ``` 51 | 52 | ## Usage 53 | 54 | ### Initializing your cluster 55 | 56 | ![Ergo bootstrap init](.github/ergo-bootstrap-init.svg) 57 | 58 | ### Starting and stopping your cluster 59 | 60 | Use the `start` and `stop` commands. 61 | 62 | ``` 63 | $ ./ergo-bootstrap stop 64 | Stopping ergo-bootstrap_ergo-explorer-api_1 ... done 65 | $ 66 | ``` 67 | 68 | ### Status of the cluster 69 | 70 | You can view the current status of your cluster using the `status` command. 71 | 72 | ``` 73 | $ ./ergo-bootstrap status 74 | NAMES CONTAINER ID STATUS PORTS 75 | ergo-bootstrap_yoroi-backend_1 c5db1d6f2795 Up 35 minutes 0.0.0.0:3001->3001/tcp 76 | ergo-bootstrap_ergo-explorer-api_1 20d17f44e95a Up 35 minutes 0.0.0.0:8080->8080/tcp 77 | ergo-bootstrap_ergo-postgresql_1 c9ef2a3cdfa4 Up 35 minutes 5432/tcp 78 | ergo-bootstrap_ergo-redis_1 a7ea3d025cc5 Up 35 minutes 6379/tcp 79 | ... 80 | 81 | Ergo Node Panel http://localhost:9053/panel/ 82 | Ergo Node API http://localhost:9053/ 83 | Yoroi backed API http://localhost:3001/api/v2/bestblock 84 | Grafana metrics http://localhost:3000/ (user admin / password admin) 85 | ``` 86 | 87 | ## Support 88 | 89 | If you find a bug or have a feature you would like to see, [please open an issue](https://github.com/ergoplatform/ergo-bootstrap/issues/new). For help, join the [Ergo Platform Discord server](https://discordapp.com/invite/gYrVrjS). 90 | 91 | ## Credits 92 | 93 | This project has [been sponsored by a grant from The Ergo Foundation](https://ergoplatform.org/en/blog/2020-11-18-ergo-foundation-makes-key-dapp-infrastructure-grant/). Ergo is a community-oriented project, with many contributors to various aspects of the ecosystem. If you have a great idea which you are looking to implement that would improve the Ergo ecosystem as a whole, please feel free to apply for an Ergo Foundation grant by emailing your proposal to: ergoplatform@protonmail.com. 94 | -------------------------------------------------------------------------------- /.github/ergo-bootstrap.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 10 | 19 | 23 | 30 | 37 | 43 | 46 | 51 | 55 | 59 | 64 | 69 | 71 | 73 | 78 | 83 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /ergo-bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! command -v docker &> /dev/null 4 | then 5 | echo "ERROR: docker could not be found, please install it." 6 | echo "Visit https://docs.docker.com/get-docker/ for more information." 7 | exit 1 8 | fi 9 | 10 | if ! command -v docker-compose &> /dev/null 11 | then 12 | echo "ERROR: docker-compose could not be found, please install it." 13 | echo "Visit https://docs.docker.com/compose/install/ for more information." 14 | exit 1 15 | fi 16 | 17 | init () { 18 | if [ -f ./docker-compose.yml ]; then 19 | echo "ERROR: ☝ Your cluster is already initialized." 20 | echo "Run \"$0 status\" or \"$0 destroy\"." 21 | echo 22 | exit 1 23 | fi 24 | 25 | clear 26 | echo -e "\e[1m" 27 | echo " Welcome to Σrgo bootstrap!" 28 | echo -e "\e[0m" 29 | echo "We're going to initialize a new Ergo Bootstrap cluster for you." 30 | echo 31 | echo "The Ergo blockchain node is the core of this bootstrap cluster, but there are" 32 | echo "other components that you might find useful. Please refer to the documentation" 33 | echo -e "available at \e[33mhttp://github.com/ergoplatform/ergo-bootstrap\e[39m to find out more about" 34 | echo "each of these components." 35 | echo 36 | echo "❔ Do you wish to initialize the Ergo Explorer API?" 37 | select yn1 in "Yes" "No"; do 38 | case $yn1 in 39 | Yes ) export INIT_EXPLORER_API=true;break;; 40 | No ) export INIT_EXPLORER_API=false;break;; 41 | * ) echo "Invalid choice."; 42 | esac 43 | done 44 | echo 45 | echo "❔ Do you wish to initialize the Ergo Explorer Frontend?" 46 | select yn2 in "Yes" "No"; do 47 | case $yn2 in 48 | Yes ) export INIT_EXPLORER_FRONTEND=true;break;; 49 | No ) export INIT_EXPLORER_FRONTEND=false;break;; 50 | * ) echo "Invalid choice."; 51 | esac 52 | done 53 | echo 54 | echo "❔ Do you wish to initialize the Yoroi backend?" 55 | select yn3 in "Yes" "No"; do 56 | case $yn3 in 57 | Yes ) export INIT_YOROI_BACKEND=true;break;; 58 | No ) export INIT_YOROI_BACKEND=false;break;; 59 | * ) echo "Invalid choice."; 60 | 61 | esac 62 | done 63 | echo 64 | echo "❔ Would you like to spin up monitoring for your cluster?" 65 | select yn4 in "Yes" "No"; do 66 | case $yn4 in 67 | Yes ) export INIT_MONITORING=true;break;; 68 | No ) export INIT_MONITORING=false;break;; 69 | * ) echo "Invalid choice."; 70 | esac 71 | done 72 | 73 | cat compose/common.yml > docker-compose.yml 74 | if $INIT_EXPLORER_API; then cat compose/explorer-backend.yml >> docker-compose.yml; fi; 75 | if $INIT_EXPLORER_FRONTEND; then cat compose/explorer-frontend.yml >> docker-compose.yml; fi; 76 | if $INIT_YOROI_BACKEND; then cat compose/yoroi-backend.yml >> docker-compose.yml; fi; 77 | if $INIT_MONITORING; then cat compose/monitoring.yml >> docker-compose.yml; fi; 78 | echo >> docker-compose.yml 79 | echo "# Generated on $(date) by ergo-bootstrap" >> docker-compose.yml 80 | echo 81 | 82 | echo "Congratulations! Your cluster has been initialized. Pick up" 83 | echo "a good book, brew some coffee, this will take some time." 84 | echo 85 | echo "Press Enter to Continue." 86 | read -n 1 87 | docker-compose up -d --remove-orphans 88 | } 89 | 90 | start () { 91 | docker-compose start 92 | } 93 | 94 | stop () { 95 | docker-compose stop 96 | } 97 | 98 | status () { 99 | 100 | DOCKER_COMPOSE_PS=$(docker ps -a --format 'table {{.Names}}\t{{.ID}}\t{{.Status}}\t{{.Ports}}'); 101 | echo "$DOCKER_COMPOSE_PS" | egrep 'ergo|NAME' 102 | echo 103 | # TODO: Extract the port numbers directly from containers and test with nc if they are up 104 | [[ "echo \"$DOCKER_COMPOSE_PS\" | grep Up" =~ "ergo-node" ]] && echo "Ergo Node Panel http://localhost:9053/panel/ (API key: hello)" 105 | [[ "echo \"$DOCKER_COMPOSE_PS\" | grep Up" =~ "ergo-node" ]] && echo "Ergo Node API http://localhost:9053/ (API key: hello)" 106 | [[ "echo \"$DOCKER_COMPOSE_PS\" | grep Up" =~ "ergo-explorer-api" ]] && echo "Ergo Explorer API http://localhost:8080/" 107 | [[ "echo \"$DOCKER_COMPOSE_PS\" | grep Up" =~ "ergo-explorer-frontend" ]] && echo "Ergo Explorer http://localhost:5000/" 108 | [[ "echo \"$DOCKER_COMPOSE_PS\" | grep Up" =~ "yoroi" ]] && echo "Yoroi backend API http://localhost:3001/api/v2/bestblock" 109 | [[ "echo \"$DOCKER_COMPOSE_PS\" | grep Up" =~ "grafana" ]] && echo "Grafana metrics http://localhost:3000/ (user: admin / password: admin)" 110 | 111 | } 112 | 113 | destroy () { 114 | 115 | if [ ! -f ./docker-compose.yml ]; then 116 | echo "Could not find an existing configuration." 117 | echo "Run \"$0 init\" to create a new cluster." 118 | echo 119 | exit 1 120 | fi 121 | echo "Here be dragons!" 122 | echo 123 | echo "Do you REALLY want to DESTROY your current cluster?" 124 | select yn1 in "Yes" "No"; do 125 | case $yn1 in 126 | Yes ) break;; 127 | No ) exit;; 128 | * ) echo "Invalid choice."; 129 | esac 130 | done 131 | echo 132 | docker-compose rm -s 133 | rm docker-compose.yml 134 | echo 135 | DANGLING_VOLUMES=$(docker volume ls --format '{{.Name}}'|grep ergo-bootstrap) 136 | echo 137 | echo "The following volumes have been left after the cluster:" 138 | echo 139 | echo "$DANGLING_VOLUMES" 140 | echo 141 | echo "Do you REALLY want to DESTROY your current cluster volumes? You will lose all data." 142 | select yn1 in "Yes" "No"; do 143 | case $yn1 in 144 | Yes ) break;; 145 | No ) exit;; 146 | * ) echo "Invalid choice."; 147 | esac 148 | done 149 | echo 150 | echo "$DANGLING_VOLUMES" | xargs -r docker volume rm 151 | echo "All gone." 152 | } 153 | 154 | case "$1" in 155 | init) 156 | init 157 | ;; 158 | 159 | start) 160 | start 161 | ;; 162 | stop) 163 | stop 164 | ;; 165 | status) 166 | status 167 | ;; 168 | destroy) 169 | destroy 170 | ;; 171 | *) 172 | echo "Usage: $0 {init|status|destroy}" 173 | echo 174 | echo " init Initialize an ergo bootstrap cluster" 175 | echo " start Start the cluster" 176 | echo " stop Stop the cluster" 177 | echo " status Get status of an initialized cluster" 178 | echo " destroy Destroy the current cluster" 179 | exit 1 180 | esac 181 | -------------------------------------------------------------------------------- /.github/ergo-bootstrap-init.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 83 | 106 | 107 | 108 | $ ./ $ ./e $ ./er $ ./ergo-bootstrap $ ./ergo-bootstrap i $ ./ergo-bootstrap in $ ./ergo-bootstrap ini $ ./ergo-bootstrap init $ ./ergo-bootstrap init Welcome to Σrgo bootstrap!We're going to initialize a new Ergo Bootstrap cluster for you.The Ergo blockchain node is the core of this bootstrap cluster, but there areother components that you might find useful. Please refer to the documentationavailable at http://github.com/ergoplatform/ergo-bootstrap to find out more abouteach of these components.❔ Do you wish to initialize the Ergo Explorer API?1) Yes2) No#? #? 1 #? 1❔ Do you wish to initialize the Ergo Explorer Frontend?#? 2 #? 2❔ Do you wish to initialize the Yoroi backend?❔ Would you like to spin up monitoring for your cluster?Congratulations! Your cluster has been initialized. Pick upa good book, brew some coffee, this will take some time.Press Enter to Continue.Creating ergo-bootstrap_ergo-postgresql_1 ... Creating ergo-bootstrap_ergo-redis_1 ... Creating ergo-bootstrap_ergo-node_1 ... Creating ergo-bootstrap_ergo-postgresql_1 ... done Creating ergo-bootstrap_ergo-redis_1 ... done Creating ergo-bootstrap_ergo-node_1 ... done Creating ergo-bootstrap_ergo-explorer-utx-broadcaster_1 ... Creating ergo-bootstrap_ergo-explorer-api_1 ... Creating ergo-bootstrap_ergo-explorer-backend-chain-grabber_1 ... Creating ergo-bootstrap_ergo-explorer-utx-tracker_1 ... Creating ergo-bootstrap_ergo-explorer-api_1 ... done Creating ergo-bootstrap_ergo-explorer-utx-tracker_1 ... done Creating ergo-bootstrap_ergo-explorer-backend-chain-grabber_1 ... done Creating ergo-bootstrap_ergo-explorer-utx-broadcaster_1 ... done $ exit 109 | --------------------------------------------------------------------------------