Skip to content

Commit a5ff81b

Browse files
Make sure the orchestrator works out of the box
Co-authored-by: Davide <davideneri18@gmail.com>
1 parent b5d8b53 commit a5ff81b

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ require (
5050
github.com/gofrs/uuid/v5 v5.3.2 // indirect
5151
github.com/gogo/protobuf v1.3.2 // indirect
5252
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
53+
github.com/gosimple/slug v1.15.0 // indirect
54+
github.com/gosimple/unidecode v1.0.1 // indirect
5355
github.com/h2non/filetype v1.1.3 // indirect
5456
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5557
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
101101
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
102102
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
103103
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
104+
github.com/gosimple/slug v1.15.0 h1:wRZHsRrRcs6b0XnxMUBM6WK1U1Vg5B0R7VkIf1Xzobo=
105+
github.com/gosimple/slug v1.15.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ=
106+
github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o=
107+
github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc=
104108
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 h1:e9Rjr40Z98/clHv5Yg79Is0NtosR5LXRvdr7o/6NwbA=
105109
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1/go.mod h1:tIxuGz/9mpox++sgp9fJjHO0+q1X9/UOWd798aAm22M=
106110
github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg=

internal/orchestrator/provision.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/arduino/go-paths-helper"
1313
"github.com/docker/docker/api/types/container"
1414
dockerClient "github.com/docker/docker/client"
15+
"github.com/gosimple/slug"
1516
"go.bug.st/f"
1617
"gopkg.in/yaml.v3"
1718
)
@@ -112,6 +113,7 @@ func generateMainComposeFile(ctx context.Context, app parser.App, pythonImage st
112113
Ports []string `yaml:"ports"`
113114
User string `yaml:"user"`
114115
Entrypoint string `yaml:"entrypoint"`
116+
ExtraHosts []string `yaml:"extra_hosts,omitempty"`
115117
}
116118
type mainService struct {
117119
Main service `yaml:"main"`
@@ -134,7 +136,12 @@ func generateMainComposeFile(ctx context.Context, app parser.App, pythonImage st
134136

135137
// Merge compose
136138
mainAppCompose.Include = composeFiles.AsStrings()
137-
mainAppCompose.Name = app.Name
139+
140+
composeProjectName, err := app.FullPath.RelFrom(orchestratorConfig.AppsDir())
141+
if err != nil {
142+
return fmt.Errorf("failed to get compose project name: %w", err)
143+
}
144+
mainAppCompose.Name = slug.Make(composeProjectName.String())
138145
if err := writeMainCompose(); err != nil {
139146
return err
140147
}
@@ -162,6 +169,7 @@ func generateMainComposeFile(ctx context.Context, app parser.App, pythonImage st
162169
Entrypoint: "/run.sh",
163170
DependsOn: services,
164171
User: getCurrentUser(),
172+
ExtraHosts: []string{"msgpack-rpc-router:host-gateway"},
165173
},
166174
}
167175
return writeMainCompose()

0 commit comments

Comments
 (0)