Skip to content

Configuring the project

Caleb S edited this page Oct 6, 2022 · 3 revisions

Main Configuration file for production

This project can be configured by editing configuration.yml configuration.yml can exist anywhere on the host machine, but it must be mounted in the docker container at /app/configuration.yml and must follow yml formatting.

Because we use Spring Boot, the number of properties is very large, so only especially useful ones, or custom ones relating to this project are included here. Other files also contain configuration, but these are in the project directory which represent default behaviors and changes there "modify" the project which requires a rebuild even with 0 other code changes. Changes to configuration.yml do not require a rebuild, but do require a restart.

Configuration properties in configuration.yml

property description required default values
server.port the port the http(s) server will listen on 8443 number
org.itech.ahb.forward-astm-server.hostName The default address that HTTP requests will be forwarded to via ASTM localhost ip address or DNS entry (ie 127.0.0.1) To support multiple analyzers that speak ASTM, the http requests will need to send information that overrides this default
org.itech.ahb.forward-astm-server.port The default port that HTTP requests will be forwarded to via ASTM 12001 number
org.itech.ahb.listen-astm-server.port The port that this will listen on for ASTM requests to forward to the forward-http-server This is suggested to be kept as this value and mapped to a different port using docker port forwarding 12001 number
org.itech.ahb.forward-http-server.uri The uri that ASTM messages will be forwarded to as HTTP (ie OpenELIS path to that receives analyzer data) https://localhost:8443 uri
org.itech.ahb.forward-http-server.username The username for contacting forward-http-server (as HTTP Basic Auth) username
org.itech.ahb.forward-http-server.password The password for contacting forward-http-server (as HTTP Basic Auth) password

Environment Variable configuration

Environment variables can be passed to the docker image by editing docker-compose.yml and ensuring the service has an environment section

Configuration properties in docker-compose.yml

property description required default values
SPRING_PROFILE The profile spring is runing in prod prod, dev
JAVA_OPTS these are passed to the running java jar. Useful for specifying a truststore such as -Djavax.net.ssl.trustStore=/etc/truststore
server.ssl.keyStorePath The path to the keystore in the container * full file path
server.ssl.keyStorePassword The password to the keystore * password
server.ssl.keyStoreType The type of keystore JKS JKS, PKCS12

Example configuration.yml

org:
  itech:
    ahb:
      forward-astm-server:
        hostName: 10.0.0.103
        port: 12001 
      forward-http-server:
        uri: https://host.openelis.org:8443/OpenELIS-Global/analyzer/astm
        username: <oe-user-here>
        password: <oe-user-passowrd-here>
logging:
  level:
    root: INFO
    org.itech: DEBUG

Example docker-compose.yml (this was added to the docker-compose that openELIS uses so they could be in the same docker network)

           
    astm.openelis.org:
        container_name: astm-http-bridge 
        image: ctsteele/astm-http-bridge:latest
        ports:
            - "8442:8443" # the left value is where this will be listening for HTTPs messages to forward to analyzers
            - "12000:12001" # the left value is where this will be listening for ASTM messages to forward to OE
        volumes:
            - ./configuration.yml:/app/configuration.yml # the value on the left should point to the configuration file talked about above
            - /etc/openelis-global/truststore:/etc/truststore
            - /etc/openelis-global/keystore:/etc/keystore
        extra_hosts:
            - "host.openelis.org:10.0.0.101"
        environment:
            server.ssl.keyStorePath: /etc/keystore
            server.ssl.keyStorePassword: <keystore password>
            server.ssl.keyStoreType: PKCS12
            JAVA_OPTS: "-Djavax.net.ssl.trustStore=/etc/truststore
              -Djavax.net.ssl.trustStorePassword=<truststore password>
              -Djavax.net.ssl.trustStoreType=PKCS12"
        networks:
            - default
        logging:
            driver: "local"
            options:
              max-size: "20m"
              max-file: "50"
        healthcheck:
            test: ["CMD", "/app/healthcheck.sh"]
            timeout: 10s
            interval: 30s
            retries: 3
            start_period: 2m