-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable to run Local network with a consensus node and mirror node (#1)
* initial commit for single docker-compose.yml * update pointers * get latest changes * working changes for node * add .gitkeep * add .gitkeep * update pointers * remove committing to logs * disable monitor * change address book file * create bucket in minio at startup * add uploaders .. but not working * changes for syncing to minio bucket * Updated minio config methodolgy * Update .env file * working record stream uploader * uploaders for eventstreams and accountbalances Signed-off-by: Neeharika-Sompalli <[email protected]> * working uploaders * fix extension for account balances * remove rosetta, monitor as per review comments and add bind mount to stats csv file * remove redis and use polling * remove submodules and update README.md * remove event streams uploaders and set JAVA_HEAP_MAx to 2g * Update gitignore and remove old address book (not in use) * Added forced mapping of the network-node IP * Fix node IP address * Fix for broken YAML * Prevent network-node from using hedera user (UID: 2000) * Disable event streams * Fix uploader * Fix case of bucket path for record streams * Apply memlimits to importer and grpc * Apply memlimits to web3 * Apply memlimits to rest * Increase importer mem limits * add README.md * remove empty settings * remove explicit branch name * remove not needed log * keep only one address in addressBook.txt * address a few review comments * delete .idea folder Signed-off-by: Neeharika-Sompalli <[email protected]> * add minio-server/data/ to gitignore * split to separate networks * delete network-logs folder and create minio bucket runtime. Remove gc.log and stdout.log mounts * update README and add volume mount for minio data * ignore all files in network-logs Co-authored-by: Nathan Klick <[email protected]>
- Loading branch information
1 parent
ba4b9d4
commit 6de4da6
Showing
37 changed files
with
1,075 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
TAG=0.11.0 | ||
REGISTRY_PREFIX=gcr.io/hedera-registry/ | ||
#### Image Names & Prefixes #### | ||
HAVEGED_IMAGE_PREFIX=gcr.io/hedera-registry/ | ||
NETWORK_NODE_IMAGE_PREFIX=gcr.io/hedera-registry/ | ||
NETWORK_NODE_IMAGE_NAME=main-network-node | ||
|
||
#### Image Tags/Hashes #### | ||
UBUNTU_IMAGE_SHA256=ceed028aae0eac7db9dd33bd89c14d5a9991d73443b0de24ba0db250f47491d2 | ||
POSTGRES_IMAGE_SHA256=7ced77a458b7d6f4f3e4abfa55d6428fdcd0016e1926cb7463250b54b06480a1 | ||
NETWORK_NODE_IMAGE_TAG=0.22.0 | ||
HAVEGED_IMAGE_TAG=0.22.0 | ||
|
||
#### PostgreSQL settings #### | ||
POSTGRES_DB=fcfs | ||
POSTGRES_USER=swirlds | ||
POSTGRES_PASSWORD=password | ||
|
||
#### Java Process Settings #### | ||
JAVA_HEAP_MIN=256m | ||
JAVA_HEAP_MAX=2g | ||
JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*:gc.log" | ||
|
||
#### Bind Mount Settings #### | ||
NETWORK_NODE_LOGS_ROOT_PATH=./network-logs/node | ||
APPLICATION_ROOT_PATH=./compose-network/network-node | ||
|
||
#### Network Node Memory Limits #### | ||
NETWORK_NODE_MEM_LIMIT=8gb | ||
|
||
#### MirrorNode settings #### | ||
MIRROR_POSTGRES_IMAGE=postgres:13.5-alpine | ||
#### MINIO settings #### | ||
MINIO_ROOT_USER=minioadmin | ||
MINIO_ROOT_PASSWORD=minioadmin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,153 @@ | ||
compose-network/ | ||
db/ | ||
data/ | ||
## Temporary node files | ||
*.log | ||
network-logs/** | ||
|
||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### Linux template | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### Windows template | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
### macOS template | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### GPG template | ||
secring.* | ||
|
||
### MinIO server logs | ||
network-logs/minio-server/data/** | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
# How to run a a mirror node with a local services code | ||
# How to run a local node with a mirror node and consensus node | ||
|
||
### Setup | ||
|
||
Clone this repository and initialize submodules: | ||
1. Clone this repository. | ||
2. Run `docker-compose up -d` from the console. | ||
3. After the run do `docker-compose down -v; git clean -xfd; git reset --hard` to stop and remove the containers, volumes and clean generated files. | ||
|
||
`git submodule update --init --recursive` | ||
### Folder set up | ||
1. `compose-network` folder has the static files needed for starting Local network. | ||
2. `network-logs` folder will be created at runtime and will have all the log files generated after starting local node. | ||
|
||
### Start hedera-services | ||
### NOTE | ||
1. Ensure to use Docker Compose version 1.29.2 on macOS, due to known bug in Docker Compose V2. | ||
2. Ensure the `gRPC FUSE for file sharing` and `Use Docker Compose V2` settings are disabled in the docker settings. | ||
|
||
`docker-compose -f services/docker-compose.yml -f docker-compose.override-services.yml up -d` | ||
|
||
### Start the mirrornode | ||
|
||
`docker-compose -f mirror/docker-compose.yml -f docker-compose.override-mirror.yml up -d` | ||
![docker-compose-settings.png](docker-compose-settings.png) |
Binary file not shown.
10 changes: 9 additions & 1 deletion
10
application.yml → compose-network/mirror-node/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
hedera: | ||
mirror: | ||
grpc: | ||
listener: | ||
type: SHARED_POLL | ||
importer: | ||
parser: | ||
record: | ||
entity: | ||
redis: | ||
enabled: false | ||
downloader: | ||
accessKey: minioadmin | ||
cloudProvider: "S3" | ||
secretKey: minioadmin | ||
bucketName: hedera-streams | ||
endpointOverride: http://minio:9000 | ||
initialAddressBook: "/usr/etc/hedera-mirror-importer/local-dev-1-node.addressbook.f102.json.bin" | ||
network: OTHER | ||
network: OTHER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
PGCONF="${PGCONF:-/var/lib/postgresql/data}" | ||
PGHBA="${PGCONF}/pg_hba.conf" | ||
DB_SPECIFIC_SQL="alter user :ownerUsername with createrole;" | ||
|
||
# TimescaleDB v2 schema no longer creates the REST API user, while v1 schema still does | ||
if [[ "${TIMESCALEDB}" == "true" ]]; then | ||
DB_SPECIFIC_SQL="create user :restUsername with login password :'restPassword' in role readonly;" | ||
fi | ||
|
||
cp "${PGHBA}" "${PGHBA}.bak" | ||
echo "local all all trust" > "${PGHBA}" | ||
pg_ctl reload | ||
|
||
psql -d "user=postgres connect_timeout=3" \ | ||
--set ON_ERROR_STOP=1 \ | ||
--set "dbName=${DB_NAME:-mirror_node}" \ | ||
--set "dbSchema=${DB_SCHEMA:-public}" \ | ||
--set "grpcPassword=${GRPC_PASSWORD:-mirror_grpc_pass}" \ | ||
--set "grpcUsername=${GRPC_USERNAME:-mirror_grpc}" \ | ||
--set "importerPassword=${IMPORTER_PASSWORD:-mirror_importer_pass}" \ | ||
--set "importerUsername=${IMPORTER_USERNAME:-mirror_importer}" \ | ||
--set "ownerPassword=${OWNER_PASSWORD:-mirror_node_pass}" \ | ||
--set "ownerUsername=${OWNER_USERNAME:-mirror_node}" \ | ||
--set "restPassword=${REST_PASSWORD:-mirror_api_pass}" \ | ||
--set "restUsername=${REST_USERNAME:-mirror_api}" \ | ||
--set "rosettaPassword=${ROSETTA_PASSWORD:-mirror_rosetta_pass}" \ | ||
--set "rosettaUsername=${ROSETTA_USERNAME:-mirror_rosetta}" \ | ||
--set "web3Password=${WEB3_PASSWORD:-mirror_web3_pass}" \ | ||
--set "web3Username=${WEB3_USERNAME:-mirror_web3}" <<__SQL__ | ||
-- Create database & owner | ||
create user :ownerUsername with login password :'ownerPassword'; | ||
create database :dbName with owner :ownerUsername; | ||
alter database :dbName set timescaledb.telemetry_level = off; | ||
-- Add extensions | ||
create extension if not exists pg_stat_statements; | ||
-- Create roles | ||
create role readonly; | ||
create role readwrite in role readonly; | ||
-- Create users | ||
create user :grpcUsername with login password :'grpcPassword' in role readonly; | ||
create user :importerUsername with login password :'importerPassword' in role readwrite; | ||
create user :rosettaUsername with login password :'rosettaPassword' in role readonly; | ||
create user :web3Username with login password :'web3Password' in role readonly; | ||
${DB_SPECIFIC_SQL} | ||
\connect :dbName | ||
alter schema public owner to :ownerUsername; | ||
-- Create schema | ||
\connect :dbName :ownerUsername | ||
create schema if not exists :dbSchema authorization :ownerUsername; | ||
grant usage on schema :dbSchema to public; | ||
revoke create on schema :dbSchema from public; | ||
-- Grant readonly privileges | ||
grant connect on database :dbName to readonly; | ||
grant select on all tables in schema :dbSchema to readonly; | ||
grant select on all sequences in schema :dbSchema to readonly; | ||
grant usage on schema :dbSchema to readonly; | ||
alter default privileges in schema :dbSchema grant select on tables to readonly; | ||
alter default privileges in schema :dbSchema grant select on sequences to readonly; | ||
-- Grant readwrite privileges | ||
grant insert, update on all tables in schema :dbSchema to readwrite; | ||
grant usage on all sequences in schema :dbSchema to readwrite; | ||
alter default privileges in schema :dbSchema grant insert, update on tables to readwrite; | ||
alter default privileges in schema :dbSchema grant usage on sequences to readwrite; | ||
-- Alter search path | ||
\connect postgres postgres | ||
alter database :dbName set search_path = :dbSchema, public; | ||
__SQL__ | ||
|
||
mv "${PGHBA}.bak" "${PGHBA}" | ||
pg_ctl reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
############################################################################################### | ||
# Configuration file, for automatically running multiple instances | ||
############################################################################################### | ||
swirld, hedera | ||
app, HederaNode.jar | ||
address, n0, node0, 1, network-node, 50111, network-node, 50111, 0.0.3 |
Oops, something went wrong.