Giter Club home page Giter Club logo

Comments (2)

hades200082 avatar hades200082 commented on June 15, 2024 2

I was just replying to close this issue when your reply popped in.

I was using .Net Aspire to replicate the docker compose so I could spin this up in my development stack. I had the two port bindings the wrong way around (I thought 3001 was admin console for some reason). It was odd that both ports were returning the admin console at that point.

The docker compose docs could be a little clearer around this, and around the ENDPOINT/ADMIN_ENDPOINT usage more generally (i.e. if you're running it in Coolify or with a proxy in front, etc.).

Anyway, I now have it working in Aspire using the following (in case anyone else finds this post and is trying the same)

IResourceBuilder<IResourceWithConnectionString> db;
var dbPassword = builder.AddParameter("DatabasePassword", true);

var postgres = builder.AddPostgres("Database", password: dbPassword)
    .WithDataVolume("AppHost-PostgreSQL-data")
    .WithHealthCheck()
    .WithPgAdmin();

var logtopg = postgres.AddDatabase("logtodb").ExcludeFromManifest();
var pgEndpoint = logtopg.Resource.Parent.PrimaryEndpoint;
var logto = builder.AddContainer("Logto", "svhd/logto", "latest")
    .WithEntrypoint("sh")
    .WithArgs("-c", "npm run cli db seed -- --swe && npm start")
    .WithEnvironment("TRUST_PROXY_HEADER", "1")
    .WithEnvironment(async context => {
        var connectionStringExpression = ReferenceExpression.Create($"postgres://postgres:{logtopg.Resource.Parent.PasswordParameter}@{pgEndpoint.Property(EndpointProperty.Host)}:{pgEndpoint.Property(EndpointProperty.Port)}/logtodb");
        var cs = await connectionStringExpression.GetValueAsync(context.CancellationToken);
        context.EnvironmentVariables["DB_URL"] = new HostUrl(cs);
    })
    .WithEndpoint(port: 3001, targetPort: 3001, scheme: "http", name: "auth")
    .WithEndpoint(port: 3002, targetPort: 3002, scheme: "http", name: "https")
    .WithEnvironment("ENDPOINT", "")
    .WithEnvironment("ADMIN_ENDPOINT", "")
    .ExcludeFromManifest()
    .WithReference(logtopg)
    .WaitOn(logtopg);

I'm using David Fowlers WaitForDependenciesAspire repo as an example for the .WithHealthCheck() and .WaitOn(logtopg) elements.

from logto.

xiaoyijun avatar xiaoyijun commented on June 15, 2024

Hi @hades200082 , could you please provide more information about how you start your Logto instance? Since the admin console is running at localhost:3002 by default, but what I see from your snapshots is localhost:3001.

from logto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.