generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

JHipster 8.4.0 Kubernetes Generator Issue

Open allmarketsystem opened this issue 1 year ago • 2 comments

Overview of the issue

Error Details: JHipster 8.4.0 Kubernetes Generator Failed while running jhipster:docker-compose#writeKeycloakFiles: ERROR! An error occured while running jhipster:docker-compose#writeKeycloakFiles ERROR! ERROR! C:\Users\AppData\Roaming\npm\node_modules\generator-jhipster\dist\generators\docker-compose\templates\realm-config\jhipster-realm.json.ejs:550 548| "alwaysDisplayInConsole": false, 549| "clientAuthenticatorType": "client-secret",

550| "secret": "<%= keycloakSecrets[0] %>", 551| "redirectUris": [ 552| "/realms/jhipster/account/*" 553| ],

keycloakSecrets is not defined ReferenceError: C:\Users\AppData\Roaming\npm\node_modules\generator-jhipster\dist\generators\docker-compose\templates\realm-config\jhipster-realm.json.ejs:550 548| "alwaysDisplayInConsole": false, 549| "clientAuthenticatorType": "client-secret",

550| "secret": "<%= keycloakSecrets[0] %>", 551| "redirectUris": [ 552| "/realms/jhipster/account/*" 553| ],

keycloakSecrets is not defined at DockerComposeGenerator.eval ("C:\Users<user>\AppData\Roaming\npm\node_modules\generator-jhipster\dist\generators\docker-compose\templates\realm-config\jhipster-realm.json.ejs":24:26) at jhipster-realm.json (C:\Users\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\ejs\lib\ejs.js:703:17) at exports.render (C:\Users\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\ejs\lib\ejs.js:425:37) at render (file:///C:/Users//AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/mem-fs-editor/dist/util.js:62:16) at MemFsEditor._processTpl (file:///C:/Users//AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/mem-fs-editor/dist/actions/copy-tpl.js:6:12) at process (file:///C:/Users//AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/mem-fs-editor/dist/actions/copy-tpl.js:19:47) at applyProcessingFunc (file:///C:/Users//AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/mem-fs-editor/dist/actions/copy.js:9:20) at MemFsEditor._copySingle (file:///C:/Users//AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/mem-fs-editor/dist/actions/copy.js:63:20) at file:///C:/Users//AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/mem-fs-editor/dist/actions/copy.js:52:14 at Array.forEach () { path: 'C:\Users<user>\AppData\Roaming\npm\node_modules\generator-jhipster\dist\generators\docker-compose\templates\realm-config\jhipster-realm.json.ejs' }

Motivation for or Use Case

Kubernetes and Docker Deployments are not generated

Reproduce the error
  1. Install jhipster 8.4.0
  2. Run jhipster jdl .jdl

where Kubernetes Deployment configuration in jdl:

deployment {
  deploymentType kubernetes
  appsFolders [service1, service12]
  monitoring prometheus
  serviceDiscoveryType consul
  kubernetesNamespace msns
  kubernetesServiceType LoadBalancer
}
Related issues
Suggest a Fix
JHipster Version(s)
JHipster configuration
Browsers and Operating System

Windows 10

  • [ v] Checking this box is mandatory (this is just to show you read everything)

allmarketsystem avatar May 02 '24 21:05 allmarketsystem

{ "generator-jhipster": { "baseName": "workspaces", "directoryPath": "./", "jhipsterVersion": "8.4.0" } }

allmarketsystem avatar May 02 '24 21:05 allmarketsystem

Can you please provide the full JDL you used so I can try and reproduce the problem?

mraible avatar May 07 '24 16:05 mraible

Closing because there's not enough information provided to reproduce the problem. Please reopen if you can provide the full JDL.

mraible avatar May 09 '24 14:05 mraible

Hello, While working on a jhipster8.5 (versions at the end of this post) demo app, I encountered this very error during the docker compose generation. To reproduce, generate the microservice app using the JDL I supply (modified from Medium) then, following the article instructions, execute:

mkdir docker-compose && cd docker-compose
jhipster docker-compose

The JDL:

application {
  config {
    baseName store,
    applicationType gateway,
    packageName com.jhipster.demo.store,
    serviceDiscoveryType consul,
    authenticationType oauth2,
    prodDatabaseType postgresql,
    cacheProvider hazelcast,
    buildTool maven,
    clientFramework react,
    testFrameworks [protractor]
  }
  entities *
}

application {
  config {
    baseName invoice,
    applicationType microservice,
    packageName com.jhipster.demo.invoice,
    serviceDiscoveryType eureka,
    authenticationType oauth2,
    prodDatabaseType postgresql,
    buildTool maven,
    serverPort 8081,
    skipUserManagement true
  }
  entities Invoice, Shipment
}

application {
  config {
    baseName notification,
    applicationType microservice,
    packageName com.jhipster.demo.notification,
    serviceDiscoveryType eureka,
    authenticationType oauth2,
    databaseType mongodb,
    prodDatabaseType mongodb,
    devDatabaseType mongodb,
    cacheProvider no,
    enableHibernateCache false,
    buildTool maven,
    serverPort 8082,
    skipUserManagement true
  }
  entities Notification
}
/* Entities for Store Gateway */

/** Product sold by the Online store */
entity Product {
    name String required
    description String
    price BigDecimal required min(0)
    size Size required
    image ImageBlob
}

enum Size {
    S, M, L, XL, XXL
}

entity ProductCategory {
    name String required
    description String
}

entity Customer {
    firstName String required
    lastName String required
    gender Gender required
    email String required pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/)
    phone String required
    addressLine1 String required
    addressLine2 String
    city String required
    country String required
}

