Skip to content

Build the GWT UI using Docker and run it from docker-compose alongside the Angular UI#26

Merged
jtnystrom merged 20 commits intomasterfrom
jtnystrom/docker-gwt
Dec 1, 2025
Merged

Build the GWT UI using Docker and run it from docker-compose alongside the Angular UI#26
jtnystrom merged 20 commits intomasterfrom
jtnystrom/docker-gwt

Conversation

@jtnystrom
Copy link
Copy Markdown
Contributor

@jtnystrom jtnystrom commented Nov 20, 2025

The GWT application has long been running on an outdated machine, and there is a continued need for it, so it is high time to migrate it to the new machine where the Angular application runs. However, the build and deploy process had not been fully captured and automated until now. This PR aims to bring the GWT application into the docker-compose system that we use to manage and deploy the Angular/Scalatra application.

This PR does the following:

  1. Builds the GWT application using Docker, and copies it into a self contained docker image containing Tomcat 9 (tomcat:9-jre21-temurin-jammy). This makes the GWT application easy to compile, deploy and migrate. This Tomcat reads environment variables to configure the web app on startup, instead of hardcoding the configuration in web.xml. This means that the GWT application can be configured from docker-compose-prod.yml, just like scalatra is, using the same environment variables.

  2. Runs the resulting "toxygates-gwt" service alongside the others in Docker compose, connecting to the same fuseki instance. The service can then be reverse proxied behind nginx (part of the node service), in the same way that scalatra is currently proxied, to be reachable on the standard HTTPS port for a specific set of URL patterns.

  3. Configures a complete environment in docker-compose-prod.yml with all services needed for both the Angular and GWT applications: fuseki, db, fusionauth, scalatra, toxygates-gwt.

yujiberra and others added 11 commits March 5, 2023 10:15
Make angular/nginx/conf.d configurable in docker-compose, so that we can track different configurations for production and for development use.
In conf.d/default (for development use), provide a reverse proxy for /json so that angular can talk to scalatra.
In conf.d.prod/default, additionally provide a reverse proxy for fusionauth, so that fusionauth and node can live on
the same port and server, separated only by the domain name in the request.
…Docker image.

Add this to docker-compose-prod.yml as toxygates-gwt, so that the GWT application can run alongside scalatra and connect to the same fuseki instance.
Change deploy.sh to primarily create wars for this Docker mode of deployment (the old system with new_instance and delete_instance is deprecated).
Correctly set repositoryUser and repositoryPassword in web.xml.admin.
Let the toxygates-gwt image be built from docker-compose-prod.yml.
@jtnystrom
Copy link
Copy Markdown
Contributor Author

A live deployment on the new machine can be seen in action here:

https://panomicon.nibn.go.jp/toxygates/

Copy link
Copy Markdown
Contributor

@yujiberra yujiberra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtnystrom
Thanks for your work on this! I just took a quick look through and made some comments, mainly about configuration as well as more minor stuff.

In addition I wanted to ask two questions:

  1. Are web.xml.template and web.xml.template_nibiohn still being used? I noticed they have a lot of hardcoded values, where a lot of equivalent ones have been factored out in web.xml.docker
  2. How does the production conf.d for nginx get used during deployment? I got the impression that the angular Dockerfile only refers to the non-production conf.d, but maybe I missed something

ivy.xml Outdated
(The 'ant ivyreport' task may be used to inspect the dependency graph.)
SLF4J is our preferred logging framework. -->
<!-- <dependency org="org.slf4j" name="log4j-over-slf4j" rev="latest.integration" /> -->
<!-- <dependency org="org.slf4j" name="log4j-over-slf4j" rev="latest.integration" /> -->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nits]
The indentation fix is good but it looks like an extra space got added at the end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will adjust

Comment on lines +21 to +24
# location = / {
# try_files /index.html =404;
# }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this could be deleted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'ENTER_GOOGLE_ANALYTICS_TRACKING_ID_HERE', 'auto');
ga('create', 'UA-98828705-4', 'auto');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to bring this in from an environment variable rather than hardcoding it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I will push this to future work since the process to generate this file would be somewhat complex.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's not urgent, but couldn't you just use sed or something in the Dockerfile?

