Skip to content

Commit adf5a3a

Browse files
authored
Merge pull request #69 from tronprotocol/develop
Merge develop to main
2 parents 7462c50 + f02ca09 commit adf5a3a

File tree

199 files changed

+45833
-1893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+45833
-1893
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy new docker fullnode
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bucket-name:
7+
description: 'S3 bucket name to upload tron-docker.zip'
8+
required: true # Makes the input mandatory
9+
aws-region:
10+
description: 'AWS region for the S3 bucket (e.g., ap-southeast-1)'
11+
required: true # Makes the input mandatory
12+
13+
jobs:
14+
build-and-sign:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Zip files from tools/docker/codepipeline into tron-docker.zip (no directory structure)
21+
run: |
22+
# Ensure the directory exists
23+
if [ -d "tools/docker/codepipeline" ]; then
24+
cd tools/docker/codepipeline
25+
zip -r ../../../tron-docker.zip ./appspec.yml ./validate_service.sh ./start_service.sh ./prepare_environment.sh ./docker-compose.fullnode.main.yml
26+
else
27+
echo "Error: tools/docker/codepipeline directory not found!"
28+
exit 1
29+
fi
30+
31+
- name: Import GPG key
32+
uses: crazy-max/ghaction-import-gpg@v6
33+
with:
34+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
35+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
36+
37+
- name: Sign tron-docker.zip with GPG
38+
run: |
39+
gpg --detach-sign --armor tron-docker.zip
40+
# This creates tron-docker.zip.asc (ASCII-armored signature)
41+
42+
- name: Configure AWS Credentials
43+
uses: aws-actions/configure-aws-credentials@v4
44+
with:
45+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
46+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47+
aws-region: ${{ github.event.inputs.aws-region }} # Use input for region
48+
49+
- name: Upload tron-docker.zip to S3
50+
run: |
51+
zip -r publish.zip tron-docker.zip tron-docker.zip.asc
52+
aws s3 cp publish.zip s3://${{ github.event.inputs.bucket-name }}/package/publish-latest.zip
53+
aws s3 cp publish.zip s3://${{ github.event.inputs.bucket-name }}/package/publish-v0.1.1.zip

.gitignore

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,35 @@ tools/docker/reports/
88
build/
99
tmp/
1010
target/
11-
tools/dbfork/logs/
11+
logs/
1212
libs/
1313
metric_monitor/datadir
1414
private_net/datadir
15+
datadir/
16+
logs/
17+
output-directory/
1518
tron-docker.iml
19+
bin/
20+
21+
trond
22+
!trond/
23+
.DS_Store
24+
go
25+
gopath
26+
go1.*
27+
*FullNode_output-directory*
28+
*.pub
29+
30+
/single_node/output-directory/
31+
/metric_monitor/logs/
32+
/private_net/logs/
33+
/logs_monitor/loki-data/
34+
/logs_monitor/minio/
35+
/logs_monitor/promtail-data/
36+
/metric_monitor/prometheus_data/
37+
/metric_monitor/receive-data/
38+
/metric_monitor/minio/
39+
/metric_monitor/helm-charts/thanos-receive/charts/
40+
/metric_monitor/helm-charts/thanos-receive/Chart.lock
41+
/metric_monitor/store-data/
42+
/metric_monitor/grafana_data/

.pre-commit-config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ repos:
1313
- repo: 'https://github.com/jumanjihouse/pre-commit-hooks'
1414
rev: 3.0.0
1515
hooks:
16+
- id: shellcheck
1617
- id: script-must-have-extension
1718
- id: git-dirty
1819
- id: git-check
19-
- repo: 'https://github.com/koalaman/shellcheck-precommit'
20-
rev: v0.7.2
21-
hooks:
22-
- id: shellcheck
2320
- repo: local # check java files format use a customized script
2421
hooks:
2522
- id: checkstyle

