Weird behaviour when generating
adamtrip opened this issue · comments
I have this config:
var builder = DistributedApplication.CreateBuilder(args);
var authDb = builder.AddPostgresContainer("auth-container")
.WithVolumeMount("../calgest/auth/psql", "/var/lib/postgresql/data")
.AddDatabase("authdb");
var authService = builder.AddProject<Projects.CalGest_AuthService>("auth-service")
.WithReference(authDb);
builder.AddNpmApp("calgest-frontend", "../calgestfrontend", "dev")
.WithServiceBinding(3000, scheme: "http", env: "PORT")
.WithReference(authService)
.AsDockerfileInManifest();
builder.AddProject<Projects.CalGest_AuthDbManager>("auth-db-manager")
.WithReference(authDb);
builder.Build().Run();
The output I'm getting is:
Automate deployment of a .NET Aspire AppHost to a Kubernetes Cluster
Successfully loaded existing aspirate bootstrap settings from '.'.
Generating Aspire Manifest for supplied App Host:
Executing: dotnet run --project "D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost\." -- --publisher manifest --output-path manifest.json
Building...
info: Aspire.Hosting.Publishing.ManifestPublisher[0]
Published manifest to: D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost\manifest.json
(?) Done: Created Aspire Manifest At Path: D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost\manifest.json
Applying values for all automatically generated secrets.
Successfully generated a value for auth-container's Input Value 'password'
You will now be prompted to enter values for any secrets that are not generated automatically.
(?) Done: Input values have all been assigned.
It does not generate any kustomize yaml files or aspirate-output folder as it should.
However, if I remove the lines bellow, it all works:
var authService = builder.AddProject<Projects.CalGest_AuthService>("auth-service")
.WithReference(authDb);
&
builder.AddProject<Projects.CalGest_AuthDbManager>("auth-db-manager")
.WithReference(authDb);
I've tried to play with it a bit to try and find out what is going on, but no luck
Found another thing, if I remove the .WithReference(authDb);
from both the lines, it works as should
What's the produced manifest.json file?
Could you attach that please
Current config:
using Microsoft.Extensions.Hosting;
var builder = DistributedApplication.CreateBuilder(args);
// Using a persistent volume mount requires a stable password for 'sa' rather than the default generated one.
var authDbPassword = builder.Configuration["authDbPassword"];
if (builder.Environment.IsDevelopment() && string.IsNullOrEmpty(authDbPassword))
{
throw new InvalidOperationException("""
A password for the local PSQL Server container is not configured.
Add one to the AppHost project's user secrets with the key 'authDbPassword', e.g. dotnet user-secrets set authDbPassword <password>
""");
}
var authDb = builder.AddPostgresContainer("authcontainer", password: authDbPassword)
.WithVolumeMount("../calgest-data/auth/psql", "/var/lib/postgresql/data")
.AddDatabase("authcontainerdb");
var authService = builder.AddProject<Projects.CalGest_AuthService>("authservice")
.WithReference(authDb);
builder.AddProject<Projects.CalGest_AuthDbManager>("authdbmanager");
builder.AddNpmApp("calgestfrontend", "../calgestfrontend", "dev")
.WithServiceBinding(3000, scheme: "http", env: "PORT")
.WithReference(authService)
.AsDockerfileInManifest();
builder.Build().Run();
Here
{
"resources": {
"authcontainer": {
"type": "container.v0",
"image": "postgres:latest",
"env": {
"POSTGRES_HOST_AUTH_METHOD": "scram-sha-256",
"POSTGRES_INITDB_ARGS": "--auth-host=scram-sha-256 --auth-local=scram-sha-256",
"POSTGRES_PASSWORD": "{authcontainer.inputs.password}"
},
"bindings": {
"tcp": {
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"containerPort": 5432
}
},
"connectionString": "Host={authcontainer.bindings.tcp.host};Port={authcontainer.bindings.tcp.port};Username=postgres;Password={authcontainer.inputs.password};",
"inputs": {
"password": {
"type": "string",
"secret": true,
"default": {
"generate": {
"minLength": 10
}
}
}
}
},
"authcontainerdb": {
"type": "postgres.database.v0",
"parent": "authcontainer"
},
"authservice": {
"type": "project.v0",
"path": "../CalGest.AuthService/CalGest.AuthService.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
"ConnectionStrings__authcontainerdb": "{authcontainerdb.connectionString}"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
}
}
},
"authdbmanager": {
"type": "project.v0",
"path": "../CalGest.AuthDbManager/CalGest.AuthDbManager.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
}
}
},
"calgestfrontend": {
"type": "dockerfile.v0",
"path": "../calgestfrontend/Dockerfile",
"context": "../calgestfrontend",
"env": {
"NODE_ENV": "development",
"services__authservice__0": "{authservice.bindings.http.url}",
"services__authservice__1": "{authservice.bindings.https.url}",
"PORT": "{calgestfrontend.bindings.http.port}"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http",
"containerPort": 3000
}
}
}
}
}
Thanks - interesting one to fully track down
I've reworked most of the binding handling in tonight's work, to make it more manageable going forward. Too much responsibility had began to creep into the BaseProcessor.
v0.1.22-preview
is currently releasing and should fix the issue
From my initial tests, it's working now. Thanks!!
Hi there again, having this issue again on v27. Not building the node app and not generating the aspire-output folder
PS D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost> aspirate generate
_ _ ___
/ \ ___ _ __ (_) _ __ ( _ )
/ _ \ / __| | '_ \ | | | '__| / _ \
/ ___ \ \__ \ | |_) | | | | | | (_) |
/_/ \_\ |___/ | .__/ |_| |_| \___/
|_|
Handle deployments of a .NET Aspire AppHost
Successfully loaded existing aspirate bootstrap settings from '.'.
Generating Aspire Manifest for supplied App Host:
Executing: dotnet run --project "D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost\." -- --publisher manifest
--output-path manifest.json
Building...
info: Aspire.Hosting.Publishing.ManifestPublisher[0]
Published manifest to: D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost\manifest.json
(?) Done: Created Aspire Manifest At Path: D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost\manifest.json
No Dapr components selected, skipping Dapr annotations.
Gathering container details for each project in selected components
(?) Done: Populated container details cache for project appointmentservice
(?) Done: Populated container details cache for project appointmentdbmanager
(?) Done: Populated container details cache for project authservice
(?) Done: Populated container details cache for project authdbmanager
Gathering Tasks Completed - Cache Populated.
Building all project resources, and pushing containers:
PS D:\Desenvolvimentos\CalGestAspire\CalGest\CalGest.AppHost>
manifest.json
{
"resources": {
"appointmentservice": {
"type": "project.v0",
"path": "../CalGest.AppointmentService/CalGest.AppointmentService.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
}
}
},
"appointmentdbmanager": {
"type": "project.v0",
"path": "../CalGest.AppointmentDbManager/CalGest.AppointmentDbManager.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
}
}
},
"authservice": {
"type": "project.v0",
"path": "../CalGest.AuthService/CalGest.AuthService.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
}
}
},
"authdbmanager": {
"type": "project.v0",
"path": "../CalGest.AuthDbManager/CalGest.AuthDbManager.csproj",
"env": {
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
},
"https": {
"scheme": "https",
"protocol": "tcp",
"transport": "http"
}
}
},
"calgestfrontend": {
"type": "dockerfile.v0",
"path": "../calgestfrontend/Dockerfile",
"context": "../calgestfrontend",
"env": {
"NODE_ENV": "development",
"services__authservice__0": "{authservice.bindings.http.url}",
"services__authservice__1": "{authservice.bindings.https.url}",
"services__appointmentservice__0": "{appointmentservice.bindings.http.url}",
"services__appointmentservice__1": "{appointmentservice.bindings.https.url}",
"PORT": "{calgestfrontend.bindings.http.port}"
},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http",
"containerPort": 3000
}
}
}
}
}
I changed the way that it checks if the docker daemon is running in 0.1.26-preview.
It uses which (on unix) and where (on windows) to try to locate docker
I guess thats failing in windows as it works fine for me on my mac with your manifest.
Will change the way it checks in windows back to what i had previously
The change was only done to fix linux issues anyway
0.1.28-preview is building and releasing now
Can you let me know if that sorts it please 😄
yup, working fine!
Awesome- Thanks Adam 😄