Dockerized reverse proxy for TON blockchain Websites
885
š A lightweight Docker image for running the TON Utils Reverse Proxyā ā effortlessly serve your websites through TON DNS domains. Perfect for decentralized hosting on the TON blockchain!
.ton domain.Create a persistent config directory and initialize the proxy:
mkdir -p ./tonutils-config
docker run -it --rm \
-v $(pwd)/tonutils-config:/app \
-e FIRST_INIT=true \
-e DOMAIN="namespace.ton" \
tonnamespace/reverse-proxy:latest
This command will:
config.json../tonutils-config directory.TX_URL=true during init to get a direct transaction URL instead.Wait for the transaction to confirm on the TON blockchain (usually ~5-10 seconds).
Launch the proxy in detached mode:
docker run -d \
--name tonutils-proxy \
-p 8765:8765 \
-v $(pwd)/tonutils-config:/app \
-e PROXY_PASS="https://namespace.my/" \
-e EXTERNAL_IP="your_server_ip" \
tonnamespace/reverse-proxy:latest
Your site is now live at http://namespace.ton! š
| Variable | Required | Default | Description |
|---|---|---|---|
FIRST_INIT | ā | false | Set to true for first-time setup. |
DOMAIN | ā | - | Your TON domain (e.g., namespace.ton). |
| Variable | Required | Default | Description |
|---|---|---|---|
PROXY_PASS | ā | - | Backend URL to proxy requests to (e.g., https://namespace.my/). |
EXTERNAL_IP | ā | - | Public IP of your server (for ADNL resolution). |
| Variable | Required | Default | Description |
|---|---|---|---|
LISTEN_IP | ā | 0.0.0.0 | IP to bind the listener to. |
PORT | ā | 8765 | Port to expose the proxy on. |
NETWORK_CONFIG_URL | ā | https://ton.org/global.config.json | TON network config endpoint. |
TX_URL | ā | false | Use transaction URL instead of QR code. |
mkdir -p ./tonutils-config
docker run -it --rm \
-v $(pwd)/tonutils-config:/app \
-e FIRST_INIT=true \
-e DOMAIN="mydomain.ton" \
tonnamespace/reverse-proxy:latest
mkdir -p ./tonutils-config
docker run -it --rm \
-v $(pwd)/tonutils-config:/app \
-e FIRST_INIT=true \
-e DOMAIN="mydomain.ton" \
-e TX_URL=true \
tonnamespace/reverse-proxy:latest
docker run -d \
--name my-ton-proxy \
-p 8765:8765 \
-v $(pwd)/tonutils-config:/app \
-e PROXY_PASS="https://mywebsite.com/" \
-e EXTERNAL_IP="1.2.3.4" \
-e PORT="8765" \
tonnamespace/reverse-proxy:latest
For easier management, use this docker-compose.yml:
version: '3.8'
services:
# First: Run initialization
tonutils-init:
image: tonnamespace/reverse-proxy:latest
container_name: tonutils-init
volumes:
- ./tonutils-config:/app
environment:
- FIRST_INIT=true
- DOMAIN=namespace.ton
- TX_URL=false # Set to true for transaction URL
profiles:
- init
stdin_open: true
tty: true
# Then: Run the proxy
tonutils-proxy:
image: tonnamespace/reverse-proxy:latest
container_name: tonutils-proxy
ports:
- "8765:8765"
volumes:
- ./tonutils-config:/app
environment:
- PROXY_PASS=https://namespace.my/
- EXTERNAL_IP=YOUR_HOST_EXTERNAL_IP
- LISTEN_IP=0.0.0.0
- PORT=8765
restart: unless-stopped
profiles:
- proxy
Commands:
docker-compose --profile init up tonutils-initdocker-compose --profile proxy up -d tonutils-proxyThe container handles config.json automatically:
Example config.json:
{
"proxy_pass": "https://namespace.my/",
"private_key": "e7Y4DtgPtJP1UqlI5jGWhrLOotTWa3EjQwNSfh3akCw=",
"external_ip": "YOUR_HOST_EXTERNAL_IP",
"listen_ip": "0.0.0.0",
"network_config_url": "https://ton.org/global.config.json",
"custom_tunnel_network_config_url": "",
"port": 8765,
"tunnel_config": {
"TunnelServerKey": "qT8TWTeZWdjMd/Qv7xRbfmYnO4xnJgZ4/UEWEU+tXgs=",
"TunnelThreads": 1,
"TunnelSectionsNum": 1,
"NodesPoolConfigPath": "",
"PaymentsEnabled": false,
"Payments": {
// ... payment configuration
}
},
"version": 1
}
FIRST_INIT=true to generate config and setup info.| Issue | Solution |
|---|---|
| "config.json not found" | Run init with FIRST_INIT=true and check volume mount. |
| QR Code Not Showing | Use -it flags; try TX_URL=true for URL fallback. |
| Domain Not Resolving | Confirm transaction success; verify TON DNS setup and external IP. |
| Container Exits During Init | Set DOMAIN correctly (e.g., mydomain.ton). |
| Proxy Not Working | Check env vars, backend accessibility, port exposure, and firewall rules. |
Pro Tip: Always tail logs for real-time debugging!
docker logs tonutils-initdocker logs tonutils-proxydocker logs -f tonutils-proxyconfig.json ā back it up!config.json to public repos.git clone https://github.com/TON-Namespace/docker-ton-reverse-proxy.git
cd docker-ton-reverse-proxy
docker build -t reverse-proxy .
Test with: docker run -it --rm -e FIRST_INIT=true -e DOMAIN="test.ton" reverse-proxy
We ā¤ļø contributions! Here's how:
git checkout -b feature/amazing-feature).git commit -m 'Add amazing feature').git push origin feature/amazing-feature).Please ensure tests pass and add docs for new features.
This project is licensed under the MIT Licenseā ā free to use, modify, and distribute.
Built with ā¤ļø for the TON community. Questions? Open an issue!
Content type
Image
Digest
sha256:1d0435430ā¦
Size
38.8 MB
Last updated
over 1 year ago
docker pull tonnamespace/reverse-proxy