Skip to content

Commit 3d7d3d2

Browse files
committed
chore: clean up
1 parent 5b2c9eb commit 3d7d3d2

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

framework/components/blockchain/ton.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,21 @@ const (
3131

3232
func defaultTon(in *Input) {
3333
if in.Image == "" {
34-
in.Image = "neodix42/mylocalton-docker:latest"
35-
}
36-
if in.Port != "" {
37-
framework.L.Warn().Msgf("'port' field is set but only default port can be used: %s", DefaultTonHTTPAPIPort)
34+
// Note: mylocalton is a compose file, not a single image. Reusing common image field
35+
in.Image = "https://raw.githubusercontent.com/neodix42/mylocalton-docker/main/docker-compose.yaml"
36+
// Note: mylocalton-docker's essential services, excluded explorer, restarter, faucet app,
37+
in.CoreServices = []string{
38+
"genesis", "tonhttpapi", "event-cache",
39+
"index-postgres", "index-worker", "index-api",
40+
}
3841
}
39-
in.Port = DefaultTonHTTPAPIPort
4042
}
4143

4244
func newTon(in *Input) (*Output, error) {
4345
defaultTon(in)
4446
containerName := framework.DefaultTCName("blockchain-node")
4547

46-
resp, err := http.Get("https://raw.githubusercontent.com/neodix42/mylocalton-docker/main/docker-compose.yaml")
48+
resp, err := http.Get(in.Image)
4749
if err != nil {
4850
return nil, fmt.Errorf("failed to download docker-compose file: %v", err)
4951
}
@@ -84,21 +86,18 @@ func newTon(in *Input) (*Output, error) {
8486
}
8587

8688
var upOpts []compose.StackUpOption
87-
88-
// always wait for healthy
8989
upOpts = append(upOpts, compose.Wait(true))
90-
services := in.CoreServices
90+
services := []string{}
91+
// Note: in local env having all services could be useful(explorer, faucet), in CI we need only core services
9192
if os.Getenv("CI") == "true" && len(services) == 0 {
92-
services = []string{
93-
"genesis", "tonhttpapi", "event-cache",
94-
"index-postgres", "index-worker", "index-api",
95-
}
93+
services = in.CoreServices
9694
}
9795

9896
if len(services) > 0 {
9997
upOpts = append(upOpts, compose.RunServices(services...))
10098
}
10199

100+
// always wait for healthy
102101
const genesisBlockID = "E7XwFSQzNkcRepUC23J2nRpASXpnsEKmyyHYV4u/FZY="
103102
execStrat := wait.ForExec([]string{
104103
"/usr/local/bin/lite-client",
@@ -120,7 +119,6 @@ func newTon(in *Input) (*Output, error) {
120119
cfgCtr, _ := stack.ServiceContainer(ctx, "genesis")
121120
cfgHost, _ := cfgCtr.Host(ctx)
122121
cfgPort, _ := cfgCtr.MappedPort(ctx, nat.Port("8000/tcp"))
123-
globalCfgURL := fmt.Sprintf("http://%s:%s/localhost.global.config.json", cfgHost, cfgPort.Port())
124122

125123
// discover lite‐server addr
126124
liteCtr, _ := stack.ServiceContainer(ctx, "genesis")
@@ -133,12 +131,13 @@ func newTon(in *Input) (*Output, error) {
133131
Type: in.Type,
134132
Family: FamilyTon,
135133
ContainerName: containerName,
134+
// Note: in case we need 1+ validators, we need to modify the compose file
136135
Nodes: []*Node{{
137-
// todo: do we need more access?
136+
// todo: define if we need more access other than lite client(tonutils-go only needs lite client)
138137
ExternalHTTPUrl: fmt.Sprintf("%s:%s", liteHost, litePort.Port()),
139138
}},
140139
NetworkSpecificData: &NetworkSpecificData{
141-
TonGlobalConfigURL: globalCfgURL,
140+
TonGlobalConfigURL: fmt.Sprintf("http://%s:%s/localhost.global.config.json", cfgHost, cfgPort.Port()),
142141
},
143142
}, nil
144143
}

framework/examples/myproject/smoke_ton.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[blockchain_a]
22
type = "ton"
3+
image = "https://raw.githubusercontent.com/neodix42/mylocalton-docker/main/docker-compose.yaml"
34
core_services = [
45
"genesis",
56
"tonhttpapi",

0 commit comments

Comments
 (0)