-->

<role rolename="toxygates-test"/>
<user username="admin" password="secret password" roles="toxygates-test"/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this username/password for? Depending on what it's for, might be better to have it be configurable through environment variables or some other method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The username/password here are dummies, just intended to make it obvious how to use the file (will add a comment about this). When I deploy currently I use a private branch where the actual password is kept. I agree that env var's are better if this file can read them (like web.xml does) - will try.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Another option, if the file doesn't directly read environment variables (and I suspect it won't) will be to do text replacement in the Dockerfile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean with something like sed? Yes, maybe that's the best option after all to gather the configuration in one place

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's basically what I was thinking

@@ -0,0 +1,10 @@
version: "3.4"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this file was just created for testing the Dockerfile during development? If so it might not be necessary anymore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it might be better to remove this and make docker-compose-prod.yml the only one (and rename it to docker-compose.yml). This is as you say a legacy thing of the development process.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have unified the two files now under then name docker-compose.yml.

Copy link
Copy Markdown
Contributor

@yujiberra yujiberra Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait no, I was specifically saying that this file, /angular/docker-compose.yml seemed unnecessary, but it still exists, and you deleted /docker-compose.yml, which had a useful purpose.

Specifically, it could be used to run FusionAuth and Fuseki in containers while running Scalatra and Angular directly during development, but now there's no convenient way to do that.

@jtnystrom
Copy link
Copy Markdown
Contributor Author

jtnystrom commented Nov 28, 2025

Thanks for your review.
I have removed the two web.xml template files. This system of creating/deleting instances interactively is now obsolete.

The nginx conf.d.prod gets used in production since it's hardcoded (in docker-compose.yml) in a special branch that I use for deployment. I might change this system in the future. (Of course we would ideally have no such special branch at all, and we may get there eventually)

@yujiberra
Copy link
Copy Markdown
Contributor

yujiberra commented Dec 1, 2025

@jtnystrom
Thanks for the additional work!

Deleting the two web.xml files sounds good, and I responded to your other comments. Regarding the following,

The nginx conf.d.prod gets used in production since it's hardcoded (in docker-compose.yml) in a special branch that I use for deployment. I might change this system in the future. (Of course we would ideally have no such special branch at all, and we may get there eventually)

as I mentioned in https://github.com/Toxygates/Panomicon/pull/26/files#r2575355210 there wasn't really a need to delete /docker-compose.yml, so why not have conf.d.prod hardcoded in /docker-compose-prod.yml?
I mean I guess you use the non-prod conf.d for local testing of the deployment procedure.

Anyway it's a bit confusing that we have conf.d vs conf.d.prod and (well, not any more since you deleted it but since I'm suggesting that you un-delete it) docker-compose.yml vs docker-compose.prod.yml even though both conf.ds are used only with the latter docker-compose file.

@jtnystrom
Copy link
Copy Markdown
Contributor Author

Thanks for your comments, and sorry I got confused initially about what you meant. I have done the following as we discussed:

  • Restored docker-compose-prod.yml and docker-compose.yml the way they were as two separate files, but made one extend services in the other, to avoid duplication, since one of them was now just a superset of the other
  • Removed conf.d.prod and instead created conf.d/default-nibn so that the docker-compose volume mapping doesn't have to change

Copy link
Copy Markdown
Contributor

@yujiberra yujiberra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtnystrom
Thanks for all the changes!
I think it looks good now but maybe we can wait until after you use this latest version to do an actual deployment before you merge? Or are you sufficiently happy with the testing you've done already?

@jtnystrom
Copy link
Copy Markdown
Contributor Author

Thanks, I agree, will do an actual test with these changes before I merge.

Copy link
Copy Markdown
Contributor

@yujiberra yujiberra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been informed that a deployment has been done with these changes and that there weren't any problems.
LGTM!

@jtnystrom
Copy link
Copy Markdown
Contributor Author

Thanks for your review and input!

@jtnystrom jtnystrom merged commit 88577c0 into master Dec 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants