-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat(hotreload): create configuration for hot-reload dev server #745
Conversation
4f84100
to
858ea1e
Compare
Done tinkering with this now. The report generation classpath issue will require some additional thought and experimentation, but for now this achieves the initial goal I had intended already for other features. |
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.
If I open a new window in VSCode with the cryostat/
folder while the run-local
backend and frontend are running, VSCode will clean and build the project automatically, causing the backend to throw an exception and hang. How can I prevent this from happening?
VSCode output:
1df5dfef Importing Maven project(s) [Done]
5afe19df Repository registry initialization [Done]
21c40e1e Clean workspace... [Done]
71187c59 Building [Done]
83961158 Validate documents [Done]
c66ede8d Building [Done]
7f744c7e Publish Diagnostics [Done]
70889b8a Building [Done]
7ffcc57e Building [Done]
Backend output:
INFO: Removing cached connection for service:jmx:rmi:///jndi/rmi://localhost.localdomain:9091/jmxrmi
Nov. 03, 2021 3:44:50 P.M. io.vertx.core.impl.launcher.commands.Watcher
INFO: Redeploying!
Stopping vert.x application 'bd2dd646-8ec9-496b-a5ed-c862a767af48-redeploy'
Application 'bd2dd646-8ec9-496b-a5ed-c862a767af48-redeploy' terminated with status 0
Starting vert.x application...
bd2dd646-8ec9-496b-a5ed-c862a767af48-redeploy
Nov. 03, 2021 3:44:50 P.M. io.vertx.core.impl.launcher.commands.Watcher
INFO: Redeployment done in 137 ms.
Error: Could not find or load main class io.cryostat.Cryostat
Caused by: java.lang.ClassNotFoundException: io.cryostat.Cryostat
Ah, I see. That makes sense but it's unfortunate. I don't know what you could do to prevent that, other than just configure VSCode not to do a clean when it starts, but I don't know how to do that. You might be able to do something like add a "Run Configuration" which most IDEs have, and either configure it to do the same thing as |
Thanks, I found a way to start the devserver by creating the file
Update: you can also change the |
Neat. Although, the devserver will try to bind on the same ports as |
Hmm. That My hunch with the
No, you can still do step 2 and run a separate frontend devserver. The minimal build just prevents Maven from building the web-client submodule to generate its assets, but the backend devserver doesn't know where those are located anyway (this is very closely related to the classpath problem I explained above) so even if you do build those assets, the backend devserver wouldn't serve them to you when you visit http://localhost:8080 . Now that it does a minimal build it skips over building those non-served assets so the backend devserver startup time is faster. If you want to have a web-client UI to use with the backend devserver then, at least for now, you will need to do step 2 and launch a separate frontend devserver as well, building and serving the frontend assets on its own. |
Doesn't seem to me like SELinux is behind the permissions issue. @hareetd , what does I'll push a commit in a few minutes that sets all of those up to use temporary directories instead of ones within the repo, too. That might be a good idea in general. |
Looks like It seems the |
I have something similar on my computer, and I don't have any other user account on here. I think that other UID is probably coming from when we run the run.sh/smoketest.sh setup with Podman. When the Cryostat process is running inside there it creates the contents of You could try The last commit I pushed that sets the directories to new ones within Try that out and let me know if you still run into the missing types issue as well - that one I'm really confused about. |
Okay, so the missing types are no longer an issue (I'm thinking they were caused by |
Yea, that NPE is normal/expected right now. The git version info is stored in the file |
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.
The new changes work as expected for me
Fixes #744
To test:
sh run-local.sh
. If you usemvnd
or something else like I do and have this aliased asmvn
in yourPATH
, then you may wish to doMVN=/usr/bin/mvn sh run-local.sh
instead.cd web-client && yarn yarn:frzinstall && yarn start:dev
This should start a hot-reloading Cryostat backend as a local JVM process in the first terminal, and the typical existing hot-reloading Cryostat web-client in the second terminal. There will be no sample app targets and there will be no Grafana dashboard, but the Cryostat JVM should discover itself via JDP and you should be able to query it for its active recordings, event types, and event templates, as well as start and archive recordings.
Report generation doesn't currently work with this setup, so I'm looking into that.
It seems like it's probably a hostname resolution issue.Turns out the report generation issue is actually a classpath problem - the main process isn't able to load the subprocess class to invoke:
This has two parts. First, the new
vertx-maven-plugin
configuration added doesn't have any easy way that I can see to simply set/append to the classpath when usingvertx:run
. It may be cleared up by usingvertx:start
(https://reactiverse.io/vertx-maven-plugin/#vertx:start) instead. Second, the way we invoke the subprocess uses a hardcoded classpath (https://github.com/cryostatio/cryostat/blob/460e2fd78646965cc0759b6431526e5b2c1cac73/src/main/java/io/cryostat/util/JavaProcess.java#L60), which is very unlikely to actually match the filesystem on a development host machine. We would need to make this configurable by an env var or system property so that it can be set to point to the maven buildtarget
directory contents.