Skip to content

Points of configuration

Bill Majurski edited this page Sep 15, 2019 · 7 revisions

Right now there are many things that have to be configured. This page documents them. Most of these should go away before we deliver the code to users. It also documents the current development environment. These two topics overlap heavily.

Tomcat on port 8080

This houses the HAPI FHIR server and XDS Toolkit. These need to be referenced and keeping them out of the Tomcat holding code under development speeds up development.

The External Cache is at /home/bill/ec for me on Linux and at /Users/bill/ec for me on Mac. This path is stored in the toolkit.properties file at xdstools/WEB-INF/classes/toolkit.properties.

Servlet under development

This is the Proxy and the Test Engine at the moment. These are packaged in the asbestos-war module. I run this on port 8081 from the Tomcat runner inside IntelliJ. When creating this configuration the URL is http://localhost:8081/asbestos/ under the server tab and application context is /asbestos under the deployment tab. I target the asbestos-war:war exploded deployment item since it is faster to build.

In the web.xml (asbestos-war/src/main/webapp/WEB-INF/web.xml) there are several parameters coded under ProxyService: ExternalCache (see above) and port (8080) which align with the static Tomcat described above.

This servlet creates session variables from these initialization parameters and the other servlets in this WAR get these parameters through the session. Note, this is why the load-on-startup order is set the way it is. ProxyService is loaded first (to offer these parameters) and the rest load later.

View (asbestos-view)

This is the javascript module. It has library code in http-common.js (asbestos-view/src/common) that has

const port = '8081'

which references asbestos-war.

View (part 2)

I start asbestos-view by hand in a terminal window by:

cd asbestos-view
npm start serve

Doing this in a separate window makes it real obvious when some Javascript did not load correctly. This command grabs the first port available at or above 8080. I start this last so that it uses port 8082. When launching the UI in the browser I use http://localhost:8082.

Maven build

The maven build depends on Toolkit and HAPI also. The IT environment launches Jetty with these two servlets inside. It expects Toolkit and HAPI to be file system peers to Asbestos. On my machine I have a directory names develop which contains:

asbestos/
hapi-fhir/
toolkit2/

Toolkit is a standard download from GitHub built with Maven. Hapi-Fhir is downloaded and preconfigured. At the moment I copy this directory from machine to machine that I work on. I have posted a ZIP of my hapi-fhir directory on the releases page of this project. Also, the codes.xml file needs updating since some of the FHIR translations have been updated since the list release of toolkit. This file is also available in the releases page.

More on Maven build

The IT tests depend on the Java class ITConfig to pass on the the FHIR server port and the Proxy port. These are different for day-to-day development and IT tests because for the IT tests they are launched automatically from the pom.xml file. The key variable is

private static final boolean forMavenBuild = false;

I tend to not change this even for Maven builds. Instead, I launch the Proxy in IntelliJ and let the IT tests reference that. For day-to-day use it seems simpler than changing this file constantly. I live with the Proxy running in IntelliJ for my other work normally.

As we move towards release

A lot has to improve. HAPI, Toolkit, and asbestos-war will all be packaged in the same Tomcat so only one port to worry about there. I think the Javascript will be served out of its own port but I'm not sure. I haven't looked at the production environment for Vue yet.

Since most things will be on the same port, communicating that will be less of an issue.

We still have to configure Toolkit so I'm hoping we can have it publish its port and the location of the External Cache in session variables the way ProxyServlet does in development. That could mean configuring Toolkit and the rest rides along.

Other notes about the state of development right now

I recently renamed the appcontext for a few servlets. The big one is proxy. In the code now the proxy is addressed at /asbestos/proxy. There are IT tests that have an older location. I have not yet updated these.

Some users will have Toolkit and/or HAPI already installed. It would be good to link up to these existing elements instead of requiring new installations if possible.

Current state of the build

With all the above caveats, the maven build

cd asbestos
mvn clean install

succeeds.

Clone this wiki locally