How to deploy a web application to Spinup Container Service

Objective

In this how-to article, we’ll walk through a real-life example of deploying a web application in the container service in Spinup.

Introduction

A container service comprises one or more related application components packaged as Docker containers hosted in Amazon Elastic Container Services (ECS). These component containers may access each other but not containers belonging to other container services. A virtual network interface is assigned to a container service to provide ingress and egress to the container service.

In Yale Spinup, this virtual network interface is assigned a private IP address. In order to be granted public access, an AWS load balancer and rule must be created to route traffic to the private IP address.

We’ll deploy NocoDB (https://docs.nocodb.com/). This application provides a user interface to commonly used database systems without requiring coding expertise on the part of the database owner. We will deploy this application from its public Docker repository to AWS ECS using Spinup.


  1. First, let’s choose a database (in our case I’ll create a Serverless MySQL):

  1. Specify the required parameters and click Create database (write down the username and password first):

It will take a few minutes for the database to be fully provisioned. When it’s ready, note the Endpoint URL as we’ll need that to connect in the step below. In our case it’s spinup-db0018a4.cluster-c9ukc6s0rmbg.us-east-1.rds.amazonaws.com

  1. Next, we need to create a secret parameter which will be used by the container service - go to the Secrets tab in the space:

The secret in this example is specific to the Nocodb app and will be different for other apps (usually some variable that tells how the app can connect to the database).

The secret in this case is NC_DB - it needs to be in the following format (just replace ENDPOINT, USER, PASSWORD, DBNAME with your specific values):
mysql2://ENDPOINT:3306?u=USER&p=PASSWORD&d=DBNAME

  1. Choose the Container Service option inside Spinup

  1. In the first tab, enter the name and size of your container:

  2. The second tab is where the majority of the configuration happens.

    1. Enter a name for the container (e.g. nocodb)

    2. Edit the Image section and enter the name of the Docker image (e.g. nocodb/nocodb), then click the checkmark to save it

    3. Edit the Port section and add a TCP port (e.g. 8080) - this is the port that the Docker container is configured to listen on (you may have to consult the Dockerfile to determine what it is). Click the checkmark to save.

    4. Edit the Secret Environment Variables sections and add a secret (e.g. NC_DB) that maps to the secret we added earlier - this will expose it as a variable in the container. Click the checkmark to save.

  3. We are finished with the container configuration, so click Add Container at the bottom - this will take to the top of the page - click Summary to proceed.

  1. On the last tab just review to make sure the details look like what you expect and click Create Service

  1. Spinup starts deploying the container and you will see the management page for the container service - you will know when it’s ready when the yellow dot in the upper left corner turns green.

  1. Navigate to the Firewall tab for your space. You will notice that by default the only ports allowed are 22 and 3389 for administrator access. Click Add rule to open another port.

  1. Select Other (custom) from the Service drop-down, then enter the port number (e.g. 8080) and click the Anywhere toggle to allow access from anywhere on campus. Click Add rule and after a few seconds you should see it in the list of open ports.

 

If everything worked, you should now be able to access the app from a web browser using the Endpoint of the Container Service and the specified port: http://<ENDPOINT>:8080.

In our example we can do that at http://spinup-0018a5-nocodbexample.svc.spinup.yale.edu:8080.