Skip to content
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

The infamous DEV mode #589

Closed
FroMage opened this issue Jan 22, 2019 · 10 comments · Fixed by #5155
Closed

The infamous DEV mode #589

FroMage opened this issue Jan 22, 2019 · 10 comments · Fixed by #5155
Assignees
Labels
area/user-experience Will make us lose users kind/enhancement New feature or request
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Jan 22, 2019

We're still missing a Mode enum that has three values: PROD, DEV and TEST.

That mode should be obtainable (injectable) by extensions as well as user code. It can be set by configuration files. It should default to DEV, or possibly TEST when run from Shamrock test runners.

Certain behaviour defaults change depending on that mode:

  • Default landing page in DEV lists dev info, such as what you can do, and the list of registered URLs, possibly more deployment info. In prod it would probably be a 404.
  • Default exception page in DEV mode shows stack trace and perhaps even code snippets. In PROD it should just inform the user it had an error and give (and log) that error ID (generated unique ID that users can then pass on to support, who can grep for it in the logs which have the stack trace).

So far I've only used TEST mode to load test data fixtures specific to tests, to avoid botching my DEV DB, but perhaps there are other use-cases for it.

@dmlloyd
Copy link
Member

dmlloyd commented Jan 22, 2019

Something like this could be done in the main config:

%dev.shamrock.mode = DEV
%test.shamrock.mode = TEST
shamrock.mode = PROD

after the main config refactor; WDYT?

@stuartwdouglas
Copy link
Member

I don't think this should be config driven, we know if it is TEST mode because it was launched from the JUnit extension, and similarly we will know if it is dev mode if it is launched from shamrock:dev

@FroMage
Copy link
Member Author

FroMage commented Jan 23, 2019

Typically in Play it was config based, but I think it's fine to set the mode from an entry point, like unit tests or shamrock:dev.

You still need to make it config driven because you may have several profiles that use the DEV mode and several that set it to PROD.

@dmlloyd
Copy link
Member

dmlloyd commented Jan 23, 2019

Maybe the test runner could provide an overlay config source which contains the mode.

stuartwdouglas referenced this issue in stuartwdouglas/quarkus-old Feb 13, 2019
@stuartwdouglas
Copy link
Member

We now have a LaunchMode enum: https://github.com/jbossas/protean-shamrock/blob/068143cc436e138c6425c528d9a1471d704e7fd3/core/runtime/src/main/java/org/jboss/shamrock/runtime/LaunchMode.java#L3

This can be accessed in BuildStep methods and templates. What else is needed here? I guess some kind of config integration is the main thing that is still outstanding?

@dmlloyd
Copy link
Member

dmlloyd commented Feb 14, 2019

Yeah but we can worry about config integration after we get the static init config stuff sorted out.

@stuartwdouglas
Copy link
Member

@FroMage I think this is complete?

@FroMage
Copy link
Member Author

FroMage commented Jul 29, 2019

LaunchMode is all we need, but how do we access it from non-extensions? Like in a REST endpoint? Do we have a static method to get it? Can I inject it? Is it documented?

@cescoffier
Copy link
Member

Is it complete now?

@FroMage
Copy link
Member Author

FroMage commented Sep 26, 2019

Well, my questions remain unanswered. AFAICT the "writing an extension guide" only mentions it by accident at https://quarkus.io/guides/extension-authors-guide#conditional-step-inclusion and doesn't explain it. At a minimum we need to document it.

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Nov 4, 2019
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Nov 4, 2019
@gsmet gsmet added this to the 0.29.0 milestone Nov 4, 2019
mmusgrov pushed a commit to mmusgrov/quarkus that referenced this issue Dec 13, 2019
maxandersen pushed a commit to maxandersen/quarkus that referenced this issue Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Will make us lose users kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants