> For the complete documentation index, see [llms.txt](https://spice.docs.medtroniclabs.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spice.docs.medtroniclabs.org/deploy/deployment-guide.md).

# Deployment Overview

This section explains how to deploy SPICE in your own environment: which pieces make up a SPICE installation, what they need, how to configure them and in which order to bring them up.

## Deployment options

SPICE is a set of containerised services plus a web application and an Android app. You can run it in any of the following ways.

| Option                                               | Best for                                                  | Notes                                                                                                                                                                                                                                       |
| ---------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Docker Compose** on a single machine               | Local development, evaluation, demos and small installs   | Fastest way to a working system. Not hardened for production. See [Docker Compose Install](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/docker-compose.md).                                                                 |
| **Container orchestration** (for example Kubernetes) | Production                                                | Each service is built as a container image, is configured through environment variables and is stateless (state lives in PostgreSQL, the cache, the message queue and object storage), so it scales horizontally and fits any orchestrator. |
| **Self-hosted on a major cloud provider**            | Production                                                | Run the containers on the provider's compute or container platform, with managed or self-hosted PostgreSQL, Redis-compatible cache, a message queue and object storage.                                                                     |
| **On-premise**                                       | Production where data must stay in-country or in-facility | The same container images and configuration; you provide PostgreSQL, cache, message queue, object storage and a reverse proxy with TLS.                                                                                                     |
| **Hosted as a service by Medtronic LABS**            | Partners who prefer not to operate the platform           | Medtronic LABS can host SPICE in the cloud or on-premise on behalf of partners. If you are interested, please reach out to <community@medtroniclabs.org>.                                                                                   |

Whichever option you choose, the services, settings and installation order are the same. Only the way you start the containers and provide the supporting services differs.

## What gets deployed

A SPICE installation consists of:

* **Backend services** (Java): authentication, users and organisations, clinical and administrative services, notifications, offline sync, a clinical-rules (CQL) service, a reporting service, and the FHIR mapper.
* **FHIR server**: a HAPI FHIR based server that stores the clinical data as FHIR resources.
* **Supporting services**: PostgreSQL, a cache (Redis), a message queue (RabbitMQ), object storage and a reverse proxy.
* **Web applications**: the admin/clinical web portal and, optionally, the reporting web application.
* **Android app** used by field and facility staff.

See [Components & Requirements](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/components-and-requirements.md) for the full list, what each unit does, which are stateful, and the software prerequisites.

## Recommended order of installation

1. **Plan and prepare.** Read [Components & Requirements](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/components-and-requirements.md) and decide where each component will run. Review [Sizing & Operations](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/sizing-and-operations.md).
2. **Try it locally (recommended).** Bring up the whole stack on one machine with [Docker Compose Install](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/docker-compose.md) to see how the pieces fit together.
3. **Provision supporting services.** PostgreSQL (three databases), Redis, RabbitMQ, object storage, DNS names and TLS certificates.
4. **Configure.** Prepare the environment variables and secrets for each service. See [Configuration](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/configuration.md).
5. **Deploy the FHIR server and mapper.** See [FHIR Server & Mapper](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/fhir-server-and-mapper.md).
6. **Deploy the backend services.** Start the user service first, because it creates and migrates the core database on startup, then the remaining services behind the reverse proxy. See [Backend Services](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/server.md).
7. **Deploy the web applications.** See [Web Applications](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/admin-portal.md).
8. **Load your data.** Administrative hierarchy, facilities, users and (optionally) legacy data. See [Data Import & Migration](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/data-import-and-migration.md).
9. **Build and distribute the Android app** pointed at your server. See [Mobile App](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/android.md).
10. **Verify and operate.** Check service health, set up backups, monitoring and log collection. See [Sizing & Operations](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/sizing-and-operations.md).

## In this section

| Page                                                                                                                     | What it covers                                                                |
| ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
| [Components & Requirements](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/components-and-requirements.md) | Deployable units, dependencies, software prerequisites, network and TLS needs |
| [Configuration](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/configuration.md)                           | How services are configured and the settings an implementer must set          |
| [Docker Compose Install](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/docker-compose.md)                 | Single-machine install for local, evaluation and small deployments            |
| [Backend Services](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/server.md)                               | Building and deploying the backend services                                   |
| [Web Applications](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/admin-portal.md)                         | Building and deploying the web applications                                   |
| [Mobile App](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/android.md)                                    | Building the Android app and pointing it at your server                       |
| [FHIR Server & Mapper](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/fhir-server-and-mapper.md)           | Deploying the FHIR server and the FHIR mapper                                 |
| [Data Import & Migration](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/data-import-and-migration.md)     | Loading master data and migrating existing data                               |
| [Sizing & Operations](https://spice.docs.medtroniclabs.org/deploy/deployment-guide/sizing-and-operations.md)             | Capacity planning, backups, monitoring and day-2 operations                   |
