@@ -31,19 +31,21 @@ const (
3131
3232func 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
4244func 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}
0 commit comments