Quick Start Guide
Resources links:
Frontend GitHub Repository: https://github.com/CafeVariomeUoL/cv3-frontend/
Backend GitHub Repository: https://github.com/CafeVariomeUoL/cv3-backend/
Hosted precompiled releases:
Cafe Variome V3 (CV3 for short) is an open-source web application for data discovery on healthcare and medical data, so you can either try out our demo or deploy it onto your server. Here are the basic steps on how:
Prerequisite
To deploy a working copy of CV3, you will need:
An HTTP server or load balancer (Apache, Nginx, etc.)
Python environment, 3.11+
A reachable instance of MongoDB
A reachable instance of Redis
A reachable instance of KeyCloak
A reachable instance of Hashicorp Vault
Correct permission to copy the files, configure the server and database, install and run Python packages, etc. The deployment itself does not require root privileges, but you might need them to configure the file server. Contact your system admin if you require further assistance with user privileges.
There is also a copy of example Apache configuration file in the backend repository, which can be used as a reference for setting up the reverse proxy. It is located at resources/cafevariome.conf
.
Deploy with source code
Deploying the front end as a web app
The front end consists of 3 Flutter application, written with a cross-platform programming framework developed by Google. It can be compiled to run on desktop systems, but here we will cover only the web deployment.
The easiest option is to **Deploy it from release **. We provide periodical releases on major version updates and essential bug/security fixes, and they can be used directly as static web apps. To deploy from releases, download from the GitHub release section, and follow the README.md
provided within the release. Here is a brief summary:
Basically, you need to modify the config files (located at assets/assets/config.json
for each app) and callback
files to point to correct addresses. During compiling, each component has been assigned a subpath, and has to be followed when deploying it. By default, we assume that the entire folder is placed under a domain root. This means that, for a domain of www.example.com
:
The admin interface will be at
www.example.com
The record level discovery interface will be at
www.example.com/discover
The metadata discovery interface will be at
www.example.com/meta-discover
To change this behavior, you would need to recompile the release with correct parameters.
Compiling from source
The frontend can be compiled from the latest commits or the source file of a release. The dependency is:
Flutter SDK 3.22.0 or later
Internet connection for downloading
pub
packages
After installing the SDK, a release can be built by running the shell script build-release-web.sh
to build it with default parameters (which results in the same application as our release), or by running the following commands manually in project root:
Note that the preceeding and traling slash /
in the --base-href
parameter is important, Flutter needs them to correctly replace the paths in the compiled web app.
The compiled web app will be in the build/web
directory for each app. You can then move them to the correct location on your server.
Deploying the backend
The backend consists of 9 components, and not all are mandatory. You can select which one to run based on your requirements. For the details on what each component does, refer to the backend documentation. Here we assume you need everything.
The first thing you need is to install dependencies with pip. Run the following command in the downloaded source folder (with Python and pip available in PATH, you may need to activate the conda environment beforehand):
Then, to run each component from source, you need a configuration file in each component's folder. They can be exactly the same in content, or different, based on your requirements. The configuration file is a JSON file, and the default name is instance_config.json
. Then, before you can run the backend, you need to export credentials of the Vault into environment variables:
The backend also provides a CLI tool for managing the instance, including initializing the database, etc. It's recommended to use the CLI to initialize the database before running it. To use it, run the following command in the Backend Project Folder:
In the interactive shell, type install
, and follow the instructions.
The CLI has interactive prompts and input pop ups that guide you through the installation process. Now, the backend is ready to be started. There is a **Process manager ** to manage each components by guarding their process and start/stop them accordingly. We provided a simple script to manage the backend process, with startup check and graceful shutdown:
To modify the startup config like port number, you may override them as environment variables. Refer to the backend documentation for more details.
Deploy with precompiled release
We provide packaged release for backend on X86-64 Linux systems and frontend for web platform. They can be downloaded from our hosted repository, and each contain a README.md
for detailed usage instructions. To use Cafe Variome from compiled release, follow the simplified steps below:
Deploy with Docker
We maintain a series of docker images for CV3, including the front end and the backend. They are hosted in our Docker Hub. Note that the other required services, such as vault, KeyCloak or MongoDB, are not included in the image, and you will need to provide and configure them separately.
The main Cafe Variome V3 repository contains 2 docker compose files and a series of configuration files that can be used to quickly deploy the system. Here are the content of the two docker compose files, and what they do:
docker-compose.dependencies.yaml
This is the docker compose file to start the dependent services, such as MongoDB, Redis, Vault, and KeyCloak. These services are usually managed by the cloud provider if using a cloud, so use of this file may not always be necessary. If using it, this stack needs to be started first, and the credentials have to be created in advance and provided to the services. Refer to the Dependent Service Configuration for more details.
Several points worth noting:
The KeyCloak server is configured to start as a dev server in this stack, and the database is set to MariaDB. This is to facilitate the easy debugging and run it with minimal configuration. When using in production environment, do not use the dev mode, instead refer to Keycloak documentation on how to configure it properly.
Remember to change the Keycloak admin password and the database password to something secure.
The vault is using file storage backend and has TLS disabled. This is also for development environment only. When using on production server, it's recommended to use vault with high availability cluster. If this is not an option, you should at least use a production storage backend (like MySQL) and enable TLS.
You may add or modify configurations, use a different version of the image, etc. as you see fit. The provided configuration is a minimal working example. As long as the services have compatible API, the version should not matter.
docker-compose.cv.yaml
This is the docker compose file to start the Cafe Variome V3 backend and frontend. It does not contain any dependent services, and you may use it with or without the docker-compose.dependencies.yaml
stack, as long as all the services are in place.
Several points worth noting:
3 of the containers are commented out. They are the ones that common deployment would not require. For the active configurations, not all are necessary either. Refer to the document of each component to see what they do, if they are optional, and if you should use it.
The
cv3-backend-database-manager
container has extra environment variables. These are used to initialize the system without using the CLI utility. If you already have a database initialized, you do not need to supply these variables. After the first run, you may safely remove them.The
cv3-backend-exporter
does not require credentials.All backend containers are started to use host network mode. This is so that they can connect to the services running on
localhost
. If your databases are running with a different hostname or domain (such as in a cloud environment), it's recommended not to use host network mode. If so, the reverse proxy container no longer needs to be in host network mode either.