Skip to content

Commit a9865df

Browse files
Merge pull request #1 from CryptoManufaktur-io/BCE-8698-GAL-445-Create-TON-RPCs
Bce 8698 gal 445 create ton docker
2 parents 6f5db43 + 3578646 commit a9865df

20 files changed

Lines changed: 775 additions & 114 deletions

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@
55
*.bak
66
*.original
77
custom.yml
8+
.idea/
9+
*.iml
10+
*.ipr
11+
*.iws
12+
.vscode/
13+
.DS_Store
14+
*.log
15+
*.tmp
16+
tmp/
17+
temp/

.pre-commit-config.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ repos:
1010
- id: check-shebang-scripts-are-executable
1111
- id: check-executables-have-shebangs
1212
- id: detect-private-key
13-
- id: check-ast
14-
- id: debug-statements
1513
- id: check-merge-conflict
1614
- id: check-added-large-files
1715
- id: mixed-line-ending
1816
- id: check-case-conflict
19-
- id: requirements-txt-fixer
20-
- id: check-toml
2117

2218
- repo: https://github.com/jumanjihouse/pre-commit-hooks
2319
rev: 3.0.0
@@ -33,13 +29,7 @@ repos:
3329
rev: v2.4.1
3430
hooks:
3531
- id: codespell
36-
37-
# Dockerfiles
38-
# Disabled bcs macOS Docker might not be installed
39-
# - repo: https://github.com/hadolint/hadolint
40-
# rev: v2.13.1
41-
# hooks:
42-
# - id: hadolint-docker
32+
args: ['-L', 'pyton']
4333