CONTRIBUTING.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@
33
tron-docker is an open-source project designed to facilitate the usage of the TRON network. We understand that there is much left to be desired, and if you see any room for improvement, please let us know. Thank you. All contributed code will be covered by the [LGPLv3 license](https://github.com/tronprotocol/tron-docker/blob/main/LICENSE) of this project.
44

55
Here are some guidelines to get started quickly and easily:
6-
- [Before contribution](#Before-contribution)
7-
- [Contribute to tron-docker](#Contribute-to-tron-docker)
8-
- [Key Branches](#Key-Branches)
9-
- [Submitting Code Steps](#Submitting-Code-Steps)
10-
- [Commit Messages](#Commit-Messages)
11-
- [Branch Naming Conventions](#Branch-Naming-Conventions)
12-
- [Pull Request Best Practise](#Pull-request-best-practise)
13-
- [Special Situations And How To Deal With Them](#Special-Situations-And-How-To-Deal-With-Them)
14-
- [Conduct](#Conduct)
6+
- [Contributing](#contributing)
7+
- [Before contribution](#before-contribution)
8+
- [Ask a question](#ask-a-question)
9+
- [Reporting an issue](#reporting-an-issue)
10+
- [Request a feature](#request-a-feature)
11+
- [Contribute to tron-docker](#contribute-to-tron-docker)
12+
- [Key branches](#key-branches)
13+
- [Submitting code steps](#submitting-code-steps)
14+
- [Fork then make changes](#fork-then-make-changes)
15+
- [Linting](#linting)
16+
- [Push code](#push-code)
17+
- [Commit messages](#commit-messages)
18+
- [Branch naming conventions](#branch-naming-conventions)
19+
- [Pull request best practise](#pull-request-best-practise)
20+
- [Special situations and how to deal with them](#special-situations-and-how-to-deal-with-them)
21+
- [Conduct](#conduct)
1522

1623
## Before contribution
1724

@@ -94,7 +101,7 @@ Commit the new branch to your personal remote repository.
94101

95102
#### Linting
96103

97-
tron-docker CI uses [pre-commit](https://pre-commit.com/) to lint all code within the repo. Add it to your local following the [installation](https://pre-commit.com/#installation). Check [.pre-commit-config.yaml](.pre-commit-config-fix.yaml) for existing validators.
104+
tron-docker CI uses [pre-commit](https://pre-commit.com/) to lint all code within the repo. Add it to your local following the [installation](https://pre-commit.com/#installation). And ensure ShellCheck is also installed, refer to [installation](https://github.com/koalaman/shellcheck?tab=readme-ov-file#installing). Check [.pre-commit-config.yaml](.pre-commit-config-fix.yaml) for existing validators.
98105

99106
#### Push code
100107

@@ -148,7 +155,7 @@ Here is an example:
148155
```
149156
fix(private_net): update docker-compose
150157
151-
1. fix docker-compose container tron_node1 command paramters, add more JVM GC flags
158+
1. fix docker-compose container tron-node1 command paramters, add more JVM GC flags
152159
2. update the corresponding JVM flags explanation in README.md
153160
154161
Closes #1234

README.md

Lines changed: 169 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,187 @@
11
# TRON Docker
22

3-
This repository provides guidance and tools for the community to quickly get started with TRON network and development.
3+
This repository provides tools and guidance to help the community quickly get started with the TRON network and development.
44

55
## Features
66

7-
### Quick start for single FullNode
7+
### 🚀 Quick start for single FullNode
8+
Easily deploy a single TRON FullNode connected to **Mainnet** or **Nile testnet** using Docker. Follow the instructions to get your node up and running in minutes.
89

9-
This repository includes Docker configurations to quickly start a single TRON FullNode connected to the Mainnet or NileNet. Simply follow the instructions to get your node up and running in no time.
10+
### 🔗 Private chain setup
11+
Set up your own private TRON blockchain network for development and testing. The provided configurations simplify deployment and management, making it ideal for custom use cases.
1012

11-
### Private chain setup
12-
13-
You can also use this repository to set up a private TRON blockchain network. This is useful for development and testing purposes. The provided configurations make it straightforward to deploy and manage your own private chain.
14-
15-
### Node monitoring with Prometheus and Grafana
16-
17-
Monitoring the health and performance of your TRON nodes is made easy with integrated Prometheus and Grafana services. The repository includes configurations to set up these monitoring tools, allowing you to visualize and track various metrics in real time.
18-
19-
### Tools
13+
### 📊 Node monitoring with Prometheus and Grafana
14+
Monitor the health and performance of your TRON nodes with integrated **Prometheus** and **Grafana** services. Real-time metrics and visualizations are just a few steps away.
2015

16+
### 🛠️ Tools
2117
We also provide tools to facilitate the CI and testing process:
22-
- Gradle Docker: Using Gradle to automate the build and test processes for java-tron image.
23-
- DB Fork: This tool helps launch a private Java-Tron network based on the state of the Mainnet database to support shadow fork testing.
24-
25-
## Getting Started
26-
27-
### Prerequisites
28-
29-
- Docker
30-
- Docker Compose
31-
32-
### Installation
33-
34-
1. **Clone the repository:**
35-
```sh
36-
git clone https://github.com/tronprotocol/tron-docker.git
37-
cd tron-docker
38-
```
39-
40-
2. **Start the services:**
41-
Navigate to the corresponding directory and follow the instructions in the respective README. Then you can easily start the services.
42-
- To start a single FullNode, use the folder [single_node](./single_node).
43-
- To set up a private TRON network, use the folder [private_net](./private_net).
44-
- To monitor the TRON node, use the folder [metric_monitor](./metric_monitor).
45-
- To use Gradle with Docker, check [gradle docker](./tools/docker/README.md).
46-
- To do shadow fork testing, check [db fork guidance](./tools/dbfork/README.md).
18+
- **Gradle Docker**: Automate the build and testing of the `java-tron` Docker image using Gradle.
19+
- **Toolkit**: This package contains a set of database tools for TRON:
20+
- `mv, move`: Move db to pre-set new path. For example HDD,reduce storage
21+
expenses.
22+
- `archive`: A helper to rewrite leveldb manifest.
23+
- `convert`: Covert leveldb to rocksdb.
24+
- `lite`: Split lite data for java-tron.
25+
- `cp, copy`: Quick copy leveldb or rocksdb data.
26+
- `root`: compute merkle root for tiny db. NOTE: large db may GC overhead
27+
limit exceeded.
28+
- `fork`: Modify the database of java-tron for shadow fork testing.
29+
- `query`: Query the latest vote and reward information from the database.
30+
- **Stress Test**: Execute the stress test and evaluate the performance of the `java-tron` fullnode.
31+
32+
33+
## Prerequisites
34+
Please ensure you have the latest versions of Docker and Docker Compose installed by downloading them from the official websites:
35+
36+
- **For Mac:**
37+
Download Docker from [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/).
38+
Docker Compose is included in the Docker installation package for Mac.
39+
- After installation, open Docker application, navigate to Settings \-> Resources \-> Network, and check the option \`Use kernel networking for UDP\`. Then restart Docker to apply.
40+
41+
- **For Linux:**
42+
Download and install both Docker and Docker Compose plugin from the official websites:
43+
- Docker: [Install Docker on Linux](https://docs.docker.com/desktop/setup/install/linux/)
44+
- Docker Compose standalone: [Install Docker Compose on Linux](https://docs.docker.com/compose/install/standalone/)
45+
46+
## Official Docker image
47+
There are two official Docker images for java-tron:
48+
49+
- `tronprotocol/java-tron`: This image is based on the official [java-tron](https://github.com/tronprotocol/java-tron) repository, used for the Mainnet, and mostly can be used for the Nile testnet too. (**All the demo in this repository are based on this image**)
50+
- `tronnile/java-tron`: This image is based on the [nile-testnet](https://github.com/tron-nile-testnet/nile-testnet) repository which is forked from [java-tron](https://github.com/tronprotocol/java-tron). You need to use this image for the Nile testnet when there is new test release from java-tron and before it was released, especially for the hard fork test on Nile. Information about code release of the Nile testnet, please refer to this [website](https://nileex.io/).
51+
52+
## Quick Start
53+
To quickly start a java-tron node that connects to the Mainnet, simply use the following Docker command:
54+
55+
```sh
56+
docker run -it --name tron-node -d --memory="16g" -p 8090:8090 -p 50051:50051 tronprotocol/java-tron
57+
```
58+
59+
Alternatively, you can download and run the [docker-compose](single_node/docker-compose-quick-start.yml) file using the command:
60+
61+
```sh
62+
docker-compose -f docker-compose-quick-start.yml up
63+
```
64+
65+
Once the FullNode starts, it will begin to sync blocks with Mainnet from the genesis block. You can use the following API request to check the current synced blocks:
66+
```
67+
Request:
68+
curl --location --request POST 'http://127.0.0.1:8090/wallet/getnowblock'
69+
70+
Response example:
71+
{
72+
"blockID": "00000000002ceed0bf4668aae518d143dfe1b74eea037a1caed98e0d4ea00de4",
73+
"block_header": {
74+
"raw_data": {
75+
"number": 2944720,
76+
"txTrieRoot": "d9c4fbe7c210ada548ac54460d717a5fce70d621b1e3da1db425672cbf477ca5",
77+
"witness_address": "41f29f57614a6b201729473c837e1d2879e9f90b8e",
78+
"parentHash": "00000000002ceecf692df37b4300746b9c68f7bdfad6d15a74859ceaff852f90",
79+
"version": 1,
80+
"timestamp": 1538758257000
81+
},
82+
"witness_signature": "445ad3d0585e24b60a9bceec0d97ac70b1558f42b44d24ef62f400a7c2646a271f01b83de985c5796485f74fd69d7b11c50b9ce44ad193fa35e26b317d3e339401"
83+
},
84+
"transactions": [
85+
{
86+
"signature": [
87+
"948c3cbe1b48a20661878e591cf4c7fea7d1c63836b1523f5b0b003a290629714bfa4f4e6e6398a8edbca076b9c263c36b226b0f5a046ca3d54098b9e95d1c8e00"
88+
],
89+
"txID": "25e0b74bcd0e7b2691945cce61ccafdf0be879c21fc729e6c25646350b611ad6",
90+
"raw_data": {
91+
"contract": [
92+
{
93+
"parameter": {
94+
"value": {
95+
"amount": 1,
96+
"asset_name": "49504653",
97+
"owner_address": "41d13433f53fdf88820c2e530da7828ce15d6585cb",
98+
"to_address": "414f93486fa5d2685c70a3dd7e0815769a9fd3f02b"
99+
},
100+
"type_url": "type.googleapis.com/protocol.TransferAssetContract"
101+
},
102+
"type": "TransferAssetContract"
103+
}
104+
],
105+
"ref_block_bytes": "eece",
106+
"ref_block_hash": "36ef820a1c8df903",
107+
"expiration": 1538758311000,
108+
"timestamp": 1538758251854
109+
},
110+
"raw_data_hex": "0a02eece220836ef820a1c8df90340d8f891a9e42c5a700802126c0a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e736665724173736574436f6e747261637412360a0449504653121541d13433f53fdf88820c2e530da7828ce15d6585cb1a15414f93486fa5d2685c70a3dd7e0815769a9fd3f02b200170ceaa8ea9e42c"
111+
},
112+
...
113+
]
114+
}
115+
116+
```
117+
You can also use `docker exec tron-node tail -f ./logs/tron.log` to check the node and syncing status.
118+
119+
For more details on using database snapshort or customized configurations, please refer to the [single_node](single_node/README.md) section.
120+
121+
## Start all features
122+
First, clone the repository:
123+
124+
```sh
125+
git clone https://github.com/tronprotocol/tron-docker.git
126+
cd tron-docker
127+
```
128+
129+
### Start feature by trond tool
130+
We offer a `trond` command-line tool that allows developers to easily initiate features with a single command, enabling the community to quickly engage in TRON network development and interaction.
131+
132+
To build the `trond` command-line tool, simply run `build_trond.sh`.
133+
```sh
134+
# this will generate trond in current directory
135+
./build_trond.sh
136+
```
137+
After that, you can explore all the commands it supports.
138+
```
139+
./trond -h
140+
Usage:
141+
trond [command]
142+
143+
Examples:
144+
# Help information for java-tron Docker image build and testing commands
145+
$ ./trond docker
146+
147+
# Help information for database snapshot download-related commands
148+
$ ./trond snapshot
149+
150+
# Help information for java-tron node deployment commands
151+
$ ./trond node
152+
153+
Available Commands:
154+
docker Commands for operating the java-tron Docker image.
155+
help Help about any command
156+
node Commands for operating the java-tron Docker node.
157+
snapshot Commands for obtaining java-tron node snapshots.
158+
```
159+
Check the output of `./trond -h`, which now supports the following features:
160+
- Download database snapshots. It is used to save time by avoiding the need to sync from the genesis block.
161+
- Build and test the java-tron Docker image locally. Note that it is not mandatory for deploying a node, as you can use the Docker image available on the official Docker Hub.
162+
- Deploy a single FullNode for various networks.
163+
164+
For more details on the `trond` command-line tools and how they work, please refer to the [README](./tools/trond/README.md).
165+
166+
### Start the feature individually
167+
To start all available features, or you want more customized operations, navigate to the respective directory and follow the instructions in the corresponding README to start the services:
168+
- **TRON network deployment related:**
169+
- **Single FullNode**: Use the [single_node](./single_node) folder.
170+
- **Private TRON network**: Use the [private_net](./private_net) folder.
171+
- **Node monitoring**: Use the [metric_monitor](./metric_monitor) folder. We provide two solutions: one with enhanced security considerations and another with a simpler setup.
172+
173+
- **Tools**:
174+
- **Gradle Docker**: Automate Docker image builds and testing. Check the [gradle docker](./tools/docker/README.md) documentation.
175+
- **Toolkit**: Perform a set of database related operations. Follow the [Toolkit guidance](./tools/toolkit/README.md).
176+
- **Stress Test**: Execute the stress test. Follow the [stress test guidance](./tools/stress_test/README.md).
47177

48178
## Troubleshooting
49179
If you encounter any difficulties, please refer to the [Issue Work Flow](https://tronprotocol.github.io/documentation-en/developers/issue-workflow/#issue-work-flow), then raise an issue on [GitHub](https://github.com/tronprotocol/tron-docker/issues). For general questions, please use [Discord](https://discord.gg/cGKSsRVCGm) or [Telegram](https://t.me/TronOfficialDevelopersGroupEn).
50180

51-
# Contributing
181+
## Contributing
52182

53183
All contributions are welcome. Check [contribution](CONTRIBUTING.md) for more details.
54184

55-
# License
185+
## License
56186

57187
This repository is released under the [LGPLv3 license](https://github.com/tronprotocol/tron-docker/blob/main/LICENSE).

0 commit comments

Comments
 (0)