9. Deployment - nhsconnect/nrls-reference-implementation GitHub Wiki

First follow the requirements as stated in the Repo README to set up your environment.

9.1 Local

Local deployment can be achieved directly on the local machine or through a local installation of Docker.

Firstly checkout a copy of the required branch from this repo.

If running with Docker:

  1. Install Docker, if not already done so
  2. Switch to Linux Containers
  3. Navigate to the root repo directory and run the build-run.sh file from the setup folder
  4. Navigate back to the root repo directory and run the cmd docker-compose up
  5. By default this will run in Production mode
  6. Done!

If running directly on your machine (see readme for details on installation requirements):

  1. Install MongoDB, if not already done so
  2. Run the run file from the \RepoRoot\Data\cmds folder
  3. Build and run the NRLS-API Solution
  4. Build and run the Demonstrator Solution
  5. On the command line, navigate to \RepoRoot\Demonstrator\Demonstrator.WebApp and run npm run build or npm run build:prod
  6. Done!

9.2 Docker on a Linux VM

  1. Login to the Linux VM via SSH
  2. Install Docker and Docker Compose, if not already done so
  3. CD to the root folder of nrlsrefimp
  4. Run sudo git pull to get the latest code
  5. CD to setup
  6. Run sudo chmod +x build.sh
  7. Run sudo chmod +x run.sh
  8. Run sudo ./build.sh to rebuild the images based on the new code and data pulled from GIT
  9. CD back to root folder nrlsrefimp
  10. Run docker-compose down to bring the systems down
  11. Run docker-compose up –d to bring the new images back online in detached mode.
  12. Check that the site is running
    12.1. It can take a few minutes for the DB to come back up
    12.2. If after 10 minutes you are not seeing data re-run steps 10 & 11.
  13. Done!
  14. Now type exit to leave SSH

9.3 Docker Issues

If you experience issues with docker not running correctly you may have an issue with disk space.

9.3.1 Old Images

You may have a lot of untagged images as a result of build errors, run:

sudo docker image ls

If you see a lot of untagged images taking up lots of disk space run:

sudo docker rmi $(sudo docker images -f "dangling=true" -q)

9.3.2 Old Containers

You may also have old containers too, run:

sudo docket ps –a

Any old containers can be removed with:

docker rm $(docker ps -a -q)

9.4 Manually update data

If you need to manually update data this can be achieved from the terminal as follows:

  1. Run sudo docker exec -ti nrlsmongodb sh
    a. You should be in the data directory
  2. Run cd cmds
  3. Run ./set_mongodb_data.sh
    a. This will re-run default data scripts b. You can make changes to the default data at any time and re-run the steps above to see the updates made
  4. That should be it.