prom3theu5 / aspirational-manifests

Handle deployments of .NET Aspire AppHost Projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to apply manifests with postgres db

timheuer opened this issue · comments

🔥 Bug Description

aspir8 version: 0.1.40-preview+451be92b3b6328d5551e1e7eb07d4d207a22e523

When running apply it fails with:
error: accumulating resources: accumulation err='accumulating resources from 'pgdb':
'D:\source\repos\Aspirek8sPlay\Aspirek8sPlay.AppHost\aspirate-output\pgdb' must resolve to a file': recursed
accumulation of path 'D:\source\repos\Aspirek8sPlay\Aspirek8sPlay.AppHost\aspirate-output\pgdb': loading KV pairs: env
source files: [.pgdb.secrets]: evalsymlink failure on
'D:\source\repos\Aspirek8sPlay\Aspirek8sPlay.AppHost\aspirate-output\pgdb.pgdb.secrets' : CreateFile
D:\source\repos\Aspirek8sPlay\Aspirek8sPlay.AppHost\aspirate-output\pgdb.pgdb.secrets: The system cannot find the file
specified.
Failed to deploy manifests in 'D:\source\repos\Aspirek8sPlay\Aspirek8sPlay.AppHost\aspirate-output'

🔍 Steps to Reproduce the Bug

App host (starting from starter app):

var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedis("cache");
var postgres = builder.AddPostgresContainer("pgdb")
    .WithPgAdmin()
    .AddDatabase("customers");

var apiService = builder.AddProject<Projects.Aspirek8sPlay_ApiService>("apiservice");

builder.AddProject<Projects.Aspirek8sPlay_Web>("webfrontend")
    .WithReference(cache)
    .WithReference(apiService)
    .WithReference(postgres);

builder.Build().Run();

Manifest generated:

{
  "resources": {
    "cache": {
      "type": "redis.v0"
    },
    "pgdb": {
      "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": "{pgdb.inputs.password}"
      },
      "bindings": {
        "tcp": {
          "scheme": "tcp",
          "protocol": "tcp",
          "transport": "tcp",
          "containerPort": 5432
        }
      },
      "connectionString": "Host={pgdb.bindings.tcp.host};Port={pgdb.bindings.tcp.port};Username=postgres;Password={pgdb.inputs.password};",
      "inputs": {
        "password": {
          "type": "string",
          "secret": true,
          "default": {
            "generate": {
              "minLength": 10
            }
          }
        }
      }
    },
    "customers": {
      "type": "postgres.database.v0",
      "parent": "pgdb"
    },
    "apiservice": {
      "type": "project.v0",
      "path": "../Aspirek8sPlay.ApiService/Aspirek8sPlay.ApiService.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"
        }
      }
    },
    "webfrontend": {
      "type": "project.v0",
      "path": "../Aspirek8sPlay.Web/Aspirek8sPlay.Web.csproj",
      "env": {
        "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true",
        "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true",
        "ConnectionStrings__cache": "{cache.connectionString}",
        "ConnectionStrings__customers": "{customers.connectionString}",
        "services__apiservice__0": "{apiservice.bindings.http.url}",
        "services__apiservice__1": "{apiservice.bindings.https.url}"
      },
      "bindings": {
        "http": {
          "scheme": "http",
          "protocol": "tcp",
          "transport": "http"
        },
        "https": {
          "scheme": "https",
          "protocol": "tcp",
          "transport": "http"
        }
      }
    }
  }
}

I encountered a similar issue the same issue except when using sql server and sql server db resources. I think this the scope is this issue is with database resources in general.

Sorry for the late reply on this one
A lot of the types have changed, and due to me being away - I missed a release for Aspire preview 4.

This should be fixed by the changes for Aspire preview 5 in release 0.5.0-preview.