Skip to content

zForDevelopers – Deployment

mossy426 edited this page Jul 28, 2021 · 1 revision

MicrobeTrace

Please note that this page is for developers and system administrators, and likely does not contain any information relevant to users of MicrobeTrace.

MicrobeTrace is designed to be an easy-to-deploy, client-side application. To set it up, simply clone the repository (or download the files) into a served directory, and you're done!

That said, MicrobeTrace also includes its own server. This server provides you with the added advantage of being able to serve MicrobeTrace's assets using gzip or brotli compression, substantially reducing the amount of bandwidth required to load MicrobeTrace. To set MicrobeTrace to leverage this, do the following:

# 1. Clone MicrobeTrace

git clone https://github.com/CDCgov/MicrobeTrace.git && cd MicrobeTrace

# 2. Download Dependencies

npm install

# 3. Create compressed versions of relevant files.

npm run compress

# 4. Start the server

npm start

You should now be able to access your MicrobeTrace instance by visiting http://localhost:5000/ You can subsequently configure a reverse proxy to integrate the MicrobeTrace server into your existing server stack.

Note for Windows users: dist folder files [common.js, index.js, main.css] uses symbolic links or symlinks as a shortcut to the actual file. You will have to manually move the contents of the src/[common.js, index.js, main.css] to dist/[common.js, index.js, main.css] to get MicrobeTrace to work properly.

Deploying to Heroku

The development instance of MicrobeTrace is currently served from Heroku, following the dev branch of the repository. If you'd like to mirror this architecture for your own instance of MicrobeTrace, simply:

  1. Fork this Repository.
  2. Create a new Heroku App.
  3. Point the Heroku app to your fork of the MicrobeTrace Repo.
  4. Set Heroku to update automatically whenever whateveryourbranchis is updated.

And you're done. Good job!

Deploying to S3

Deploying to S3 is a pain in the neck if you don't have the AWSCLI installed, so do us all a favor and get that set up first. Also, create a bucket from which to serve the files. Then, from the MicrobeTrace directory,

aws s3 cp s3://<your-bucket>/ * -R

As soon as the upload is complete, your MicrobeTrace instance should be available at http://<your-bucket>.s3-website-<AWS-region>.amazonaws.com

Note that this won't update like a heroku deployment will (there is not enough room on this wikipage to explain how to set up that architecture).

Deploying with Docker

MicrobeTrace includes a Dockerfile. To deploy into a docker environment, you should be able to simply clone the repo (see above) and run the following commands:

docker build -t microbetrace .
docker run -p 5000:5000 -d microbetrace
Clone this wiki locally