8 - Executing

This step is optional if you are at course week 3. Executing node applications will be important when you put the assignment B1 into production. You can skip this step until then.

In this step we will be looking at running applications on our CSCloud machine using docker.

1 - Install Docker

Start by following this guide to install the latest version: https://docs.docker.com/engine/install/ubuntu/

Choose: “Install using repository” för processor “x86_64 / amd64"

Now, we want docker to be executed by the ubuntu user and not root:

Log in and out agin to make sure that the permissions are set.

Now you should be able to run docker on your ubuntu machine:

…or from your local machine using the -H flag:

You need to replace the IP number to the IP of your ubuntu machine.

2 - Start the application

The last step is to start PM2 using the correct environment variables.

You can create a separate configuration file for PM2 to make this easier. More information about that here: https://pm2.io/docs/runtime/best-practices/environment-variables/

  • ❗️ If you copy new files into your application, you need to restart PM2!
  • ❗️ If you use more environment variables you need to add them above.
  • ❗️ You will get an warning saying that sessions should not be stored in Memory. We can ignore that for now.