Accessing the server for testing

How to access the server for testing

While testing on a local machine is fine for initial exploration, you may soon want to deploy the server on the cloud so that multiple developers have access to it.

For this purpose, we recommended running Ubuntu 22.04 on an AWS EC2 instance and then running the Docker image on that instance.

Some recommended instance types are c6i.2xlarge, r7iz.xlarge

You can also find comparable instances on other cloud providers.

After starting an EC2 instance, you can install Docker on that instance by following these instructions.

Then, you can run the Docker image in the same way that was detailed in a previous section (Starting the server).

However, once the server is running on the instance, you will need it to be accessible outside the instance so that developers can connect to it.

The Easy Way

After running the server, the easiest way to access it from outside the local machine/VM is to use ngrok.

To install ngrok, simply use:

sudo snap install ngrok

After installing ngrok, run:

ngrok http 7777

Once the ngrok client starts, it will show a line as:

Forwarding  https://87759f1f8410.ngrok.app -> http://localhost:7777 

Now you can access the live docs page via:

https://87759f1f8410.ngrok.app/docs

The Harder Way

If you started the server on an EC2 instance, you would need to open port 7777 in your security group.

This would enable you to access the server from outside the EC2 instance. However, it would be accessible only via http and not https and is therefore not recommended.

It is possible to set up an AWS Elastic Load Balancer with your EC2 instance(s) as a target(s).

This could enable you to set up SSL at the Load Balancer and redirect traffic to your instance via http.

Other deployment options such as ECS are also available.

However, such advanced configuration is left to a later stage.

If you need our help in deploying the solution to production, you can email us at support@seventhsense.ai