enum Gender {
    MALE, FEMALE, OTHER
}

entity ProductOrder {
    placedDate Instant required
    status OrderStatus required
    code String required
    invoiceId Long
}

enum OrderStatus {
    COMPLETED, PENDING, CANCELLED
}

entity OrderItem {
    quantity Integer required min(0)
    totalPrice BigDecimal required min(0)
    status OrderItemStatus required
}

enum OrderItemStatus {
    AVAILABLE, OUT_OF_STOCK, BACK_ORDER
}

relationship OneToOne {
    Customer{user(login) required} to User with builtInEntity
}

relationship ManyToOne {
 OrderItem{product(name) required} to Product
}

relationship OneToMany {
   Customer{order} to ProductOrder{customer(email) required},
   ProductOrder{orderItem} to OrderItem{order(code) required} ,
   ProductCategory{product} to Product{productCategory(name)}
}

service Product, ProductCategory, Customer, ProductOrder, OrderItem with serviceClass
paginate Product, Customer, ProductOrder, OrderItem with pagination

/* Entities for Invoice microservice */

entity Invoice {
    code String required
    date Instant required
    details String
    status InvoiceStatus required
    paymentMethod PaymentMethod required
    paymentDate Instant required
    paymentAmount BigDecimal required
}

enum InvoiceStatus {
    PAID, ISSUED, CANCELLED
}

entity Shipment {
    trackingCode String
    date Instant required
    details String
}

enum PaymentMethod {
    CREDIT_CARD, CASH_ON_DELIVERY, PAYPAL
}

relationship OneToMany {
    Invoice{shipment} to Shipment{invoice(code) required}
}

service Invoice, Shipment with serviceClass
paginate Invoice, Shipment with pagination
microservice Invoice, Shipment with invoice

/* Entities for notification microservice */
entity Notification {
    date Instant required
    details String
    sentDate Instant required
    format NotificationType required
    userId Long required
    productId Long required
}

enum NotificationType {
    EMAIL, SMS, PARCEL
}

microservice Notification with notification

Context (on a arch-linux machine)

➜  node -v
v22.3.0
➜  jhipster --version
8.5.0
➜  java --version
openjdk 21 2023-09-19 LTS
OpenJDK Runtime Environment Temurin-21+35 (build 21+35-LTS)
OpenJDK 64-Bit Server VM Temurin-21+35 (build 21+35-LTS, mixed mode, sharing)

hmdebenque avatar Jun 20 '24 12:06 hmdebenque