@@ -230,6 +230,7 @@ func ComposeStart(ctx context.Context, client defangv1connect.FabricControllerCl
230
230
231
231
ports , err := convertPorts (svccfg .Ports )
232
232
if err != nil {
233
+ // TODO: move this validation up so we don't upload the build context if it's invalid
233
234
return nil , & ComposeError {err }
234
235
}
235
236
// Show a warning when we have ingress ports but no explicit healthcheck
@@ -243,7 +244,7 @@ func ComposeStart(ctx context.Context, client defangv1connect.FabricControllerCl
243
244
var deploy * pb.Deploy
244
245
if svccfg .Deploy != nil {
245
246
deploy = & pb.Deploy {}
246
- deploy .Replicas = 1 // default to one replica per service
247
+ deploy .Replicas = 1 // default to one replica per service; allow the user to override this to 0
247
248
if svccfg .Deploy .Replicas != nil {
248
249
deploy .Replicas = uint32 (* svccfg .Deploy .Replicas )
249
250
}
@@ -253,9 +254,9 @@ func ComposeStart(ctx context.Context, client defangv1connect.FabricControllerCl
253
254
reservations = svccfg .Deploy .Resources .Limits
254
255
}
255
256
if reservations != nil {
256
- // TODO: move this validation up so we don't upload the build context if it's invalid
257
257
cpus , err := strconv .ParseFloat (reservations .NanoCPUs , 32 )
258
258
if err != nil {
259
+ // TODO: move this validation up so we don't upload the build context if it's invalid
259
260
return nil , & ComposeError {fmt .Errorf ("invalid reservations cpus: %v" , err )}
260
261
}
261
262
var devices []* pb.Device
@@ -276,6 +277,10 @@ func ComposeStart(ctx context.Context, client defangv1connect.FabricControllerCl
276
277
}
277
278
}
278
279
280
+ if deploy == nil || deploy .Resources == nil || deploy .Resources .Reservations == nil || deploy .Resources .Reservations .Memory == 0 {
281
+ logrus .Warn ("missing memory reservation; specify deploy.resources.reservations.memory to avoid out-of-memory errors" )
282
+ }
283
+
279
284
// Upload the build context, if any; TODO: parallelize
280
285
var build * pb.Build
281
286
if svccfg .Build != nil {
0 commit comments