Files
streamline-emr/README.md
T
alec.turner 04cbf6b1af Reimplement scripts to support multiple app instances
An additional config file `instances.conf` is added to define instance names and
port numbers. The existing `app.conf` was also modified to include an
`instances` field and to move node id and location under this new object. A
`.env` file is used to manage configuration for each instance.

Additional scripts are added: `start`, `stop`, `monitor` - see docs for
description. The main entry script is also modified such that it will run until
any service stops, then brings down the remaining services and exits.
2024-03-08 12:29:37 -08:00

3.3 KiB

Streamline EMR

Packaging and installation tools for Streamline's "Streamline EMR" application.

Building

  1. ensure you have docker access to this project's container registry on GitLab
  2. run package.sh to generate a new application package
  3. package will be stored to build-packages/

Installing

  1. extract the generated archive file in a temporary folder on the target system
  2. run install.sh

Running

Production (systemd)

On a production system, systemd will manage the lifecycle of the application, e.g.

# enable and start the the application service
systemctl daemon-reload
systemctl enable streamline-emr
systemctl start streamline-emr

# stop the application service
systemctl stop streamline-emr

# restart the application service
systemctl restart streamline-emr

Docker

In a docker environment, the application must be started manually. This is done by running the entry script, for example:

/var/signalytic/clientapps/streamline/streamline-emr/entry

Note that the entry script will block until the first service stops or until interrupted.

If multiple instances are run from the same machine, additional configuration may be required to differentiate the instances. This is generally the case when using the "sibling container" method for running docker from within a docker container. See the Configuration section for more details.

Configuration

Certain configuration options can be adjusted by setting environment variables or by defining these variables in a .env file stored in the same directory as the docker-compose.yml file. These variables are: APP_PORT: port mapping for the web app server CONTAINER_NAME: name of the application container DATA_DIR: directory to be mounted for peristent data COMPOSE_PROJECT_NAME: assign the project name associate with the compose file - this avoids conflicts when the "same" compose file is used to manage multiple instances (e.g. when using docker sibling containers) IMAGE: optional, overrides the default streamline-emr:2.0 image

Each instance of the app uses its own .env file to specify its configuration. This is automated through the start script using information stored in a file instances.conf. This file defines two lists: INSTANCES: a list of unique instance names APP_PORTS: a corresponding list of port numbers to map to the local host

Important note when using "sibling containers": the sibling container method uses the host docker socket to provide containers with access to docker. As a result, port mappings and volumne mount points all refer to the host system rather than the container from which the docker command originates.

App Configuration

An app.conf file is required for integration with other Signalytic services. A template is provided which demonstrates integration with the dbsync service.

Scripts

Several scripts are used to manage app instances, including: entry: main entry script used to start all configured instances - does not return until a service stops or the process is interrupted. start: loads configuration details from instances.conf, then configures and starts each application instance in a dedicated subfolder stop: locates and stops all instances, even if no longer defined in instances.conf monitor: checks the status of each instance service and sends data to bgsystemlog if possible (loc: streamline_emr)