Skip to content

Commit e73b154

Browse files
committed
Initial commit
0 parents  commit e73b154

File tree

9 files changed

+112
-0
lines changed

9 files changed

+112
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.env
2+
.git

.env.template

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# Ton storage daemon
3+
TON_STORAGE_ADNL_PORT=3333
4+
TON_STORAGE_CONTROL_PORT=5555
5+
TON_STORAGE_VERBOSITY_LEVEL=3
6+
TON_STORAGE_GLOBAL_CONFIG=/usr/src/app/global_configs/mainnet.json
7+
TON_STORAGE_DATABASE_NAME=capy_cloud_ton_storage
8+
TON_PUBLIC_IP=37.215.56.80

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.env
2+
3+
global_configs/mainnet.json
4+
global_configs/testnet.json

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TON Storage daemon

docker-compose.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3.9"
2+
3+
services:
4+
storage-daemon:
5+
image: "meamone/ton-storage-daemon:latest"
6+
container_name: ton-storage-daemon.storage-daemon
7+
restart: "unless-stopped"
8+
build:
9+
context: .
10+
dockerfile: storage-daemon/Dockerfile
11+
environment:
12+
TON_STORAGE_ADNL_PORT: ${TON_STORAGE_ADNL_PORT:-3333}
13+
TON_STORAGE_CONTROL_PORT: ${TON_STORAGE_CONTROL_PORT:-5555}
14+
TON_STORAGE_VERBOSITY_LEVEL: ${TON_STORAGE_VERBOSITY_LEVEL:-3}
15+
TON_STORAGE_GLOBAL_CONFIG: ${TON_STORAGE_GLOBAL_CONFIG:?}
16+
TON_STORAGE_DATABASE_NAME: ${TON_STORAGE_DATABASE_NAME:-ton-storage}
17+
TON_PUBLIC_IP: ${TON_PUBLIC_IP:?}
18+
volumes:
19+
- ./global_configs:/usr/src/app/global_configs:ro
20+
- ton-storage-daemon.storage-daemon.data:/data:rw
21+
22+
volumes:
23+
ton-storage-daemon.storage-daemon.data: {}

global_configs/init.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ "$#" -ne 1 ]; then
5+
echo "Exact 1 argument required: config path or mainnet/testnet"
6+
exit 1
7+
fi
8+
9+
if [ "$1" == "testnet" ]; then
10+
wget -q -O global_configs/testnet.json https://ton.org/testnet-global.config.json
11+
echo "Downloading testnet global config file"
12+
elif [ "$1" == "mainnet" ]; then
13+
wget -q -O global_configs/mainnet.json https://ton.org/global.config.json
14+
echo "Downloading mainnet global config file"
15+
fi

storage-daemon/Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Builder
2+
FROM ubuntu:20.04 as builder
3+
RUN apt-get update && \
4+
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake clang-6.0 openssl libssl-dev zlib1g-dev gperf wget git ninja-build && \
5+
rm -rf /var/lib/apt/lists/*
6+
7+
ARG TON_REPO
8+
RUN git clone --recursive ${TON_REPO:-https://github.com/ton-blockchain/ton} /ton
9+
WORKDIR /ton
10+
ARG TON_BRANCH
11+
RUN git checkout ${TON_BRANCH:-master}
12+
13+
ENV CC clang-6.0
14+
ENV CXX clang++-6.0
15+
ENV CCACHE_DISABLE 1
16+
RUN mkdir build && \
17+
cd build && \
18+
cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. && \
19+
ninja storage-daemon storage-daemon-cli
20+
21+
# Main
22+
FROM ubuntu:20.04
23+
RUN apt-get update && \
24+
apt-get install -y openssl curl gnupg wget libatomic1 gcc g++ make git supervisor && \
25+
rm -rf /var/lib/apt/lists/*
26+
RUN mkdir -p /var/ton-work/db && mkdir -p /var/ton-work/db/static
27+
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
28+
RUN apt-get install nodejs && rm -rf /var/lib/apt/lists/*
29+
30+
COPY --from=builder /ton/build/storage/storage-daemon/storage-daemon-cli /usr/local/bin/
31+
COPY --from=builder /ton/build/storage/storage-daemon/storage-daemon /usr/local/bin/
32+
33+
WORKDIR /app
34+
35+
COPY storage-daemon/scripts /scripts
36+
COPY storage-daemon/supervisord.conf /etc/supervisor/supervisord.conf
37+
38+
CMD ["supervisord"]

storage-daemon/scripts/daemon.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
mkdir -p /data/${TON_STORAGE_DATABASE_NAME}
5+
6+
echo "Starting daemon"
7+
storage-daemon -v ${TON_STORAGE_VERBOSITY_LEVEL:-1} \
8+
-C ${TON_STORAGE_GLOBAL_CONFIG:?} \
9+
-I ${TON_PUBLIC_IP:?}:${TON_STORAGE_ADNL_PORT:-3333} \
10+
-p ${TON_STORAGE_CONTROL_PORT:-5555} \
11+
-D /data/${TON_STORAGE_DATABASE_NAME:-ton-storage}

storage-daemon/supervisord.conf

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[supervisord]
2+
nodaemon=true
3+
directory=/app
4+
5+
[program:storage-daemon]
6+
command=/scripts/daemon.sh
7+
stdout_logfile=/dev/fd/1
8+
stdout_logfile_maxbytes=0
9+
redirect_stderr=true
10+
startsecs=2

0 commit comments

Comments
 (0)