Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App config from machine also copies restart configuration #3655

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions internal/appconfig/from_machine_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func fromAppAndOneMachine(ctx context.Context, appName string, m machine.Leasabl
statics []Static
mounts []Mount
topLevelChecks map[string]*ToplevelCheck
restart Restart
)
for k, v := range m.Machine().Config.Env {
if k == "PRIMARY_REGION" || k == "FLY_PRIMARY_REGION" {
Expand Down Expand Up @@ -129,6 +130,16 @@ fly.toml only supports one mount per machine at this time. These mounts will be
topLevelChecks[checkName] = topLevelCheckFromMachineCheck(ctx, machineCheck)
}
}

if m.Machine().Config.Restart != nil && m.Machine().Config.Restart.Policy != "" {
restart = Restart{
Policy: RestartPolicy(m.Machine().Config.Restart.Policy),
MaxRetries: m.Machine().Config.Restart.MaxRetries,
Processes: []string{
m.Machine().Config.ProcessGroup(),
},
}
}
cfg := NewConfig()
cfg.AppName = appName
cfg.PrimaryRegion = primaryRegion
Expand All @@ -141,6 +152,7 @@ fly.toml only supports one mount per machine at this time. These mounts will be
cfg.Processes = processGroups.processes
cfg.Checks = topLevelChecks
cfg.Services = processGroups.services
cfg.Restart = []Restart{restart}
return cfg, warningMsg
}

Expand Down
2 changes: 1 addition & 1 deletion internal/build/imgsrc/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func newRemoteDockerClient(ctx context.Context, apiClient flyutil.Client, appNam
if !connectOverWireguard && !wglessCompatible {
client := &http.Client{
Transport: &http.Transport{
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
DialContext: func(ctx context.Context, network, addr string) (conn net.Conn, err error) {
return tls.Dial("tcp", fmt.Sprintf("%s.fly.dev:443", app.Name), &tls.Config{})
},
},
Expand Down
Loading