> For the complete documentation index, see [llms.txt](https://ldsec.gitbook.io/medco-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ldsec.gitbook.io/medco-documentation/v0.2.1/system-administrator-guide/deployment/local-development-deployment.md).

# Local Development Deployment

Profile *dev-local-3nodes*

This deployment profile deploys 3 MedCo nodes on a single machine for development purposes. It is meant to be used only on your local machine, i.e. `localhost`. The tags of the docker images used are all *dev*, i.e. the ones built from the development version of the different source codes. They are available either through Docker Hub, or built locally.

### MedCo Stack Deployment (except Glowing Bear)

First step is to clone the `medco-deployment` repository with the correct branch. This example gets the data in the home directory of the current user, but that can be changed.

```
$ cd ~
$ git clone -b dev https://github.com/ldsec/medco-deployment.git
```

Next step is to build the docker images:

```
$ cd ~/medco-deployment/compose-profiles/dev-local-3nodes
$ docker-compose build
```

Note that instead of building the *dev* docker images locally, it is possible to download them from Docker Hub by using `docker-compose pull`, but there is no guarantee on the current status of those images are they are automatically built.

Next step is to run the nodes. They will run simultaneously, and the logs of the running containers will maintain the console captive. No configuration changes are needed in this scenario before running the nodes. To run them:

```
$ docker-compose up
```

Wait some time for the initialization of the containers to be done (up to the message: *“i2b2-medco-srv… - Started x of y services (z services are lazy, passive or on-demand)”*), this can take up to 10 minutes. For the subsequent runs, the startup will be faster.

### Glowing Bear Deployment

First step is to clone the `glowing-bear` repository with the correct branch.

```
$ cd ~
$ git clone -b dev https://github.com/ldsec/glowing-bear-medco.git
```

Glowing Bear is deployed separately for development, as we use its convenient live development server:

```
$ cd ~/glowing-bear-medco/deployment
$ docker-compose up dev-server
```

Note that the first run will take a significant time in order to build everything.

In order to stop the containers, simply hit `Ctrl+C` in all the active windows.

### Keycloak Configuration

Follow the instructions from [Keycloak Configuration](/medco-documentation/v0.2.1/system-administrator-guide/configuration/keycloak-configuration.md) to be able to use Glowing Bear.

### Test the deployment

In order to test that the development deployment of MedCo is working, access Glowing Bear in your web browser at `http://localhost:4200` and use the credentials previously configured during the [Keycloak Configuration](/medco-documentation/v0.2.1/system-administrator-guide/configuration/keycloak-configuration.md). If you are new to Glowing Bear you can watch the [Glowing Bear user interface walkthrough](https://glowingbear.app/) video.

By default MedCo loads a specific test data, refer to [Description of the default test data](https://medco.epfl.ch/documentation/developer/test_data_description.html#lbl-test-data-description) for expected results to queries. To load a dataset, follow the guide [Loading Data](/medco-documentation/v0.2.1/system-administrator-guide/loading-data.md). For reference, the database address (host) to use during loading is `localhost:5432` and the databases `i2b2medcosrv0`, `i2b2medcosrv1` and `i2b2medcosrv2`.
