Skip to content

Deployment

Henry Burgess edited this page Mar 23, 2023 · 2 revisions

Deployment

Despite this solution primarily targeting online cognitive tasks, there are multiple use cases for deploying a server offline as well as online. The most likely use case is to deliver a cognitive task in-person rather than online. The documented prerequisites are not required for offline deployment or testing.

Offline deployment and testing

Run a docker compose command in the root directory of the repository to start the Docker containers:

$ docker compose up --build

After a brief start-up period, messages including the following should be visible in the terminal:

container-backend-1  | -- running Rserve in this R session (pid=1), 2 server(s) --
container-backend-1  | (This session will block until Rserve is shut down)

The server will be accessible at localhost/<endpoint>, <endpoint> being specified in config.yml and nginx.conf. Offline deployment is a way to test the functionality of the server prior to deploying the server online. It is encouraged to test the server behavior offline prior to online deployment, see the testing documentation for further information.

The specific details of the steps to deploy the server online vary depending on the target cloud computing platform, however the general process is identical.

While not an extensive list of functionality to test, test cases should examine:

  • Server response to invalid input (empty requests, invalid requests)
  • Server response to basic valid input
  • Server response to complex valid input

⚠️ Before you continue, ensure there are no issues operating the server offline.

Online deployment

ℹ️ This step varies depending on the selected cloud computing platform. Refer to resources provided by the platform for specific guidance to deploying and managing the Docker containers.

Deploy the Docker containers using the cloud computing platform resources. This may require linking a GitHub repository containing the server implementation to the platform or cloning the implementation directly onto the platform.

Some cloud computing platforms may support GitHub Actions to automatically deploy changes automatically.

⚠️ Before you continue, ensure the Docker containers start successfully on the cloud computing platform.

Domain name and static IP address configuration

ℹ️ This step varies depending on the selected cloud computing platform. Refer to resources provided by the platform for specific guidance to configuring static IP addresses and linking domain names.

After setting up the containers on the cloud computing platform, the static IP address should be configured to point to the container resources. Optionally, this can be tested by using Postman to send requests to the static IP address and verifying the response from the server.

The domain name should be configured to point to the static IP address. This can also be tested and verified using Postman.

⚠️ Before you continue, ensure the domain and endpoint successfully direct requests to the server.

Online testing

Postman can be used to test the server once steps 1-3 have been completed. Using Postman allows the test cases listed in step 1 to be run on the server once it has been deployed.

In addition to this testing, the server should be tested using the online cognitive task itself. The task should be able to communicate with the server and have no issues with CORS. See Integration for guidance on implementing communication between the task and the server.

⚠️ Before you continue, ensure the server and the online cognitive task communicate.

Clone this wiki locally