Open Closed

How to add gateway and apps to microservice #4477


User avatar
0
andmattia created
  • ABP Framework version: v5.3.1
  • UI type: Angular

Hi

we have create a solution based on microservice template, we follow the guide to create a new microservice and add it to the solution.

Which is the best way to add a new gateway and new UI app (angular)?

We copy and paste the folders but need a lot of reworks


10 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We have a document for this: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice

    Please let me know if I understand wrong your question.

  • User Avatar
    0
    andmattia created

    Hi

    I follow the document and I've create a new solution based on microservice.

    I add a new service to my new microservice solution and it works fine, so now I want to add a new application so to do that I think:

    1. add new service (ok)
    2. add new gateway, I copy the web gateway in the solution and adjust octleton.json
    3. add new UI app, a new Angular app. I copy a angular app came from new app template

    Point 2 and 3 I'm not sure if it's the best way to do.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will discuss with ABP team and back to you.

  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Hello,

    There is no automated way to add gateways and applications for microservice template for now.

    I would suggest understanding the architecture for microservice applications in details since they are not the same with the new app template. The back-office and public-web applications are used in different purposes. You need to decide in what context you want to use the application for. To add a new application, you need to create the application manually. Based on your use case, dependencies will be different. Afterwards, you need to register it to the auth-server using OpenIddict Management UI or the OpenIddictDataSeeder located under IdentityService or the DbMigrator (which ever you prefer to use).

    If you are following backend for frontend gateway approach as in the microservice template; you will need to create it manually as well. You can configure it to use the same WebGateway_Swagger client for authorization by checking the other gateway configurations.

  • User Avatar
    0
    andmattia created

    Hi @gterdem my goal is add a new app (es. a PWA to B2B on eshop example). This new app ass 2 microservice

    • Delivery service
    • Logistic service

    We need to create a new dedicated gateway with Catalog, Ordering, Logistics and Delivery Service an a dadicated app. So my approch is duplicate the gateway project and adjust Seed/CORS/config to allow conncetion but for a quick start to web pwa app I create a normal APP with cli command line and copy&paste angular folder.

    The question is it's the best/only path that I've to do that?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi @gterdem my goal is add a new app (es. a PWA to B2B on eshop example). This new app ass 2 microservice

    • Delivery service
    • Logistic service

    We need to create a new dedicated gateway with Catalog, Ordering, Logistics and Delivery Service an a dadicated app.
    So my approch is duplicate the gateway project and adjust Seed/CORS/config to allow conncetion but for a quick start to web pwa app I create a normal APP with cli command line and copy&paste angular folder.

    The question is it's the best/only path that I've to do that?

    If you need to create a gateway, yes duplicating the public gateway and customizing it to your needs is a good start. ABP Framework doesn't provide you with any API to create a custom gateway. So, creating a new gateway is your responsibility and you can check Ocelot's documentation for that purpose.

    For the second question, as @gterdem mentioned, you need to create the UI application by yourself. If you want you can create it via Application Startup Template and remove the unnecessary projects/packages, and make the related configurations such as updating the Environment.ts file. At that point, ABP Framework can't do anything because this is a custom requirement and you need to make the related configurations by yourself.

    Best regards.

  • User Avatar
    0
    andmattia created

    Hi

    I've create a new app via suite and use only the angular folder with my microservice solution. So now I'm a little confuse how can I change my tenant.

    I try to explain the scenario:

    1. App create via suite (no microservice)
      1. Create 2 tenant
      2. Open the UI
      3. go to Saas anche switch to tenant
    2. App with microservice
      1. Admin app has tenant adminstration
      2. Second app (create via suite) use microservice and gateway. All function it works fine.
      3. Need to change tenant.
        1. If I add sass UI angular module to this app, configure the route to access to SaasMicroservice
        2. I don't add SAAS module to change tenant (concretly I remove SAAS angular UI module from second app). I can I change tenant? Only via admin app and open the Url of second app. The tenant propagation work via cookies?

    Another confusion is releted to default product Microservice that are autogenerated on solution. Why, in angular app, the microservice is "connected" directly to productMicroservice and not to the gateway?

    ,
        ProductService: {
          url: 'https://localhost:44325',
          rootNamespace: 'MyMicroMicroservice',
        },
    
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    For your second application, you can check the public-web application that whichever references you need. For resolving the tenant, you need to have the UseMultiTenancy midware and the related dependency with connection string to Saas Service.

    Another confusion is releted to default product Microservice that are autogenerated on solution. Why, in angular app, the microservice is "connected" directly to productMicroservice and not to the gateway?

    It is redirecting to webgateway, localhost:44325 is the web gateway address.

  • User Avatar
    0
    andmattia created

    Hi @gterdem

    Thanks for the clarification about gateway I made an error reading ports (gateway & productServices), so related to this why you specify prodcut service if it's still on the same address?

    In this case I can remove it or is it better to specify?

    export const environment = {
      production: false,
      application: {
        baseUrl,
        name: 'prj',
      },
      oAuthConfig,
      apis: {
        default: {
          url: 'https://localhost:44325',
          rootNamespace: 'prj',
        },
        AbpAccountPublic: {
          url: oAuthConfig.issuer,
          rootNamespace: 'AbpAccountPublic',
        },
        ProductService: {
          url: 'https://localhost:44325',
          rootNamespace: 'prj.ProductService',
        },
    
  • User Avatar
    0
    muhammedaltug created

    Hello,

    The rootNamespace property of api configuration used by ABP proxy generation. You can remove the url property.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15