4434
# YAML style (beyond syntax)
4535
- repo: https://github.com/adrienverge/yamllint

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Overview
2+
3+
Docker Compose for TON (The Open Network) liteserver nodes.
4+
5+
`cp default.env .env`, then `nano .env` and adjust values for the right network (mainnet/testnet), particularly `GLOBAL_CONFIG_URL` and `SNAPSHOT`.
6+
7+
Meant to be used with [central-proxy-docker](https://github.com/CryptoManufaktur-io/central-proxy-docker) for traefik and Prometheus remote write; use `:ext-network.yml` in `COMPOSE_FILE` inside `.env` in that case.
8+
9+
`./ethd install` brings in docker-ce, if you don't have Docker installed already.
10+
11+
`cp default.env .env`
12+
13+
`nano .env` and adjust variables, particularly `GLOBAL_CONFIG_URL` and `SNAPSHOT`
14+
15+
`./ethd up`
16+
17+
To update the software, run `./ethd update` and then `./ethd up`
18+
19+
Initial sync: ~10 hours (~4-5 hours with snapshot).
20+
21+
# Configuration
22+
23+
## Mainnet
24+
25+
Basic setup:
26+
```properties
27+
TON_BRANCH=mainnet
28+
GLOBAL_CONFIG_URL=https://ton.org/global.config.json
29+
SNAPSHOT=latest
30+
```
31+
32+
With HTTP API (Traefik):
33+
```properties
34+
COMPOSE_FILE=ton.yml:ton-http-api.yml
35+
```
36+
37+
With HTTP API (direct port):
38+
```properties
39+
COMPOSE_FILE=ton.yml:ton-http-api.yml:ton-http-api-shared.yml
40+
TON_API_HTTP_PORT=8081
41+
```
42+
43+
With local RPC access:
44+
```properties
45+
COMPOSE_FILE=ton.yml:ton-shared.yml
46+
```
47+
48+
## Testnet
49+
50+
```properties
51+
TON_BRANCH=testnet
52+
GLOBAL_CONFIG_URL=https://ton.org/testnet-global.config.json
53+
SNAPSHOT=latest_testnet
54+
```
55+
56+
## HTTP API
57+
58+
Test endpoints:
59+
```bash
60+
# masterchain info
61+
curl -H 'Content-Type: application/json' \
62+
-d '{"jsonrpc":"2.0","id":1,"method":"getMasterchainInfo","params":[]}' \
63+
http://localhost:8081
64+
65+
# health check
66+
curl http://localhost:8081/healthcheck
67+
```
68+
69+
# Operations
70+
71+
## Check Sync Status
72+
```bash
73+
./scripts/check-sync.sh
74+
```
75+
Exit codes: 0=synced, 1=syncing, 2=error
76+
77+
## Monitor Logs
78+
```bash
79+
./ethd logs -f ton
80+
```
81+
82+
## Node Status
83+
```bash
84+
docker compose exec ton mytonctrl
85+
MyTonCtrl> status
86+
```
87+
88+
# Hardware Requirements
89+
90+
**Mainnet:**
91+
- 16 cores, 64GB RAM
92+
- 1TB SSD/NVMe (~250GB used, grows over time)
93+
- 1 Gbps, 10TB+ monthly traffic
94+
95+
**Testnet:** Similar, ~100GB storage
96+
97+
# Ports
98+
99+
Default ports (customizable in `.env`):
100+
- `VALIDATOR_PORT` (30001/udp) - P2P networking
101+
- `LITESERVER_PORT` (30003/tcp) - Liteserver connections
102+
- `VALIDATOR_CONSOLE_PORT` (30002/tcp) - Console access
103+
104+
Public IP auto-detected on startup. Override with `PUBLIC_IP` in `.env` if needed.
105+
106+
# Customization
107+
108+
Use `custom.yml` to override any settings (not tracked by git). Add to `COMPOSE_FILE` in `.env`.
109+
110+
See `default.env` for all options.
111+
112+
## Version
113+
114+
This is TON Docker v1.0.0

README.md.example

Lines changed: 0 additions & 35 deletions
This file was deleted.

default.env

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# copy to .env and adjust
2+
COMPOSE_FILE=ton.yml
3+
4+
# uncomment to override public ip (kubernetes/special networks)
5+
#PUBLIC_IP=
6+
7+
TON_BRANCH=mainnet
8+
9+
# testnet: https://ton.org/testnet-global.config.json
10+
GLOBAL_CONFIG_URL=https://ton.org/global.config.json
11+
12+
MYTONCTRL_VERSION=master
13+
TELEMETRY=true
14+
IGNORE_MINIMAL_REQS=true
15+
MODE=liteserver
16+
17+
ARCHIVE_TTL=2592000
18+
STATE_TTL=86400
19+
VERBOSITY=1
20+
21+
LITESERVER_PORT=30003
22+
VALIDATOR_PORT=30001
23+
VALIDATOR_CONSOLE_PORT=30002
24+
25+
TON_HOST=ton
26+
TON_API_HOST=ton-api
27+
DOMAIN=example.com
28+
29+
# faster sync (~200GB): latest | latest_testnet | https://dump.ton.org/dumps/latest.tar.lz
30+
SNAPSHOT=
31+
32+
TON_DOCKERFILE=Dockerfile.binary
33+
TON_DOCKER_TAG=latest
34+
TON_DOCKER_REPO=ghcr.io/ton-blockchain/ton-docker-ctrl
35+
36+
# add ton-http-api.yml to COMPOSE_FILE to enable
37+
TON_API_HTTP_PORT=8081
38+
TON_API_LOGS_LEVEL=INFO
39+
TON_API_GET_METHODS_ENABLED=1
40+
TON_API_JSON_RPC_ENABLED=1
41+
TON_API_WEBSERVERS_WORKERS=1
42+
TON_API_CACHE_ENABLED=0
43+
TON_API_ROOT_PATH=/
44+
TON_API_TONLIB_PARALLEL_REQUESTS_PER_LITESERVER=50
45+
TON_API_TONLIB_REQUEST_TIMEOUT=10
46+
TON_API_LOGS_JSONIFY=0
47+
TON_API_GUNICORN_FLAGS=
48+
49+
SCRIPT_TAG=
50+
51+
# do not adjust
52+
ENV_VERSION=1

default.env.example

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)