Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Commit

Permalink
Updated setup docs and release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlton Duffett committed Sep 30, 2016
1 parent 38341a1 commit ddad7a1
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 10 deletions.
6 changes: 3 additions & 3 deletions RELEASE.md
Expand Up @@ -23,7 +23,7 @@ Each release listed below should have the date and title of the release, followe
Releases
--------

**[2016-09-27] Initial Deployment**
**[2016-09-29] Initial Stable Deployment**

Our initial deployment to **syntheticmass-stg.mitre.org** and **syntheticmass.mitre.org** with the latest stable software versions.

Expand All @@ -33,6 +33,6 @@ PostgreSQL 9.5.4
Python 2.7.11+
Go 1.7
Node 5.11.0
github.com/synthetichealth/gofhir disable-interceptors c8eb42e
github.com/synthetichealth/syntheticmass master 267cee9
github.com/synthetichealth/gofhir fhir-updates 1654183
github.com/synthetichealth/syntheticmass master 38341a1
```
85 changes: 78 additions & 7 deletions setup/README.md
Expand Up @@ -15,6 +15,8 @@ Contents
* [Setup Synthetic Mass UI](#setup-the-synthetic-mass-ui)
* [Setup System Services](#setup-system-services)
* [Configure Apache Proxy](#configure-apache-proxy)
* [Migrate the Mongo Database](#migrate-the-mongo-database)
* [Migrate the Postgres Database](#migrate-the-postgres-database)

Software Installed
------------------
Expand Down Expand Up @@ -44,6 +46,8 @@ $ lsb_release -a

Working Behind the MITRE Proxy
------------------------------
**NOTE: This only applies to the dev and staging environments.**

I recommend you add the following to your `.bashrc` to quickly enable or disable the MITRE proxy settings:

```
Expand All @@ -69,7 +73,6 @@ setproxy

For most of this setup you will need to `http_proxy` and `https_proxy` set.

**NOTE:** When updating syntheticmass.mitre.org (the production site) the proxy should be **unset**.

Setup MongoDB
-------------
Expand Down Expand Up @@ -211,6 +214,8 @@ $ nvm install 5.11.0
Setup Database Schema
---------------------

**NOTE: This only needs to be performed for a NEW database setup. If you are migrating an existing database you can skip this step.**

All patient/condition statistics used by Synthetic Mass are stored in a series of Postgres tables in the `synth_ma` schema. There are a series of `.sql` files and scripts in the `pgstats` repository that should be used to setup the database.

First, clone the `pgstats` repository:
Expand Down Expand Up @@ -266,17 +271,17 @@ This can be fixed by installing `libsasl2-dev`:
$ sudo apt-get install libsasl2-dev
```

Next, checkout and build the `disable-interceptors` branch of GoFHIR:
Next, checkout and build the `fhir-updates` branch of GoFHIR:

```
$ cd $GOPATH/src/github.com/synthetichealth/gofhir
$ git checkout -b disable-interceptors
$ git branch -u origin/disable-interceptors disable-interceptors # set-up remote tracking
$ git checkout -b fhir-updates
$ git branch -u origin/fhir-updates fhir-updates # set-up remote tracking
$ git pull
$ go build
```

**NOTE:** While there are tests for the `gofhir/stats` package (containing the Data Access Layer interceptors) these interceptors are for an outdated version of the `synth_ma` schema and are therefore unusable at the moment. The `disable-interceptors` branch of this repository appropriately disables these interceptors.
**NOTE:** While there are tests for the `gofhir/stats` package (containing the Data Access Layer interceptors) these interceptors are for an outdated version of the `synth_ma` schema and are therefore unusable at the moment. The `fhir-updates` branch of this repository appropriately disables these interceptors.


Next, create a new directory to run GoFHIR out of:
Expand All @@ -295,13 +300,19 @@ $ sudo cp -r config /opt/gofhir
$ sudo cp -r conformance /opt/gofhir
```

You will need to modify `htc_run.sh` depending on what environment (dev, staging, production) you are running in. Set the `-server` flag to indicate the full URL path to the server root. For example, on staging this may look like:

```
$ ./gofhir -server https://syntheticmass-stg.mitre.org/fhir -pgurl ...
```

Setup the HTC API
-----------------
Clone the `syntheticmass` repository:

```
$ cd $HOME/synthetichealth/
$ sudo - E git clone https://github.com/synthetichealth/syntheticmass.git
$ sudo -E git clone https://github.com/synthetichealth/syntheticmass.git
```

This repository contains both the HTC API and the Synthetic Mass UI.
Expand Down Expand Up @@ -338,7 +349,13 @@ npm config set proxy http://<MITRE_proxy_server>:80
npm config set https-proxy http://<MITRE_proxy_server>:80
```

Which build to use depends on the current server (Staging or Production). For Staging, use:
Which build to use depends on the current environment (dev, staging or production). For dev, use:

```
$ npm run build-dev
```

For staging, use:

```
$ npm run build-stg
Expand Down Expand Up @@ -402,8 +419,11 @@ ServerAlias www.<host>.mitre.org
...
ProxyPreserveHost On
ProxyPass "/api" "http://localhost:8080/htc/api"
ProxyPassReverse "/api" "http://localhost:8080/htc/api"
ProxyPass "/fhir" "http://localhost:3001"
ProxyPassReverse "/fhir" "http://localhost:3001"
```
Expand Down Expand Up @@ -433,4 +453,55 @@ Check that the APIs are now accessible using a web browser:
```
$ curl https://<host>.mitre.org/api/v1 # the API root
$ curl https://<host>.mitre.org/fhir/metadata # the conformance statement
```

Migrating the Mongo Database
----------------------------

From your local home directory:

```
$ mongodump --out=./dump --gzip
```

This dumps the **ENTIRE** mongo database, including multiple databases if they exist, into the `dump/` folder. The `--gzip` flag significantly compresses the dump, making it easier to transfer.

Next copy the dump to your home directory in another environment:

```
$ scp -r ./dump/ <user>@<host>.mitre.org:/home/<user>/
```

Finally, from the directory that the dump was copied to:

```
$ mongorestore --gzip ./dump
```

The restore **does not** rebuild the indexes automatically. GoFHIR must be restarted to build the indexes anew.

Migrating the Postgres Database
-------------------------------

As user `postgres`:

```
$ sudo su - postgres
$ pg_dump -F c fhir > fhir.bak
```

This dumps the database in the `pg_dump` custom format into user `postgres`'s home directory (`/var/lib/postgresql/`).

Next, copy the dump to your home directory in another environment:

```
$ scp fhir.bak <user>@<host>.mitre.org:/home/<user>/
```

Finally, again as user `postgres`, perform the restore:

```
$ sudo su - postgres
$ cd /home/<user>/
$ pg_restore -d fhir -F c fhir.bak
```

0 comments on commit ddad7a1

Please sign in to comment.