Build the GWT UI using Docker and run it from docker-compose alongside the Angular UI#26
Build the GWT UI using Docker and run it from docker-compose alongside the Angular UI#26
Conversation
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.
…-jre21-temurin-jammy
…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.
|
A live deployment on the new machine can be seen in action here: |
yujiberra
left a comment
There was a problem hiding this comment.
@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:
- 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
- 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" /> --> |
There was a problem hiding this comment.
[nits]
The indentation fix is good but it looks like an extra space got added at the end
There was a problem hiding this comment.
Thanks, will adjust
angular/nginx/conf.d/default
Outdated
| # location = / { | ||
| # try_files /index.html =404; | ||
| # } | ||
|
|
There was a problem hiding this comment.
Seems like this could be deleted?
| })(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'); |
There was a problem hiding this comment.
I think it would be better to bring this in from an environment variable rather than hardcoding it
There was a problem hiding this comment.
I agree, but I will push this to future work since the process to generate this file would be somewhat complex.
There was a problem hiding this comment.
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"/> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
You mean with something like sed? Yes, maybe that's the best option after all to gather the configuration in one place
There was a problem hiding this comment.
Yeah, that's basically what I was thinking
angular/docker-compose.yml
Outdated
| @@ -0,0 +1,10 @@ | |||
| version: "3.4" | |||
There was a problem hiding this comment.
I assume this file was just created for testing the Dockerfile during development? If so it might not be necessary anymore
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I have unified the two files now under then name docker-compose.yml.
There was a problem hiding this comment.
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.
…ormer to the latter name)
….xml.template_nibiohn
|
Thanks for your review. 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) |
|
@jtnystrom Deleting the two web.xml files sounds good, and I responded to your other comments. Regarding the following,
as I mentioned in https://github.com/Toxygates/Panomicon/pull/26/files#r2575355210 there wasn't really a need to delete Anyway it's a bit confusing that we have |
…ng the former to the latter name)" This reverts commit f5ca3dc.
…o avoid duplication of config
…ular/nginx/default.conf controls which configuration gets used.
|
Thanks for your comments, and sorry I got confused initially about what you meant. I have done the following as we discussed:
|
yujiberra
left a comment
There was a problem hiding this comment.
@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?
|
Thanks, I agree, will do an actual test with these changes before I merge. |
yujiberra
left a comment
There was a problem hiding this comment.
I've been informed that a deployment has been done with these changes and that there weren't any problems.
LGTM!
|
Thanks for your review and input! |
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:
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.
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.
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.