Closed Tcharl closed 6 years ago
If we were to generate a microservices architecture with the following and run ./mvn test
on the gateway and microservices, then Protractor on the Gateway, would that be sufficient?
develop
branch, and run with SPRING_PROFILES_ACTIVE=dev,oauth2,native,swagger ./mvnw
product
entity with name, price, and image properties.Example app: https://github.com/oktadeveloper/okta-jhipster-microservices-oauth-example Blog post about building it: https://developer.okta.com/blog/2018/03/01/develop-microservices-jhipster-oauth
@mraible with the new JDL v3 from @MathieuAA I wonder if the whole architecture could be totally generated from one single JDL... That would be really cool, and a good test case for JDL v3 too.
What's the syntax for generating the whole architecture with JDL? I can't find any documentation and JDL-Studio doesn't seem to support an application
keyword.
@mraible I just merged this a few minutes ago, not sure it really works as expected - the documentation is hidden here: https://github.com/jhipster/jhipster.github.io/pull/542/files
@mraible Hi Matt, I've haven't found the time to update the doc yet (and I think it has been rollbacked).
I'll give you examples, but please note that generating whole architecture is not really supported yet (there may be some bugs lurking).
Here are the files I used for covering the use case.
About the syntax, this is basically the same as what's in the .yo-rc.json
files (everything's available, if you find something that's not there, I'll add it!)
Here's my attempt at a JDL that has all the things I mentioned above:
application {
config {
baseName gateway,
applicationType gateway,
authenticationType oauth2,
testFrameworks protractor
}
entities Blog, Entry, Tag, Product
}
application {
config {
baseName blog,
applicationType microservice,
authenticationType oauth2,
prodDatabaseType postgresql
serverPort 8081
}
entities Blog, Entry, Tag
}
application {
config {
baseName store,
applicationType microservice,
authenticationType oauth2,
databaseType mongodb
serverPort 8082,
searchEngine elasticsearch
}
entities Product
}
entity Blog {
name String required minlength(3),
handle String required minlength(2)
}
entity Entry {
title String required,
content TextBlob required,
date Instant required
}
entity Tag {
name String required minlength(2)
}
relationship ManyToOne {
Blog{user(login)} to User,
Entry{blog(name)} to Blog
}
relationship ManyToMany {
Entry{tag(name)} to Tag{entry}
}
paginate Entry, Tag with infinite-scroll
entity Product {
title String required,
price BigDecimal required,
image ImageBlob required
}
If I save it in a file called blog+store.jh
and run jhipster import-jdl blog+store.jh
, I get the following error:
➜ apps jhipster import-jdl blog+store.jh
Using JHipster version installed globally
Executing jhipster:import-jdl blog+store.jh
Options:
The JDL is being parsed.
error: An error has occurred:
SyntaxError
error: Error message:
Expected ",", "/*", "applicationType", "authenticationType", "baseName", "buildTool", "cacheProvider", "clientFramework", "clientPackageManager", "databaseType", "devDatabaseType", "enableHibernateCache", "enableSwaggerCodegen", "enableTranslation", "jhiPrefix", "jhipsterVersion", "languages", "messageBroker", "nativeLanguage", "packageName", "prodDatabaseType", "searchEngine", "serverPort", "serviceDiscoveryType", "skipClient", "skipServer", "skipUserManagement", "testFrameworks", "uaaBaseName", "useSass", "websocket", "}", [A-Za-z], or [\n\t\r
] but "2" found.
error: Position:
At l.5.
SyntaxError: SyntaxError: Expected ",", "/*", "applicationType", "authenticationType", "baseName", "buildTool", "cacheProvider", "clientFramework", "clientPackageManager", "databaseType", "devDatabaseType", "enableHibernateCache", "enableSwaggerCodegen", "enableTranslation", "jhiPrefix", "jhipsterVersion", "languages", "messageBroker", "nativeLanguage", "packageName", "prodDatabaseType", "searchEngine", "serverPort", "serviceDiscoveryType", "skipClient", "skipServer", "skipUserManagement", "testFrameworks", "uaaBaseName", "useSass", "websocket", "}", [A-Za-z], or [\n\t\r
] but "2" found.
events.js:165
throw er; // Unhandled 'error' event
^
Error: ERROR! Error while parsing applications and entities from the JDL SyntaxError: SyntaxError: Expected ",", "/*", "applicationType", "authenticationType", "baseName", "buildTool", "cacheProvider", "clientFramework", "clientPackageManager", "databaseType", "devDatabaseType", "enableHibernateCache", "enableSwaggerCodegen", "enableTranslation", "jhiPrefix", "jhipsterVersion", "languages", "messageBroker", "nativeLanguage", "packageName", "prodDatabaseType", "searchEngine", "serverPort", "serviceDiscoveryType", "skipClient", "skipServer", "skipUserManagement", "testFrameworks", "uaaBaseName", "useSass", "websocket", "}", [A-Za-z], or [\n\t\r
] but "2" found.
at Environment.error (/Users/mraible/dev/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:157:40)
at module.exports.error (/Users/mraible/dev/generator-jhipster/generators/generator-base.js:1981:18)
at module.exports.parseJDL (/Users/mraible/dev/generator-jhipster/generators/import-jdl/index.js:150:26)
at Object.<anonymous> (/Users/mraible/dev/generator-jhipster/node_modules/yeoman-generator/lib/index.js:399:25)
at /Users/mraible/dev/generator-jhipster/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /Users/mraible/dev/generator-jhipster/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/Users/mraible/dev/generator-jhipster/node_modules/yeoman-generator/lib/index.js:400:11)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
Emitted 'error' event at:
at Immediate.setImmediate (/Users/mraible/dev/generator-jhipster/node_modules/yeoman-generator/lib/index.js:406:18)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
Any advice is appreciated!
Okay, I'm gonna fix this.
@mraible Also, testFrameworks
currently needs []
around, like in arrays. However, I'm gonna make this optional as I like not having them.
I tried creating apps using the following JDL this morning:
application {
config {
baseName gateway,
applicationType gateway,
authenticationType oauth2,
testFrameworks [protractor]
}
entities Blog, Entry, Tag, Product
}
application {
config {
baseName blog,
applicationType microservice,
authenticationType oauth2,
prodDatabaseType postgresql
serverPort 8081
}
entities Blog, Entry, Tag
}
application {
config {
baseName store,
applicationType microservice,
authenticationType oauth2,
databaseType mongodb
serverPort 8082,
searchEngine elasticsearch
}
entities Product
}
entity Blog {
name String required minlength(3),
handle String required minlength(2)
}
entity Entry {
title String required,
content TextBlob required,
date Instant required
}
entity Tag {
name String required minlength(2)
}
relationship ManyToOne {
Blog{user(login)} to User,
Entry{blog(name)} to Blog
}
relationship ManyToMany {
Entry{tag(name)} to Tag{entry}
}
paginate Entry, Tag with infinite-scroll
entity Product {
title String required,
price BigDecimal required,
image ImageBlob required
}
Unfortunately, it fails with the following error:
jhipster import-jdl blog+store.jh
Using JHipster version installed globally
Executing jhipster:import-jdl blog+store.jh
Options:
The JDL is being parsed.
Error: The name 'Entry' is a reserved keyword and can not be used as an entity table name for at least one of these applications: gateway, blog.
ERROR! ERROR! Error while parsing applications and entities from the JDL Error: The name 'Entry' is a reserved keyword and can not be used as an entity table name for at least one of these applications: gateway, blog.
Why is entry
a reserved word? It wasn't in v4 and having it as a reserved word will make it more difficult to create my blog example with v5.
I tried changing Entry
to Post
. Not I get an error about relationships with NoSQL.
$ jhipster import-jdl blog+store2.jh
Using JHipster version installed globally
Executing jhipster:import-jdl blog+store2.jh
Options:
The JDL is being parsed.
warn: An Entity name 'User' was used: 'User' is an entity created by default by JHipster. All relationships toward it will be kept but any attributes and relationships from it will be disregarded.
warn: An Entity name 'User' was used: 'User' is an entity created by default by JHipster. All relationships toward it will be kept but any attributes and relationships from it will be disregarded.
Error: NoSQL entities don't have relationships.
ERROR! ERROR! Error while parsing applications and entities from the JDL Error: NoSQL entities don't have relationships.
Error: ERROR! Error while parsing applications and entities from the JDL Error: NoSQL entities don't have relationships.
at Environment.error (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:157:40)
at module.exports.error (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/generators/generator-base.js:1981:18)
at module.exports.importJDL (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/generators/import-jdl/index.js:115:14)
at new ImporterGenerator (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/generators/import-jdl/index.js:80:38)
at new module.exports (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/generators/import-jdl/index.js:122:9)
at Environment.instantiate (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:403:12)
at Environment.create (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:381:17)
at Environment.run (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js:438:28)
at runYoCommand (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/cli/cli.js:63:13)
at Command.command.allowUnknownOption.description.action (/Users/mraible/.nvm/versions/node/v8.11.3/lib/node_modules/generator-jhipster/cli/cli.js:83:13)
This shouldn't happen because I only have a Product
entity for in my MongoDB app, and it has no relationships.
application {
config {
baseName gateway,
applicationType gateway,
authenticationType oauth2,
testFrameworks [protractor]
}
entities Blog, Entry, Tag, Product
}
application {
config {
baseName blog,
applicationType microservice,
authenticationType oauth2,
prodDatabaseType postgresql
serverPort 8081
}
entities Blog, Entry, Tag
}
application {
config {
baseName store,
applicationType microservice,
authenticationType oauth2,
databaseType mongodb
serverPort 8082,
searchEngine elasticsearch
}
entities Product
}
entity Blog {
name String required minlength(3),
handle String required minlength(2)
}
entity Entry {
title String required,
content TextBlob required,
date Instant required
}
entity Tag {
name String required minlength(2)
}
relationship ManyToOne {
Blog{user(login)} to User,
Entry{blog(name)} to Blog
}
relationship ManyToMany {
Entry{tag(name)} to Tag{entry}
}
paginate Entry, Tag with infinite-scroll
entity Product {
title String required,
price BigDecimal required,
image ImageBlob required
}
My Node version:
$ node --version
v8.11.3
Hey, guys. Sorry for offtop, but where did you find this syntax that let you to create applications with domain model via JDL? I cannot find this documentation on official site :( If I really can generate gateway+uaa+services from one jhl file - it's awesome 😮
update1: Oh, sorry again. I found this one https://github.com/jhipster/generator-jhipster/issues/7117
Ivan the docs are not published yet as we are still ironing out some edge cases and issues
On Sun, 8 Jul 2018, 11:20 am Ivan Muratov, notifications@github.com wrote:
Hey, guys. Sorry for offtop, but where did you find this syntax that let you to create applications with domain model via JDL? I cannot find this documentation on official site :( If I really can generate gateway+uaa+services from one jhl file - it's awesome 😮
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/7675#issuecomment-403274512, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDlFweZUuESCQkYfX8spXhC8XsM7O1Rks5uEc7rgaJpZM4UK7FG .
As this has been opened for 3 months I'm closing this: either those use case work, or nobody cares for them :-)
Anyway, if one of those fails, it should now be a specific ticket, as everything is released.
Overview of the feature request
I propose this issue to track OIDC/UAA communication use cases
Motivation for or Use Case
It's currently pretty hard to see what's possible (and sometimes how to do it) using these technologies, so I propose to tick what's possible, and may be contributing to the documentation on how to accomplish the case.
Related issues or PR
7666
Here's what a 'smart framework' shall be able to do (considering token refresh is handled transparently).
Calling another microservice from the GW frontend using the user credential transmitted (using Zuul)
[x] UAA
[x] OAUTH
Calling a microservice from the GW backend using the user credential transmitted (using Feign)
[x] UAA
[ ] OAUTH
Calling another microservice from a transitive service call using the user credential transmitted (using Feign)
[ ] UAA
[ ] OAUTH
Calling an oauth+oidc application (from the GW or a transitive service call) using the user credential transmitted (using RestTemplate)
[ ] UAA
[ ] OAUTH
Calling another microservice using a 'service specific' token (Feign), for example for batching
[ ] UAA
[ ] OAUTH
Calling another app using a 'service specific' token (RestTemplate)
[ ] UAA
[ ] OAUTH
Please close if you find it useless, or modify the result if I'm wrong.