Skip to content

Commit

Permalink
- In order for tools to better describe multiple endpoints int the ma…
Browse files Browse the repository at this point in the history
…nifest, we must include port information. At runtime most of the port information is dynamically generated and thus not described (for anything but containers), that doesn't work well when trying to deploy to various environments. We allocate ports in situations where there are none to match the runtime behavior. (#3274)

- Change also renames ContainerPort to TargetPort everywhere.
- Added `WithExternalHttpEndpoints` to mark all http and https endpoints as external.
  • Loading branch information
davidfowl authored Mar 29, 2024
1 parent 1171971 commit 25687b6
Show file tree
Hide file tree
Showing 76 changed files with 727 additions and 294 deletions.
1 change: 1 addition & 0 deletions playground/AWS/AWS.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// .WithReference(awsConfig);

builder.AddProject<Projects.Frontend>("Frontend")
.WithExternalHttpEndpoints()
// Demonstrating binding all of the output variables to a section in IConfiguration. By default they are bound to the AWS::Resources prefix.
// The prefix is configurable by the optional configSection parameter.
.WithReference(awsResources)
Expand Down
6 changes: 4 additions & 2 deletions playground/AWS/AWS.AppHost/aspire-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
}
Expand Down
1 change: 1 addition & 0 deletions playground/AspireEventHub/EventHubs.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.WithReference(blob);

builder.AddProject<Projects.EventHubsApi>("api")
.WithExternalHttpEndpoints()
.WithReference(eventHub);

builder.Build().Run();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
var azureSearch = builder.AddAzureSearch("search");

builder.AddProject<Projects.AzureSearch_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(azureSearch);

// This project is only added in playground projects to support development/debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
var blobs = storage.AddBlobs("blobs");

builder.AddProject<Projects.AzureStorageEndToEnd_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(blobs);

// This project is only added in playground projects to support development/debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.RunAsEmulator();

builder.AddProject<Projects.CosmosEndToEnd_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(db);

// This project is only added in playground projects to support development/debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
var db1 = builder.AddSqlServer("sql1").AddDatabase("db1");

builder.AddProject<Projects.DatabaseMigration_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(db1);

builder.AddProject<Projects.DatabaseMigration_MigrationService>("migration")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 1433
"targetPort": 1433
}
}
},
Expand All @@ -34,12 +34,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
);

builder.AddProject<Projects.OpenAIEndToEnd_WebStory>("webstory")
.WithExternalHttpEndpoints()
.WithReference(openai)
.WithEnvironment("OpenAI__DeploymentName", deploymentAndModelName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
var insertionrows = builder.AddParameter("insertionrows");

builder.AddProject<Projects.ParameterEndToEnd_ApiService>("api")
.WithExternalHttpEndpoints()
.WithEnvironment("InsertionRows", insertionrows)
.WithReference(db);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
var db10 = builder.AddPostgres("pg10").WithPgAdmin().PublishAsConnectionString().AddDatabase("db10");

builder.AddProject<Projects.PostgresEndToEnd_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(db1)
.WithReference(db2)
.WithReference(db3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
"targetPort": 5432
}
}
},
Expand All @@ -38,7 +38,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
"targetPort": 5432
}
}
},
Expand All @@ -61,7 +61,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
"targetPort": 5432
}
}
},
Expand All @@ -88,7 +88,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
"targetPort": 5432
}
}
},
Expand All @@ -111,7 +111,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
"targetPort": 5432
}
}
},
Expand All @@ -134,7 +134,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
"targetPort": 5432
}
}
},
Expand Down Expand Up @@ -187,12 +187,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
.WithReference(redis);

builder.AddProject<Projects.ProxylessEndToEnd_ApiService>("api2", launchProfileName: null)
.WithEndpoint(13456, "http")
.WithHttpEndpoint(port: 13456)
.WithReference(redis);

// This project is only added in playground projects to support development/debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 6379
"targetPort": 6379
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
var db2 = builder.AddSqlServer("sql2").PublishAsContainer().AddDatabase("db2");

builder.AddProject<Projects.SqlServerEndToEnd_ApiService>("api")
.WithExternalHttpEndpoints()
.WithReference(db1)
.WithReference(db2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 1433
"targetPort": 1433
}
}
},
Expand All @@ -48,12 +48,14 @@
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
"transport": "http",
"external": true
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion playground/Stress/Stress.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
for (var i = 0; i < 30; i++)
{
var port = 5180 + i;
serviceBuilder.WithHttpEndpoint(port, $"http-{port}");
serviceBuilder.WithHttpEndpoint(port, name: $"http-{port}");
}

builder.AddProject<Projects.Stress_TelemetryService>("stress-telemetryservice");
Expand Down
1 change: 1 addition & 0 deletions playground/TestShop/AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.WithReference(messaging);

builder.AddProject<Projects.MyFrontend>("frontend")
.WithExternalHttpEndpoints()
.WithReference(basketService)
.WithReference(catalogService);

Expand Down
Loading

0 comments on commit 25687b6

Please sign in to comment.