It seems like docker:watch is not an option for now - it complains it doesn't know a thing about assemblies added to the image and bails out. Looks like a bug due to our very special config with compose
bummer
Haha easy, it's simply not possible. Either go for all or die. Maybe with compose
Ha works with compose! Tricky tricky tricky
OK I pushed some notes about that as well
https://dataverse-guide--9584.org.readthedocs.build/en/9584/container/dev-usage.html#re-deploying
Looks good. You've documented what I'm doing, a full clean and build each time. Thanks.
It's the hard way :smiley:
Hopefully we can have something else some other time
The only way, currently. Oh well. At least I'm not missing out on anything. :sweat_smile: #fomo
Let me try something with mounting as a volume
Ok that seems to have no effect - the files don't get picked up. Looks like this is not working in their layout...
But I do see a hot redeploy thing using their plugins for IDEs... Maybe that's a thing? Let's give it a shot!
Ha that works astonishingly well!
Just one problem: I need to ship a WAR file. We build that as "dataverse-5.13.war". That conflicts with our deployment name (dataverse)
If I rename the war, all goes well
And it actually is pretty fast
Takes about 10 seconds on my machine to redeploy
I'm going to open a new topic for this and move messages...
I followed this guide (as I am on IntelliJ) https://blog.payara.fish/payara-server-basics-adding-payara-server-to-intellij-idea
But I see plenty of other plugins for Eclipse, Netbeans, VSCode in the docs: https://docs.payara.fish/community/docs/Technical%20Documentation/Ecosystem/IDE%20Integration/IntelliJ%20Plugin/Payara%20Server.html#deploying-application-payara-server-from-intellij
Do you think it'll work with the free (community edition) version of Intellij?
No it won't. Explicitly says Ultimate only
But there's Eclipse, Netbeans, Vscode so plenty of free options
I took a quick look at the docs. @Oliver Bertuch maybe you can give me a demo of your 10 second redeploy sometime. We could even show it during tomorrow's container meeting if you like.
I'm free to do whatever I want now - just tucked in the kids
Nice. I added it to the agenda. Hope you don't mind: https://docs.google.com/document/d/1eQVm88dP2rgM9DKn4ivoWBx6MOK6aXfkLhsZN-Y3fsc/edit?usp=sharing
Meaning you don't want a demo now?
I'd have to find a room. Plus if we do it tomorrow, it'll be recorded. Let me know. I can find a room if you want to demo it now.
LOL - I tried with VSCode. That did not work _at all_. Great. "Cannot read properties of undefined (reading '0')" :rolling_eyes: And the only thing kind of similar I could find was this https://github.com/payara/ecosystem-support/issues/33
OK 10 seconds was a very subjective impression. It's ~30 seconds (excluding compile/package time):
[2023-05-11 12:13:11,007] Artifact dataverse:war: Artifact is being deployed, please wait...
Connected to server
[2023-05-11 12:13:39,266] Artifact dataverse:war: Artifact is deployed successfully
[2023-05-11 12:13:39,266] Artifact dataverse:war: Deploy took 28,259 milliseconds
[2023-05-11 12:13:40,708] Artifact dataverse:war: Artifact is deployed successfully
64 seconds as of this comment: https://github.com/IQSS/dataverse/issues/5593#issuecomment-786190813
Yeah, starting all the DB and index containers does take some time.
I'm looking forward to the demo.
How long would it take for https://github.com/IQSS/dataverse-people ?
It's basically the hello world app described in #5736. (I already left a comment there about it.)
Does ENABLE_RELOAD work? From https://guides.dataverse.org/en/5.13/container/base-image.html#tunables
I tried to use it here: https://github.com/IQSS/dataverse-people/blob/6bd128e678cd1a9a580da7ffebf0e80cf616cfba/dataverse-people/wad-docker.sh#L13
Philip Durbin said:
Does ENABLE_RELOAD work? From https://guides.dataverse.org/en/5.13/container/base-image.html#tunables
I looked into this again and noticed that I actually might have forgotten to enable a certain setting. I will need to adapt the base image for that!
I probably should go ahead and create a new issue and PR for faster redeploy...
Should I create an issue about ENABLE_RELOAD?
Well not if we can't reproduce it. I have a fix here but I'm searching for a test
(The fix is basically to re-enable also the second setting...)
So mounting the files and touching ".reload" does not seem to do the trick...
Even with a fixed setting and JSF set to Development status
You can use that wad docker commit above to test ^^
The war file is being updated in the deployments dir
but it isn't being deployed
I might have a way to configure that... The autodeploy thing is usually under the domain root
Just found out the setting to change that location
And we might also need to change the path to the app dir - that is by default also under the domain dir
Otherwise using .reload won't do anything
Ah DANG we can't do that - there are internal apps like the EJB timer etc in there
Dunno if a symlink will be followed, but we can try :-D
Do you think redeploy will work with an official Payara image? (I can't run these on my M2 Mac: https://dataverse.zulipchat.com/#narrow/stream/375812-containers/topic/helping.20Payara.20with.20M1.2FM2.20builds )
(I tried with Open Liberty first but got a bit lost.)
(because Open Liberty is what's used in the blog post and video I was following: https://blog.sebastian-daschner.com/entries/reloading-javaee-apps-wad )
I disbelieve that - I'm using the same scripting logic, so why would that be any different?
Ok, maybe I'll try to get it working with Open Liberty, then.
The video is pretty compelling: https://www.youtube.com/watch?v=V_haSihHHV8
And it's IDE-independent, which I like.
You did see
image.png
That directory is the important bit...
Yes, I saw that. Again, I can't try the official Payara image on my M2.
Ok but it's the same thing.
Both images are the same server
Same structure
I did copy most of the init scripting anyway
Are you going to try my commit or not? :happy:
Commit?
Link link link
Ah I see
Philip Durbin said:
I tried to use it here: https://github.com/IQSS/dataverse-people/blob/6bd128e678cd1a9a580da7ffebf0e80cf616cfba/dataverse-people/wad-docker.sh#L13
That's your reproducer. Nice and small. :happy:
I won't try it yet :-D We need to reconfigure the app server first to pickup modules with autodeploy from the other directory first
I had to rename the "backend" directory to "dataverse-people" to make wad.jar happy.
Otherwise you can try very very very long :wink:
Oh you could try something. Mount to /opt/payara/appserver/glassfish/domains/domain1/autodeploy for me
I see. Are you saying in our base image Payara will do deployments from two directories? The official one and the one we added?
Yes and no
What we do is manually craft a deployment and send that Payaras way. It basically is a "deploy" command
That can source any dir / file whatever
But autodeploy has a scanner that looks into a certain directory (the one above)
Ah dang if you try this you need to reenable autodeploy as well... Hmm you can do that once the server runs via asadmin I believe.
Or go via https://localhost:4848 and enable it from there. If it needs a restart, it should be possible to do that from there too
This is the diff you want in my wad docker script?
-DEPLOY_DIR=/opt/payara/deployments
+DEPLOY_DIR=/opt/payara/appserver/glassfish/domains/domain1/autodeploy
Yes
Doesn't work. I can see the war file changing...
payara@4ef27fd1982b:~$ ls -l /opt/payara/appserver/glassfish/domains/domain1/autodeploy
total 4
-rw-r--r-- 1 payara payara 3456 May 11 12:13 dataverse-people.war
payara@4ef27fd1982b:~$ ls -l /opt/payara/appserver/glassfish/domains/domain1/autodeploy
total 4
-rw-r--r-- 1 payara payara 3460 May 11 12:15 dataverse-people.war
... but the output from curl doesn't change at all.
Nothing in server.log. No mention of attempted deployments.
You can try it yourself if you don't believe me. :happy:
Did you re-enable the autodeploy scanner?
GNARF. No use. Even with changing the directories it won't reload / autodeploy. I'm not sure if this works with exploded WARs
Should I push you my base image to GHCR and you try with your WAD? You're using WARs @Philip Durbin
I just did: https://github.com/orgs/gdcc/packages/container/base/92458934?tag=reload
$ docker pull ghcr.io/gdcc/base:reload
Error response from daemon: Head "https://ghcr.io/v2/gdcc/base/manifests/reload": unauthorized
Oh. Might be private. Sec
Try again, just made it public
I think I'm missing a step. The scanner or something.
This is what I've done so far: https://github.com/IQSS/dataverse-people/commit/74dd7e4
Please let me know what I'm missing.
By the way, I've played with fast redeploys with Quarkus. It's a game changer. I would love to boost our productivity with a faster feedback loop.
sekmiller and I are both having trouble with https://guides.dataverse.org/en/5.14/container/dev-usage.html#re-deploying
$ docker compose -f docker-compose-dev.yml create dev_dataverse
[+] Running 4/4
β Ώ Container dev_postgres Created 0.0s
β Ώ Container dev_solr_initializer Recreated 0.1s
β Ώ Container dev_solr Recreated 0.1s
β Ώ Container dev_dataverse Recreated 1.0s
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ae0ae4848ac1 moby/buildkit:buildx-stable-1 "buildkitd" 2 weeks ago Up 2 weeks buildx_buildkit_maven0
$ curl http://localhost:8080/api/info/version
curl: (7) Failed to connect to localhost port 8080 after 7 ms: Connection refused
I've never used these instructions until he said they weren't working this morning. I'm pretty sure he's right.
Should I create an issue?
Did you start the containers with compose before the recreation?
No.
Quote from the docs:
In case of using Docker Compose and starting the containers in the background, you can use a workaround to only restart the application container
Maybe that sentence needs to be more precise in wording
Yeah, maybe I'll create a PR.
The explanation is easy - compose need to track the state of the containers, otherwise it can't maintain 'em. :wink:
The foreground/background stuff might be a bit confusing.
I can't get the docker compose -f docker-compose-dev.yml create dev_dataverse thing to work at all. I'll just propose a commit to remove it for now.
Actually, instead of removing it, I just flagged it as a bit sus.
@Oliver Bertuch how does this look to you? https://github.com/IQSS/dataverse/compare/9616-container-dev...9616-redeploy
I sent a link to sekmiller as well.
Whoops. New link because that PR got merged: https://github.com/IQSS/dataverse/compare/8305-payara6-ee10-v3...9616-redeploy
At standup yesterday we agreed it's fine for me to push this commit into the Payara 6 branch. I will, when I get a minute. Or I could remove the whole "Redeploying Just Dataverse with Docker Compose" section (rather than saying we're not sure it works) because I can't get it working. @Oliver Bertuch what do you think? Merge as is? Remove that section? Try to get it working?
If you feel it is more trouble than feature, remove it if you want...
Well, it must work for you, or you wouldn't have written it up. I wonder if I'm missing something. Do you use that method all the time?
Nope, as I'm not using docker-compose
To much to type :wink:
But I tried it before and it did work (otherwise I would not have written it)
Would you want to try it again? And help me get it working?
Can try
Can we focus on topic #9769 first? I want to get that fixed ASAP because it's breaking people's workflows
Absolutely!
Related topic: #containers > re-deploying (dev usage)
I might have found a better way to do this...
It's hacky.
So I can't make "dynamic reloads" work. It simply doesn't pick up the touches on the .reload file.
As a consequence, we can't use the builtin feature...
But...
I did some experimentation with "reload" from the Admin Console and it seems to work.
The interesting part however is that internally, this "reload" seems to be a disable/enable command
It's loosing an app's state. But maybe that's OK?
I did experiment with asadmin redeploy --keepstate as well
That does work, although one has to ignore all the SQL exception. We really should make those go away BTW
That said, I'm now wondering how we can make Payara do these things for us
It certainly is quicker to do these reloads than stopping and starting the containers
As we need to bring all the peaces together, one requirement for the workflow would be to execute the package command in some way. Otherwise we don't have all the apps stuff in one place
But probably that is reasonable - redeploying after compiling seems not so reasonable to me
BTW simply editing an XHTML file will not be enough to make it reload. And getting these in the right place is also tricky, needs packaging...
(because we have a bunch of single files at the top location - would be easier if we had all of this in subfolders. But as JSF is going to go away anyway... well... maybe that's fine.)
We can mount the exploded package into the container. Easy
What's left is the trigger telling Payara to disable/enable or undeploy/deploy
Here's a thought about that: we could use another container for this. It will sit on the same network. And it will talk to Payara via it's admin API. https://docs.payara.fish/community/docs/Technical%20Documentation/Payara%20Server%20Documentation/Management%20and%20Monitoring%20REST%20API/Overview.html
Using the REST API we don't need Java in that container, it's simple curl/wget commands.
We could write a script for configbaker... :smile:
Thanks for hacking on this! Please let me know if you'd like me to try any commands.
Do you think that workflow for a dev "package the app" is reasonable?
Or should the DX be something else?
The developer joy DX of Quarkus would be ideal but I'm willing to try anything. :big_smile:
Technically we could write a scripts that runs on your host maschine, monitors the compiled files and triggers packaging for you
It would still need to reach out to Payara to reload... So this REST API part would be the same
Sort of like https://github.com/AdamBien/wad ?
Yes, sort of
I used wad with https://github.com/IQSS/dataverse-people and it worked fine.
We could use that tiny repo as a test bed, if you want.
If we can't come up with a good DX for a tiny repo, what hope do we have for Dataverse?
Adding a ref here: https://stackoverflow.com/questions/31035669/glassfish-application-reload-with-asadmin
I don't think we need a whole topic for this because JSF is going away, but I just got a report that a downside of Docker is that changing an xhtml file take a whole redeployment cycle. Previously, when you have Netbeans configured to redeploy, a change to an xhtml file was instantaneous.
Ehm... Told you so? :see_no_evil:
It's not news to me. I'm just passing along feedback from people who have tried Docker and are using the classic method instead.
Yeah, thx for the feedback, appreciate it. Can only say: workin' on it...
Should we put this on the agenda for today's meeting? Any news? Anything to discuss! 3m to deploy according to #containers > running using compose ! :grimacing:
#9769 has been closed. Should we discuss redeploying here or in #containers > faster redeploy ? Are they separate topics? Should we close one of them?
No news yet - sorry, my attention is requested at other places ATM
Let's move discussion over there. Or can we merge?
Or a fresh topic even :big_smile:
@Philip Durbin saw your comment on https://github.com/IQSS/dataverse/issues/9590#issuecomment-1734223276
When you are using Netbeans...
Is Netbeans starting the app server for you?
Or is it just deploying to a running webserver?
And if you change that XHTML, can you tell if it is redeploying the whole WAR / exploded WAR?
Yes, Netbeans is starting Payara. I'm happy to give you a quick demo if you like.
Sure!
https://harvard.zoom.us/my/pdurbin?pwd=em1WNUZGbnY2YjhxNEdSbjJJMXNSUT09
@Philip Durbin and @Oliver Bertuch , just curious, were you able to get the redeploy any faster?
Still hacking on it... :smile_cat:
Nothing yet. Took some notes here: https://github.com/IQSS/dataverse/issues/9590#issuecomment-1734223276
So I played with this some more and at least the JSF part is actually easy to pull of.
The key to success is making JSF work in dev mode and have a refresh time of 0
Oh, right, right, right. I forgot that bit.
@Ellen K and I were just talking about the redeploy over coffee.
I did a lot of more reading on this as well to look into hot redeploys for Java code
It looks like this might not (yet) be supported with IntelliJ, but should be doable with Netbeans, Eclipse and VSCode
/me looks at... As a developer, I want changes I make to the front end to be visible when I deploy from Netbeans #6953
And by the way: the way Netbeans copies on save is a special hack by them. I did not find any such functionality with the other IDEs
Well isn't that special
The other IDEs require you to do a build for this... :wink:
Here we define a refresh period of 1: https://guides.dataverse.org/en/6.0/developers/classic-dev-env.html#configure-your-development-environment-for-gui-edits
I imagine any low number is fine.
Still does't work. Am I don't this wrong?
diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml
index ab44dbc180..ec67243e42 100644
--- a/docker-compose-dev.yml
+++ b/docker-compose-dev.yml
@@ -14,6 +14,8 @@ services:
- DATAVERSE_DB_USER=${DATAVERSE_DB_USER}
- ENABLE_JDWP=1
- DATAVERSE_FEATURE_API_BEARER_AUTH=1
+ - ENABLE_RELOAD=1
+ - javax.faces.FACELETS_REFRESH_PERIOD=0
ports:
- "8080:8080" # HTTP (Dataverse Application)
- "4848:4848" # HTTP (Payara Admin Console)
@@ -27,6 +29,7 @@ services:
volumes:
- ./docker-dev-volumes/app/data:/dv
- ./docker-dev-volumes/app/secrets:/secrets
+ - ./target/dataverse-6.0:/opt/payara/deployments/dataverse
tmpfs:
- /dumps:mode=770,size=2052M,uid=1000,gid=1000
- /tmp:mode=770,size=2052M,uid=1000,gid=1000
Oh wait, it should be dataverse.jsf.refresh-period but formatted in caps and such, I think.
Yes. I'm about to make a PR about faster reloads. Personally, I would like to include this in the ENABLE_RELOAD switch, as it would make things easier then setting lots of things.
"Environment variables follow the key, replacing any dot, colon, dash, etc. into an underscore β_β and all uppercase letters. Example: dataverse.db.host -> DATAVERSE_DB_HOST"
We could also have a simple Maven property to enable this...
Speaking of ENABLE_RELOAD=1, do I need it?
Probably not right now
I'll just want to make it more convenient that way
It works! This is all I need:
diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml
index ab44dbc180..2b9a69f9ba 100644
--- a/docker-compose-dev.yml
+++ b/docker-compose-dev.yml
@@ -14,6 +14,7 @@ services:
- DATAVERSE_DB_USER=${DATAVERSE_DB_USER}
- ENABLE_JDWP=1
- DATAVERSE_FEATURE_API_BEARER_AUTH=1
+ - DATAVERSE_JSF_REFRESH_PERIOD=1
ports:
- "8080:8080" # HTTP (Dataverse Application)
- "4848:4848" # HTTP (Payara Admin Console)
@@ -27,6 +28,7 @@ services:
volumes:
- ./docker-dev-volumes/app/data:/dv
- ./docker-dev-volumes/app/secrets:/secrets
+ - ./target/dataverse-6.0:/opt/payara/deployments/dataverse
tmpfs:
- /dumps:mode=770,size=2052M,uid=1000,gid=1000
- /tmp:mode=770,size=2052M,uid=1000,gid=1000
Muhahaha!
Of course we need to factor out that 6.0 in there.
Actually I do have an idea for that. Let me pick your brain about this.
We can make the WAR plugin (that creates the exploded and the WAR) skip the version number
Would that make sense? Would it be disruptive to someone else?
Well, my first question is if we have a variable we can reuse for the number, the 6.0. It's in the pom already.
(Obviously we could just change the config in the ct profile, but then it might get harder to use with IDE rebuilds, as you would need to configure the profile)
Not if we insist on enabling people to run this just from using docker compose
It's would be no problem if everybody uses mvn to start the containers
(Because then we can use variable substitution))
We can of course add an env var in there, but that would need to be adapted with every version increase. Meh
For the next PR, I say we:
DATAVERSE_JSF_REFRESH_PERIOD=1 to the compose file (can't hurt)./target/dataverse-6.0:/opt/payara/deployments/dataverse as a volume to the compose file and explain that 6.0 is a placeholderinstant value
I would like to make it a little more complete
Just a tiny bit
But in general, I agree
@Ellen K it works!
@Oliver Bertuch so are you making a PR or should I?
On it
https://github.com/IQSS/dataverse/pull/9959
I have a new Dataverse 6.0 docker installation as per https://guides.dataverse.org/en/latest/container/dev-usage.html and when I try to access the Payara console at http://localhost:4848 it redirects to https://localhost:4848 with a warning about the self signed cert provided by this endpoint.
Is there a reason for serving the Payara console via https in development mode?
I actually wanted to try IntelliJ's Payara remote run config, which may enable deploying a new Dataverse version from IntelliJ directly, thus making development easier, but because of the invalid cert it cannot connect at localhost:4848.
I'm VERY interested in improving the DX (dev experience) for Dataverse. This remote run stuff falls under this issue, for sure: Faster turn-around times for devs using containers #9590
I might be out of luck with the community edition. It seems like need IntelliJ IDEA Ultimate to install Payara Platform Tools:
Screenshot-2023-10-30-at-9.46.54-AM.png
I was trying to follow https://blog.jetbrains.com/idea/2021/04/fast-and-efficient-development-with-payara-server-intellij-idea-ultimate/
Anyway, what would be the best way to unblock you? To install a valid cert?
I have the ultimate edition and there I have these options:
When I use remote, I get these options:
Well, the best option would be no SSL at all. If I click "Use SSL connection" it will try to connect to port 61008, without this check it tries to connect to http 4848 which is actually a https port now.
I see. From the docker compose perspective, we're simply mapping ports one to one like this:
ports:
- "8080:8080" # HTTP (Dataverse Application)
- "4848:4848" # HTTP (Payara Admin Console)
- "9009:9009" # JDWP
- "8686:8686" # JMX
I wonder if there's a non-SSL port we can map.
But why is 4848 serving actually HTTPS? I couldn't find anything about it in the docker configs. Is it a new Payar 6 "feature" maybe?
Can you, please, confirm that when you open http://localhost:4848 you also get the warning about the cert (in Chrome, for example)?
Not sure. I found this (perhaps) related issue: https://github.com/payara/ecosystem-support/issues/59
Hmm, maybe this is what's doing it:
modules/container-base/src/main/docker/Dockerfile
141: ${ASADMIN} enable-secure-admin
@BalΓ‘zs Pataki do you want to try rebuilding the base image without that?
Sure, I give it a try!
I tried commenting that out and also using
${ASADMIN} disable-secure-admin
But it did nothing. Then I tried it disabling via the admin console UI:
Configurations > default-config > Protocols > sec-admin-listener > Use the Secure Administration page to enable/disable secure administration at https://localhost:4848/common/appServer/securityAdmin.jsf
This worked! Now I can access the admin console at http://localhost:4848, however when try to log in it gives me:
Configuration Error
Secure Admin must be enabled to access the DAS remotely.
So, it seems to be a Catch-22 for me: I can disable secure admin via the admin console, but then I cannot log in via HTTP anymore.
Ok, I got a little bit further by adding an nginx to the docker-compose, which proxies HTTP 4849 to the backend HTTPS 4848. This way I can access from the Intellij run config Payara admin at http://localhost:4849. However, during redeploy I get:
dev_dataverse> java.lang.Exception: Virtual server server already has a web module dataverse loaded at / therefore web module dataverse-6.0 cannot be loaded at this context path on this virtual server
Now, I undeployed the dataverse app by hand via the admin console, and now I can redeploy the app from IntelliJ or hot reload classes with minimal changes.
The redeploy is ~20 sec.
Unfortunately the Update classes and resources is not available, which allows hot reloading XHTML files in normal local Payara usage:
Huh, it looks available in the screenshot
The first one with the 2 items is what is availble with remote Payara run config (ie. Payara in Docker), the later is when IntelliJ can run asadmin locally for a locally running Payara.
Oh, I see. Thanks.
Well, you've made a lot of progress. We can see the limitations, at least.
But can we overcome them?
I'm not really sure, but probably not.
As far as I understand, in case of remote deployment IntelliJ has 2 API-s available:
Unfortunately, I don't know what is the magic behind Update classes and resources, but it doesn't seem to be related to remote java debugging via JDWP. Is it maybe a Payara feature with a magic classloader? I don't know.
Hmm. Have you heard of JRebel? https://www.jrebel.com . I wonder how they do it.
Yes, I heard, they do it for a lot of $$$ :-) The closest free thing is http://hotswapagent.org/ I tried it a couple of years ago, works quite nicely, allows reloading classes with deeper changes (new methods, fields added, etc), but I am not sure how it handles xhtml files, which are not compiled at IDE time.
There's also this, but I haven't tried it: https://manik.imixs.org/
Manik also seem to work with a local Payara installation https://manik.imixs.org/userguide.html#payara
I wonder whether it is possible to make Payara in docker use an exploded war available in a mapped volume and pick up changes there.
As a Netbeans user, I'm no longer worried about xhtml files. Recently we made this pull request to address that: allow fast xhtml edits in Docker #9961
Manik looks interesting! For the PR I just mentioned we have this under "volumes" in our docker compose: ./target/dataverse-6.0:/opt/payara/deployments/dataverse. Maybe it'll work with Manik?!? Not sure.
Philip Durbin said:
As a Netbeans user, I'm no longer worried about xhtml files. Recently we made this pull request to address that: allow fast xhtml edits in Docker #9961
The main things seems to be DATAVERSE_JSF_REFRESH_PERIOD=1 here. How does it relate to or specific to Netbeans?
Once the war is loaded from a mapped volume I feel a lot of options open up regarding managing reloads, because this would be very simiilar to a local Payara install. But it needs experimenting, sure.
It's not specific to Netbeans. It tells the app server how often to look for changes to XHTML files. In production it's basically set to "never". In dev, we set it to every second, which is plenty fast enough.
Which should we try first, HotswapAgent or Manik?
I see Payara mentioned here: https://manik.imixs.org/userguide.html#payara
I feel like we should rename this thread. It's becoming more about iterating on code quickly, right?
I could even move these messages to #containers > faster redeploy ... Any objection, @BalΓ‘zs Pataki ?
Sure, you can move it/rename it.
I think HotswapAgent could be the first target. This would augment the current class reload capabilities via JDWP, which would be a big win.
30 messages were moved here from #containers > Payara admin console redirects to https by Philip Durbin.
Yeah? HotswapAgent? Ok. No objection. They do seem to support Java 17.
Submitted PR for the nginx workaround: https://github.com/IQSS/dataverse/pull/10088
Aw. You removed "hack" from the name. Otherwise, looks perfect! Thanks! :heart:
@Oliver Bertuch heads up that @Juan Pablo Tosca Villanueva was struggling with the re-deploy instructions this morning and I told him he's welcome to go ahead and make a PR to remove them. He just did: #10089
Or rather, drastically shorten them: https://dataverse-guide--10089.org.readthedocs.build/en/10089/container/dev-usage.html#re-deploying
Merged.
I just made this PR: Containers: set autodeploy-enabled=true for ENABLE_RELOAD #10100
@Oliver Bertuch no rush but I'm curious what you think.
In the toy "people" app, I'm starting to document how to redeploy to Payara running in Docker, starting with the most obvious ways: https://github.com/IQSS/dataverse-people/commit/afb59e8
I'm hoping to apply anything I learn through this exercise to Dataverse, of course.
Philip Durbin said:
Oliver Bertuch no rush but I'm curious what you think.
Nice! Just one hint... have you seen #9959? :hug::yum:
Actually Manik which @BalΓ‘zs Pataki mentioned could be one of the missing pieces of the puzzle here: something watching for changes and repackaging the application.
(I experimented a bit with changing the autodeploy dir in the domain config, but had no luck, didn't work. Maybe we can try again)
Ah, so you also discovered we don't have autodeploy-enabled=true. Do you care if I merge my pull request?
Dunno. Wouldn't it make sense to figure out some more stuff first to get this going? As I said, the autodeploy dir is different, so this will need some more tuning and experimentation
To me it's a harmless change that improves the base image. Without it, if you put a war file in the autodeploy directory, nothing happens.
Sadly, the autodeploy directory method only works the first time you copy a war file into it: https://github.com/IQSS/dataverse-people/commit/6e290c5
@BalΓ‘zs Pataki so! I'm on your branch, this PR: Add gdcc/nginx:unstable image and dev_nginx container for IntelliJ Payara plugin workaround #10088
It says "connected to server":
Screenshot-2023-11-06-at-11.36.52-AM.png
Do you have time for a Zoom? :sweat_smile:
It works! @BalΓ‘zs Pataki is my hero!! ![]()
I hope no one minds about improvements?
I'd say let's make 4848 HTTP by default and do not create another image... Instead just use vanilla nginx.
But yes, I love where this is going!
Merged! I added some docs: https://dataverse-guide--10102.org.readthedocs.build/en/10102/container/dev-usage.html#intellij-idea-ultimate-and-payara-platform-tools
@Oliver Bertuch yes, please feel free to refactor away!
I just got it working in Netbeans too! :tada:
Hmm, having trouble reproducing what I did in Netbeans. :thinking:
Here are some screenshots on what I was doing, at least:
apply-code-changes.png
compile.png
run.png
server-common.png
server-java.png
Actually, it stopped working in IntelliJ too. :disappointed:
And when I start over and try to undeploy the war file that's initially deployed in our container, I'm not getting this error:
dev_dataverse> [#|2023-11-07T01:41:56.980+0000|INFO|Payara 6.2023.8||_ThreadID=228;_ThreadName=admin-thread-pool::admin-listener(7);_TimeMillis=1699321316980;_LevelValue=800;|
dev_dataverse> RewriteFilter shutting down...|#]
dev_dataverse>
dev_dataverse> [#|2023-11-07T01:41:56.980+0000|INFO|Payara 6.2023.8||_ThreadID=228;_ThreadName=admin-thread-pool::admin-listener(7);_TimeMillis=1699321316980;_LevelValue=800;|
dev_dataverse> RewriteFilter deactivated.|#]
dev_dataverse>
dev_dataverse> [#|2023-11-07T01:41:57.145+0000|INFO|Payara 6.2023.8|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=228;_ThreadName=admin-thread-pool::admin-listener(7);_TimeMillis=1699321317145;_LevelValue=800;|
dev_dataverse> No timers to be deleted for id: 111366718806163456|#]
dev_dataverse>
dev_dataverse> [#|2023-11-07T01:41:57.146+0000|WARNING|Payara 6.2023.8|jakarta.enterprise.web.util|_ThreadID=228;_ThreadName=admin-thread-pool::admin-listener(7);_TimeMillis=1699321317146;_LevelValue=900;|
dev_dataverse> The web application [] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.|#]
dev_dataverse>
dev_dataverse> [#|2023-11-07T01:41:57.154+0000|SEVERE|Payara 6.2023.8|com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl|_ThreadID=124;_ThreadName=Executor-Service-9;_TimeMillis=1699321317154;_LevelValue=1000;|
dev_dataverse> Could not instantiate service: fish.payara.jbatch.persistence.rdbms.LazyBootPersistenceManager due to exception:java.lang.ClassNotFoundException: fish.payara.jbatch.persistence.rdbms.LazyBootPersistenceManager not found by fish.payara.server.internal.batch.payara-jbatch [372]|#]
dev_dataverse>
dev_dataverse> [#|2023-11-07T01:41:57.154+0000|SEVERE|Payara 6.2023.8|com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl|_ThreadID=124;_ThreadName=Executor-Service-9;_TimeMillis=1699321317154;_LevelValue=1000;|
dev_dataverse> Could not instantiate service: com.ibm.jbatch.container.impl.BatchKernelImpl due to exception:java.lang.reflect.InvocationTargetException|#]
dev_dataverse>
dev_dataverse> [#|2023-11-07T01:41:57.154+0000|WARNING|Payara 6.2023.8|javax.enterprise.system.core|_ThreadID=124;_ThreadName=Executor-Service-9;_TimeMillis=1699321317154;_LevelValue=900;_MessageID=NCLS-CORE-00069;|
dev_dataverse> Exception while dispatching an event
dev_dataverse> java.util.ServiceConfigurationError: jakarta.batch.operations.JobOperator: Provider com.ibm.jbatch.container.api.impl.JobOperatorImpl could not be instantiated
dev_dataverse> at java.base/java.util.ServiceLoader.fail(Unknown Source)
dev_dataverse> at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(Unknown Source)
dev_dataverse> at java.base/java.util.ServiceLoader$ProviderImpl.get(Unknown Source)
dev_dataverse> at java.base/java.util.ServiceLoader$3.next(Unknown Source)
dev_dataverse> at jakarta.batch.runtime.BatchRuntime.getJobOperator(BatchRuntime.java:48)
dev_dataverse> at org.glassfish.batch.spi.impl.BatchRuntimeHelper.event(BatchRuntimeHelper.java:216)
dev_dataverse> at org.glassfish.kernel.event.EventsImpl$1.run(EventsImpl.java:123)
dev_dataverse> at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
dev_dataverse> at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
dev_dataverse> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
dev_dataverse> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
dev_dataverse> at java.base/java.lang.Thread.run(Unknown Source)
dev_dataverse> Caused by: java.lang.RuntimeException: Could not instantiate service com.ibm.jbatch.container.impl.BatchKernelImpl
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadServiceHelper(ServicesManagerImpl.java:424)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.getService(ServicesManagerImpl.java:403)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.access$300(ServicesManagerImpl.java:388)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getService(ServicesManagerImpl.java:304)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getBatchKernelService(ServicesManagerImpl.java:348)
dev_dataverse> at com.ibm.jbatch.container.api.impl.JobOperatorImplDelegate.<init>(JobOperatorImplDelegate.java:74)
dev_dataverse> at com.ibm.jbatch.container.api.impl.JobOperatorImpl.<init>(JobOperatorImpl.java:73)
dev_dataverse> at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
dev_dataverse> at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
dev_dataverse> at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
dev_dataverse> at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
dev_dataverse> at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
dev_dataverse> ... 11 more
dev_dataverse> Caused by: java.lang.reflect.InvocationTargetException
dev_dataverse> at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
dev_dataverse> at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
dev_dataverse> at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
dev_dataverse> at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
dev_dataverse> at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadService(ServicesManagerImpl.java:447)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadServiceHelper(ServicesManagerImpl.java:420)
dev_dataverse> ... 22 more
dev_dataverse> Caused by: java.lang.RuntimeException: Could not instantiate service fish.payara.jbatch.persistence.rdbms.LazyBootPersistenceManager
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadServiceHelper(ServicesManagerImpl.java:424)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.getService(ServicesManagerImpl.java:403)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader.access$300(ServicesManagerImpl.java:388)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getService(ServicesManagerImpl.java:304)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl.getPersistenceManagerService(ServicesManagerImpl.java:333)
dev_dataverse> at com.ibm.jbatch.container.impl.BatchKernelImpl.<init>(BatchKernelImpl.java:87)
dev_dataverse> ... 29 more
dev_dataverse> Caused by: java.lang.ClassNotFoundException: fish.payara.jbatch.persistence.rdbms.LazyBootPersistenceManager not found by fish.payara.server.internal.batch.payara-jbatch [372]
dev_dataverse> at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)
dev_dataverse> at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
dev_dataverse> at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
dev_dataverse> at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadService(ServicesManagerImpl.java:441)
dev_dataverse> at com.ibm.jbatch.container.servicesmanager.ServicesManagerImpl$ServiceLoader._loadServiceHelper(ServicesManagerImpl.java:420)
dev_dataverse> ... 34 more
dev_dataverse> |#]
dev_dataverse>
This is on my laptop at home. It was working. Both IntelliJ and Netbeans. But now neither one works. :thinking:
:shrug:
I rebooted my laptop and now fast redeploy from both IntelliJ and Netbeans are working. :tada:
Mind you, I'm not sure rebooting was necessary but I was getting frustrated. :sweat_smile:
I recorded a video of fast redeploy with Netbeans: https://harvard.zoom.us/rec/share/BCEJnBDUFCiRxkN0r54FWNku0GWdKJysRubQoYg2NCm6sYqsNPyq0_0kwzsT-8yZ.f1v-LGnfP9pPnJwv
Once YouTube is done processing it, it should also appear here: https://www.youtube.com/watch?v=yo3aKOg96f0
One take! :grinning:
I was working on improving the deets this morning to make the setup easier and have less new dependencies
We have #9590, should we write down some stuff we have in mind?
@Philip Durbin this works for XHTML edits, too, right?
Sure. Or we could do it live in the container meeting on Thursday. Or type here for now.
When I do "apply code changes" on xhtml, Netbeans says "No class to reload".
So XHTML isn't propagated after a change using the Payara Tools?
This is builtin Netbeans functionality I'm using.
That's a bummer! As the files are hotreload via a WAR file being thrown an the server, I don't see how this builtin thing actually would help with this. Can you do me a favor and try this?
Do you want to do a zoom?
https://fz-juelich-de.zoom.us/j/66663859869?pwd=ZjZaRjFSK3QzV3RPK293N3dhUWlDZz09
Need to run soon
I just let people know about my Netbeans video: https://groups.google.com/g/dataverse-community/c/zNBDzSMF2Q0/m/Z-xS6fA2BgAJ
I just posted about the video here: https://forum.payara.fish/t/fast-redeployment/721
And here (Netbeans mailing list): https://lists.apache.org/thread/y7x918bm30mdzyr88xfhvwlnqm3x51gs
In the little time I could spend on https://github.com/IQSS/dataverse/pull/9959 today, I'm hacking away on making it more polished
Here's a sneak peak at the docs I'm writing, hoping you might add steps for Netbeans later. Maybe @Juan Pablo Tosca Villanueva can add steps for VSCode, too.
grafik.png
Looks good but @Juan Pablo Tosca Villanueva is gonna want more emojis in the docs. :big_smile:
The docs are up: https://dataverse-guide--9959.org.readthedocs.build/en/9959/container/dev-usage.html#ide-triggered-re-deployments
"limitations in what the JVM HotswapAgent can do for you" ... huh, so this is built into the JVM, I guess
Absolutely. There is a reason why people spend money on JRebel
And the Hotswap thing is also only activated when going via JDWP. That's the reason why you need to run the debug mode in the IDE
@Philip Durbin what do you think about the docs? Is this more graphical thing useful?
I haven't finished reading them but sure, screenshots are nice.
They do get out of date sometimes.
Yeah, they are out of date in the Payara docs, too
But it seems like the UI doesn't change as much, so maybe we are fine for some time...
Complainers will be held to create pull requests :stuck_out_tongue:
heh, sounds fine
Great demo by @Oliver Bertuch ! Here's the recording: https://harvard.zoom.us/rec/share/HqZQYeYdmB_yXyzGF4TqbGG7ta3nThvtqnuCtulDJQj5YMmcjk3PUvPVLJaLRykJ.4bUUH8_fenHuLmWa
@Oliver Bertuch really cool updates, documentation and demo!
Thanks for getting us there in the first place!
@Oliver Bertuch I just tried your https://github.com/IQSS/dataverse/pull/9959 but I'm getting an unexpected error: dev_solr> Caused by: org.apache.solr.common.SolrException: Error loading solr config from /var/solr/data/collection1/conf/solrconfig.xml
I don't see any reason for this, based on the changes in the PR. Very strange.
Actually, never mind. It's fine now.
I am having trouble getting -Dapp.deploy.skip to work though. Maybe I'll try the env var.
Changing .env didn't seem to work.
Neither did changing skip from 0 to 1 in the docker compose file.
I have a demo in 30 minutes. I'm switching back to develop. :sweat_smile:
My money :money: is on "you forgot to build the base image" :see_no_evil:
Hmm, we should put that on a t-shirt.
Anyway, here's the demo I gave this morning: https://harvard.zoom.us/rec/share/AsB1xRUM3bsNmDrqTVa9ZM91FaHM5F1wdVAdoBAbbM5bXLllDUKfBfAbkLb4G7Ej.-Jyz6CjRt18R3Hfq
I mentioned this thread, so maybe some people will join the discussion.
@Eryk Kulikowski are you using VS Code? Have you tried getting this fast redeploy stuff working?
Philip Durbin said:
Eryk Kulikowski are you using VS Code? Have you tried getting this fast redeploy stuff working?
I have tried, but I could not get it working. The plugin for VS Code connected to the server, but it was giving errors. I did manage to undeploy the application, but did not have any success on deploying it.
@Eryk Kulikowski thanks. It sounds like @Juan Pablo Tosca Villanueva is having the same trouble. You should both feel free to add it to the agenda if you like. Meeting in 45 minutes. See #containers > weekly meeting
@Oliver Bertuch I'm running this:
mvn -Pct clean package docker:run -Dapp.deploy.skip
But it keeps checking http://dataverse:8080/api/info/version over and over. Is this the expected behavior?
I did get this, which is good:
dev_dataverse> Skipping deployment of /opt/payara/deployments/dataverse as requested.
But it keeps checking http://dataverse:8080/api/info/version over and over. Is this the expected behavior?
Yes, that was intentional. You might want to deploy a fresh install and then bootstrapping gracefully waits for you to do the deployment. If you think we should not do that, we can alter the behaviour.
Also: we can alter the Maven property name, too. Maybe it would be a nice idea to make it more inline with the other skipping things like -DskipTests etc
The Payara plugin in VS Code worked for me, but only with manual deploy. First, I manually build the war file with maven (mvn compile war:war), it only compliles changed files so it is fast. Then I right-click on the war file and choose "Run on Payara Server". This step takes some time, but it is still faster than rebuilding and replacing the docker image. This method works fine with our custom-build docker image, such that my other settings work just fine.
I measured the redeployment time, it is roughly 30 seconds. It is a large improvement for me.
Great! We just created an issue do add some docs: add Visual Studio Code to guides #10156
@Juan Pablo Tosca Villanueva like I said, you are very welcome to edit the description of that issue with whatever you like, links to resources, etc.
@Eryk Kulikowski you're very welcome to add comments and/or we can keep discussing here. Or maybe a dedicated topic if that's better.
Hi @Eryk Kulikowski ! I added some notes on #10156 with the setup and the workflow that I been using. It would be great that if you have any sugestions or find anything better you could share it with us :smile:
@Juan Pablo Tosca Villanueva I use exactly the same flow now. Since you mentioned the recommended plugin for docker (which I find very good and useful), you may also mention the "Extension Pack for Java" (mainly for java language support and maven) and XML plugins. I also find the "Git History" and "Git Graph" plugins useful. Finally, a good hint is to bump the memory setting for the Java language plugin up to 4 GB, I use the settings from here: https://github.com/redhat-developer/vscode-java/issues/2232
{
"java.configuration.updateBuildConfiguration": "interactive",
"java.compile.nullAnalysis.mode": "automatic",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable"
}
Yeah, I been hit by the memory limit a couple of times already. :laughter_tears:
Should we put https://github.com/IQSS/dataverse/pull/9959 in non-draft and let it get merged? @BalΓ‘zs Pataki was just asking about the nice screenshoted guide :see_no_evil:
We can add more guides with nice pics later
Here's what @BalΓ‘zs Pataki and I talked about in another place:
BalΓ‘zs Pataki: Hi Oliver, as I remember you created a very nice screenshot illustrated guide to running/developing Dataverse in docker. I thought I would find it at https://guides.dataverse.org/en/latest/container/index.html, but I couldn't. Could you please help me locate where it is available?
Oliver Bertuch: I think it hasn't been merged yet
Oliver Bertuch: This is the PR: https://github.com/IQSS/dataverse/pull/9959
Oliver Bertuch: And the guide you're looking for is here: https://dataverse-guide--9959.org.readthedocs.build/en/9959/container/dev-usage.html#ide-triggered-re-deployments
BalΓ‘zs Pataki: Oh, i see, thanks! I actually wanted to see if you figured out how one can edit .xhtml in Intellij and have it reloaded in the container without redeploying. I don't know if it is at all feasible all.
Oliver Bertuch: We found that Netbeans has a special trick to copy the files into the target directory. Maybe there is a similar thing for IntelliJ?
BalΓ‘zs Pataki: What is the "target" dir? It must be something mapped into the container, right?
Oliver Bertuch: /target is where Maven puts the build artifacts. And yes, we mounted that directory into the container. (Not /target, but the subpath where the exploded WAR lives and is updated)
BalΓ‘zs Pataki: Ok, thought about something similar. Is this mapping already part of the current docker:run mechanism? In IntelliJ one can add an action to run after deployment and it can be any script, so we could copy files anywhere.
Oliver Bertuch: It is not mapped by default, no. The PR linked above would introduce that though.
BalΓ‘zs Pataki: Great, I will check it out!
Oliver Bertuch: Please note the different mechanisms working under the hood here. If you want to on-the-fly edit XHTML, this is not going to work together with working on hot-reloading code. That is because hot-redeploy needs to ship a WAR file and then used JDWP to replace methods etc. The on-the-fly XHTML edit is using the exploded WAR mounted into the container, but that is not going to allow using the hot-redeploy stuff. The easiest solution to have both and both proper: buy a JRebel license...
BalΓ‘zs Pataki: Another idea: in IntelliJ one can run an action once a file is saved. At this point I could copy the changed (only .xhtml) file to the mapped directory. Would this also interfere with the hot-reloading mechanism? When fully redeploying the war, the changed .xhtml file would simply overwrite the separately copied version, but both would be identical at the end.
Oliver Bertuch: Yes, redeploying the WAR would replace it. But it will require waiting for the redeploy to be done (~30 secs). People were asking about instant reload - change, save, switch to browser, hit F5 and done
BalΓ‘zs Pataki: Yes, sure, that's what I want as well ... without JRebel.
Oliver Bertuch: Oh wait - redeploying the WAR using the hot redeploy method is not going to replace the copied file! If you use the exploded WAR to hot-edit the XHTML, that deployment needs to be unloaded and will be replaced with a WAR file based deployment. So these are completely independent sources. When using the hotredeploy method, editing and replacing the XHTML requires a redeployment of the WAR file, thus building and shipping will cost you time. But maybe that's fine for what you're trying to do. As long as you do not need to change XHMTML and Java code on the fly at the same time, this is good enough...?
BalΓ‘zs Pataki: Yes, I will do some experiments. Can you just help me with one thing? What is the payara setting we need to pick up changes to .xhtml files immediately?
If you are going to use what I did in PR #9959, you only need to specify 'ENABLE_RELOAD=1' in your container env in some way. That is already done within the compose file of that PR.
See https://github.com/IQSS/dataverse/pull/9959/files#diff-0f68198e0abf41811cffbc8d15bfb11e7b1d4491769f1362597a7e43126e8082 for all the things done to enable this reloading :wink:
The missing part is to make IntelliJ copy the saved file into the right spot
There might be an easy way to do this just yet... https://plugins.jetbrains.com/plugin/21538-save-actions-tool
That plugin can be fed actions you define as "quick lists"
And it can be triggered not only on every save (which might not be what you want), but using other key combos
The configuration is per project
Here's my solution for IntelliJ for quick webstuff update with hot class reload working as before.
Assuming that 'dataverse.jsf.refresh-period=1' is already set:
volumes:
...
- ./docker-dev-volumes/glassfish/applications:/opt/payara/appserver/glassfish/domains/domain1/applications
war files deployed from IntelliJ will be placed here
Added the script cpwebapp.sh, which helps copying files under src/main/webapp to ./docker-dev-volumes/glassfish/applications
Added a 'File watcher' configuration like this:
Screenshot-2024-01-17-at-13.36.58.png
Now when I edit an .xhtml file (or .js or anything in webapp) and save it it is automatically copied to the appropriate ./docker-dev-volumes/glassfish/applications directory and the change is available in the browser after page reload.
The watcher setting can even be exported/imported, so it could be added by others easily without typing out the watcher config:
It is also possible to create an "External tool" setting, which calls the same script as requested.
It can be invoked from a menu:
Or you can also assign a shortcut key to it.
The "Actions on save" like plugins in the IntelliJ marketplace are not really usable and are not actually necessary.
Sure, let's make it non-draft, resolve merge conflicts, etc.
I just put #9959 into the "in review" column on our project board: https://github.com/orgs/IQSS/projects/34
That is to say, I had it prioritized during our sprint kickoff today.
@Philip Durbin Should I create a PR with my solution above? So that it could be handled together with #9959. Or maybe Oliver could add it to his PR if that is suitable.
Hmm. @BalΓ‘zs Pataki would it make sense for you to make a PR into @Oliver Bertuch 's PR?
@BalΓ‘zs Pataki I just invited you to join a readonly team so I can co-assign the issue to you. You should see the invite at https://github.com/IQSS
Thanks, accepted invitation. I don't know if PR-s on PR-s is a thing or not, but I can try. :smile:
I do it all the time. :grinning:
All right then!
I guess it's a PR, not an issue, but I co-assigned you to it: #9959
I wasn't following very closely what you wrote above, what you want to add, but I'm sure it's good stuff.
I solves in Intellij what you already have in Netbeans, ie. fast xhtml/web stuff editing and instant reload in browser.
Ah, great.
I put this topic on the agenda for today's meeting: https://docs.google.com/document/d/1L2GPXGLpcrzMRjLLCFTXTu1NgK9dGX-tXVR_cn4elh0/edit?usp=sharing
Submitted a PR with what I demoed yesterday: https://github.com/IQSS/dataverse/pull/10247
Thanks! I just added a review... wondering if we should comment out the volume mapping for now.
I just checked at standup and we'll pull this PR into the current sprint.
I assigned it to myself. @Oliver Bertuch are you interested in looking as well?
Philip Durbin said:
Thanks! I just added a review... wondering if we should comment out the volume mapping for now.
OK, answered in the PR.
@BalΓ‘zs Pataki I see your :thumbs_up: on my suggestion on #10247? Do you want to go ahead and click "accept suggestion" to add the commit?
@Oliver Bertuch since you use IntelliJ are you interested in testing the scripts in #10247?
@BalΓ‘zs Pataki I just merged your PR: Intellij IDEA webapp hotreload #10247 Thanks!
Great, thanks!
TIL that docker compose has a "watch" function
https://docs.docker.com/compose/file-watch/
https://www.docker.com/blog/announcing-docker-compose-watch-ga-release/
One mode of its operation is that it can watch a given directory and sync any changes from that directory into the container.
Has anyone tried this feature yet? I can imagine that this could provide a generic solution for updating changed xhtml files in payara in docker regardless of the IDE.
Huh, cool. No, I haven't even heard of it.
I'm back on PR #9959, resolving merge conflicts and trying IntelliJ but I'm getting "Error: Debug: there are no runners for Payara Server: Payara Remote". I'm not sure what I've done wrong. Here's the error in context:
Screenshot-2024-02-13-at-12.07.18-PM.png
I gave up on IntelliJ. Netbeans works fine (-Dapp.deploy.skip is a huge time saver!). I guess I'll work on adding Netbeans tabs to the docs. I'll push what I've got first, the resolved merge conflicts.
@Oliver Bertuch since you made PR #9959 and I've hacked on it considerably, you might want to take a look. I just put it in "ready for review". Overall, works great! Thank you! :heart:
Of course others are welcome to review it as well. @BalΓ‘zs Pataki and @Juan Pablo Tosca Villanueva etc. You can preview the docs here: https://dataverse-guide--9959.org.readthedocs.build/en/9959/container/dev-usage.html#ide-triggered-redeployments
Are you sure you tried the "Payara Remote" run config. It should look like this:
Yours look like the "Payara Local" run config.
Huh. Thanks, I'll take a look.
I greatly extended the PR #9959 with more docs, more features and more... :smile_cat:
@BalΓ‘zs Pataki I also adapted and incorporated your findings with the IntelliJ autocopy!
This works pretty much perfect!
Have a preview at the docs here: https://dataverse-guide--9959.org.readthedocs.build/en/9959/container/dev-usage.html#redeploying
Cool, can't wait to try it!
You write in the documentation:
This imitates the Netbeans builtin function to copy changes to files under src/main/webapp into a destination folder.
It is different in the way that it will copy the files into the running container deployment without using a bind mount.
In my original solution I actually needed a bind volume. Do you really copy now right inside the container?
Yes. Much simpler setup, no need to adapt any path.
That's great!
docker cp to the rescue
Also removed the Perl dependency :wink:
I mentioned couple of days ago that docker compose has a "watch" function
https://docs.docker.com/compose/file-watch/
https://www.docker.com/blog/announcing-docker-compose-watch-ga-release/
Haven't tried it yet, but this may provide an even simpler and generic solution.
Sure, feel free to try out stuff. Much appreciated!
@Philip Durbin question for you when you return to desk today: should we move the "dev usage" page into the "running dv in d/backend dev" page?
Should it even live within the Dev Guide, now that the standard dev env is dockerized?
As discussed in the container meeting yesterday, let's think more about moving the "dev usage" page in the future.
More importantly, I just merged #9959! Thanks, all! Enjoy the faster redeploy!
Hi Everyone,
I was trying to run dataverse locally. first I run this command to run on foreground mvn -Pct clean package docker:run. All the container started and application was running on 8080.
The next step I was trying the faster redeploy. I have intellij ultimate. I installed Payara Platform Tools. and following the steps mentioned on this link https://dataverse-guide--9959.org.readthedocs.build/en/9959/container/dev-usage.html#redeploying
while adding dataverse:war I cannot see any artifact. I hope someone can help me with this.
Hmm. @BalΓ‘zs Pataki @Oliver Bertuch you use IntelliJ more than I do. Any tips?
Actually, @Aamir Muhammad can you please look at the preview version at https://preview.guides.gdcc.io/en/develop/container/dev-usage.html#redeploying ?
There are many more screenshots.
(preview of how the guides will look for Dataverse 6.2)
The same I am following with screen shot. here is my configuration
I'm not sure what's going on here or how to reproduce... When you click the "+" sign, you can't select dataverse:war? (See screenshot at https://preview.guides.gdcc.io/en/develop/_images/intellij-payara-config-server.png)
Also as you are using Maven to start the containers, don't forget to use -Dapp.skipDeploy!
sorry I am new to most of these things. but this time I tried mvn -Pct clean package docker:run -Dapp.skipDeploy and was not able to run the application.
than I try to start it again using the old command mvn -Pct clean package docker:run and the application didn't start. I am also deleting the target and docker-dev-volumes folder everytime.
Anyhow than I try this command mvn -Pct package && docker compose -f docker-compose-dev.yml up -dthe application is started and can see the docker containers. but still when I click the "+" sign, I am not able to see. instead it gives me some options to select from which I am not able to take screenshot. but I am selecting Build artifacts than I am getting this page which is empty
dataverse-artifact-1.png
Sorry, I have no idea what's going on on your machine. :shrug:
I would say let's talk about it more at our weekly meeting ( https://ct.gdcc.io ) but this week we have a special guest so we'll probably be quite busy. Also, I'm not sure if that time works for you, @Aamir Muhammad
@Philip Durbin sure I will be happy to join. Thanks for the invitation.
You're very welcome but again, it'll be a busy meeting. I expect we'll spend the whole time talking about Kubernetes and OpenShift with our guest from Red Hat.
I was going trough the new guides for Intellij and when I try the IntelliJ approach with the volumes initialized on the command line postgress exits with the following message:
2024-03-23 19:47:09.946 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 16, which is not compatible with this version 13.14 (Debian 13.14-1.pgdg120+2).
dev_postgres exited with code 1
:thinking:
You probably need to delete the volumes and do a fresh deployment.
Not sure when you tested with Postgres 16, but I had that before as well.
That definitely works, if I delete the volumes it just initializes them and works fine, but I would love to be able to have it working on both ways. :thinking:
Not sure if I am doing something special to use 16
Not sure either :innocent:
First time using Intellij so I just followed the guide as best as I could
Probably need to update the part of the guide now that the port is 4949 by default :rolling_on_the_floor_laughing:
Oh wait, it is 4848 because it is the "local" instance of payara right?
No no no that is all ancient history
So it should be 4949?
On 4848 is a little proxy that makes SSL go away so the Payara Tools work
So please stick to the guide and use 4848 :blush:
Question regarding the guides
The Postgres thing should be independent from IntelliJ. I saw this on CLI, too
On the step 4 it says "NOTE: You might need to change the Docker Compose executable in your IDE settings to docker if you have no docker-compose bin (File > Settings > Build > Docker > Tools)."
I am on MacOS
And the menu doesn't show settings under File
Simply try docker compose on the CLI. If you can execute docker-compose you're fine.
Actually to find the configurations had to go trough Run > Edit Configurations
If it's docker compose only, you need to change the setting
It should be a global setting, too. Just go to settings and use the search bar to filter for Docker.
Oh but I was just never able to find that option so I was wondering if this was a difference because the version of the OS or the IDE or I was just looking at the wrong place, like "File > Settings > Build > Docker > Tools" just doesn't exist for me
I was able to run it and get the configuration with the hot swap
but I was wondering if this is something we need to update or change or I was just looking at the wrong side
Maybe. I'm on Linux, that might be having a different menu layout
I think this is the equivalent on Mac
No, that's run configs
These are the same on every OS
Is there a menu under the IntelliJ entry in the menu?
Yes!
I bet a dollar there's a settings menu entry
There we go :grinning_face_with_smiling_eyes:
Should I add a quick edit there to add this? :thinking:
Sure. Not sure what the best way for that would be
NOTE: You might need to change the Docker Compose executable in your IDE settings to docker if you have no docker-compose bin File > Settings > Build > Docker > Tools or IntelliJ IDEA > Settings > Build > Docker > Tools (if you are on MacOS)
How about that
Hmm... maybe it should be splitted ? The path is the same once you're in the settings
The only difference is how to get there
How about
NOTE: You might need to change the Docker Compose executable in your IDE settings to docker if you have no docker-compose bin, Start from the File menu if you are on Linux or IntelliJ IDEA on Mac and then go to Settings > Build > Docker > Tools.
We could add Windows, too. I suppose it will be under File, too.
Aside from that I like it
I have to test that on windows :rolling_on_the_floor_laughing:
Oh so you're no longer our Windows and VsCode man then?
I use Windows for personal use :smile:
Haha same here :laughing:
Gaming and content creation
I wanted to see if following the intellij and NetBeans guide could shed some light and help me find my way to make this work on VS Code lol
What do you play @Oliver Bertuch ?
I see! Splendid idea!
Juan Pablo Tosca Villanueva said:
What do you play Oliver Bertuch ?
Let's move that to a non public channel or at least a different topic in #community :grinning_face_with_smiling_eyes:
Me always getting off-topic :rolling_on_the_floor_laughing: classic
Ok I just checked, it is under File on windows
I spent a lot of time with vs-code today and no luck :(
That's a real bummer!
Oliver Bertuch said:
Not sure when you tested with Postgres 16, but I had that before as well.
This is on the pom.xml for the ct profile so I wonder why IJ takes the 13 :thinking:
<postgresql.server.version>16</postgresql.server.version>
Ok so I found the problem and a possible solution, you guys will let me know (Or @Oliver Bertuch since he is probably the one that uses IJ the most :rolling_on_the_floor_laughing: ) It seems to me that since this configuration utilizes directly the compose file and the PG version variable comes from the pom.xml which is processed by the mvn docker pluggin. The solution I found was this:
Adding POSTGRES_VERSION=16 to the env variables makes and PG is running on 16, this works for me but since I am not the author of the guide I am not sure 100% if I missed something or if we should add this to the guide
(I am writing this as I triple check the guide that I didn't missed this somewhere) :laughing:
No probably we overlooked sth somewhere else.
Ok I sent a PR, thanks :smile:
Philip Durbin said:
I am having trouble getting
-Dapp.deploy.skipto work though. Maybe I'll try the env var.
I'm using mvn -Pct docker:run -Dapp.skipDeploy and it works fine. I'm not sure if it's because it was renamed or what, but it works great. A real time saver.
Great! Should we resolve this topic? There are documentation bits for this :smile: https://guides.dataverse.org/en/latest/container/base-image.html#tunables has SKIP_DEPLOY and https://guides.dataverse.org/en/latest/container/dev-usage.html#ide-trigger-code-deploy mentions the Maven property :innocent:
Sure, resolving. Everyone should feel free to open fresh topics.
Philip Durbin has marked this topic as resolved.
Last updated: Oct 30 2025 at 05:14 UTC