-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Full microservice stack generation using import-jdl #8335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@MathieuAA @agoncal would you like to test drive? create the jdl with multiple apps in a folder, for example Run |
|
@jhipster/developers more testing is welcome as well. Now we can create a full microservice stack under 5 minutes. this is gonna be awesome for some demo :) |
|
also all apps are created in parallel 😉 |
|
It's decided I'm using this in my demo in two weeks. |
|
@deepu105 by all means, it's a good test file but the entity exclusions might confuse users if they try to understand during a presentation (<- @PierreBesson, you may have to simplify it a bit so that anyone can read it quickly) |
|
@MathieuAA ofcourse this is only for tests, I'll be using a more realistic use case (my e-commerce app from the book) |
|
@MathieuAA btw is this valid as well? |
|
@deepu105 declare them outside of the application scope and just "import" them using
|
|
ok no probs, just checking |
generators/upgrade/index.js
Outdated
| assertJHipsterProject() { | ||
| const done = this.async(); | ||
| if (!this.getJhipsterAppConfig()) { | ||
| if (!this.getAllJhipsterConfig().baseName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest moving the call to this.getAllJhipsterConfig() to a separate variable as the method does some I/O and someone may be tempted to just reuse a similar call as this.getAllJhipsterConfig().baseName without assigning the result of this.getAllJhipsterConfig() to a variable (and making the I/O calls n times)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
|
Does JDL-Studio need to be updated to support this syntax? If I try to save my full apps.jh, it fails with the following error. |
mraible
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! However, I did notice that you have to specify serviceDiscoveryType eureka for the gateway. Should this be the default?
cli/import-jdl.js
Outdated
| generator, application, withEntities, inAppFolder | ||
| }) => { | ||
| const baseName = application[GENERATOR_NAME].baseName; | ||
| logger.info(`Generating application ${baseName} in a new parellel process`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parellel > parallel
cli/import-jdl.js
Outdated
| }; | ||
|
|
||
| const generateEntity = (baseName, inAppFolder, generator, entity) => { | ||
| logger.info(`Generating entities for application ${baseName} in a new parellel process`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parellel > parallel
|
I tried the following JDL and it fails to compile when I try to start the store app. Error is Product.java looks as follows package com.okta.developer.store.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;
/**
* A Product.
*/
@Document(collection = "product")
@org.springframework.data.elasticsearch.annotations.Document(indexName = "product")
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
@NotNull
@Field("title")
private String title;
@NotNull
@Field("price")
private BigDecimal price;
@Field("image")
private byte[] image;
@Field("image_content_type")
private String imageContentType;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public Product title(String title) {
this.title = title;
return this;
}
public void setTitle(String title) {
this.title = title;
}
public BigDecimal getPrice() {
return price;
}
public Product price(BigDecimal price) {
this.price = price;
return this;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public byte[] getImage() {
return image;
}
public Product image(byte[] image) {
this.image = image;
return this;
}
public void setImage(byte[] image) {
this.image = image;
}
public String getImageContentType() {
return imageContentType;
}
public Product imageContentType(String imageContentType) {
this.imageContentType = imageContentType;
return this;
}
public void setImageContentType(String imageContentType) {
this.imageContentType = imageContentType;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Product product = (Product) o;
if (product.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), product.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Product{" +
"id=" + getId() +
", title='" + getTitle() + "'" +
", price=" + getPrice() +
", image='" + getImage() + "'" +
", imageContentType='" + getImageContentType() + "'" +
"}";
}
}Am I doing something wrong? The .yo-rc.json for the store app looks as follows {
"generator-jhipster": {
"applicationType": "microservice",
"clientPackageManager": "npm",
"databaseType": "mongodb",
"devDatabaseType": "h2Disk",
"enableHibernateCache": true,
"enableSwaggerCodegen": false,
"enableTranslation": true,
"jhiPrefix": "jhi",
"languages": [
"en",
"fr"
],
"messageBroker": false,
"nativeLanguage": "en",
"packageName": "com.okta.developer.store",
"packageFolder": "com/okta/developer/store",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"serviceDiscoveryType": false,
"skipClient": true,
"skipServer": false,
"testFrameworks": [],
"useSass": false,
"websocket": false,
"baseName": "store",
"authenticationType": "oauth2",
"serverPort": "8082",
"jhipsterVersion": "5.3.1",
"buildTool": "maven",
"cacheProvider": "hazelcast",
"clientFramework": "angularX",
"skipUserManagement": true
},
"entities": [
"Product"
]
} |
|
I changed my store app to use the following JDL and now it compiles: Not only that, but all Protractor tests pass. This is a sweet feature! 🎉 |
|
One issue I found. I'm not sure if it relates to this feature or import-jdl in general. If I don't specify It seems like this should be read from the microservice apps (which have |
|
Thanks for the feedback guys. I'll see what are the issues that can be
handled in the subgen and the issues that needs to fixed in JHipster core.
@MatheueAA I'll create a new issue in JH core and list down the issues
found is that ok with you?
…On Sun, 16 Sep 2018, 3:34 am Matt Raible, ***@***.***> wrote:
One issue I found. I'm not sure if it relates to this feature or
import-jdl in generator. If I don't specify searchEngine elasticsearch on
my gateway, the UI is generated without a search field. It seems like this
should be reach from the microservice apps (which have this specified)
rather than requiring it on the gateway.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8335 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABDlF8iqcFtvw7MQFLJjAF4VRWr5Gc-uks5ubaqdgaJpZM4Wqft8>
.
|
|
Please do, I have time to fix them today
|
|
@pascalgrimaud might need your expertise here. I was thinking of setting up a Travis test with a full stack.
WDYT? |
|
@mraible JDL studio needs update to work with this. I'll see what can be done |
|
@deepu105 : yes it's doable and it will improve a lot our tests for microservices ! |
|
@mraible I have made the JDL studio to work with this, for now, the old studio here works (with autocompletion and syntax highlight) https://www.jhipster.tech/jdl-studio/ Its more of a hack for now, as @MathieuAA suggested it needs a full rewrite in order to properly utilize chevrotain and its autosuggestion, lint capabilities For the new studio in JHipster online probably will have to wait for a release by @jdubois |
|
@MathieuAA this PR is ready to merge, but i'll wait for your updates on JH core |
|
@deepu105 Okay! As usual it's awesome work. Concerning the changes, I'm refactoring the code (the JDL app part). I'll try to be done by today so that this can be merged. |
|
My first bounty claim https://opencollective.com/generator-jhipster/expenses/4982 |
|
@deepu105 lucky you, I still haven't claimed one :-( |
|
You should it feels good :)
Thanks & Regards,
Deepu
…On Wed, Sep 19, 2018 at 10:39 AM Julien Dubois ***@***.***> wrote:
@deepu105 <https://github.com/deepu105> lucky you, I still haven't
claimed one :-(
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8335 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABDlF3ueCOqcs4FEkbuEjAcY026ovUwBks5ucgK6gaJpZM4Wqft8>
.
|
|
This feature is awesome! Does it support generating a UAA server? Whenever I use an applicationType of Here is my JDL: |
|
@jsm174 you need to provide |
|
Maybe we should add something like Maven’s effective pom plug-in.
https://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html
You can use it to see your full pom.xml with your model hydrated with all the defaults. We could make it as simple as a —debug flag.
… On Sep 29, 2018, at 14:49, Deepu K Sasidharan ***@***.***> wrote:
@jsm174 you need to provide uaaBaseName property for uaa apps, please see https://www.jhipster.tech/jdl/#application_options
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thank you! I totally missed |
|
Creating a UAA based setup with a gateway that has no database and has access to entities in separate microservices will cause the generator to display several warnings. The setup does work, and seems valid: app.jdl: |
Fix #8185
TODO:
Rebuild client when only entities are created
Move tests to CLI
Add test for multi app genefation
Please make sure the below checklist is followed for Pull Requests.
Travis tests are green
Tests are added where necessary
Documentation is added/updated where necessary
Coding Rules & Commit Guidelines as per our CONTRIBUTING.md document are followed