This document explains how to install CodaLab and is an alternative to the more detailed user manual on the CodaLab Wiki. CodaLab is under active development, so the procedures here are subject to change.
Your first step is to decide which virtual machine or computer you want to install MedICI.
This tutorial focuses on Ubuntu-based installations on Azure, although instructions on how to do this on Microsoft and Apple operating systems and in AWS are also included.
Create a VM in Azure or use a computer with Ubuntu Server 18.04 installed. Once you have an Azure account, go to the Azure home page. A sidebar with many options or categories appears. You can create either a resource or a resource group and then add resources into it. This tutorial uses the resource group method to demonstrate good organizational practices.
Choose Ubuntu Server 18.04 LTS.
The VM creation page appears.
Choose the following settings.
We need to configure the machine to be ssh accessible (port 22) and open http (port 80) (https://medium.com/techinpieces/practical-azure-how-to-enable-ssh-on-azure-vm-84d8fba8103e). Go to the VM and click Networking. On the right find the button Add inbound port rule. Change Destination port ranges to 22, Protocol to TCP, Priority to 330, and Name to anything you’d like:
Once you have that let’s open a terminal and get inside the machine by typing $ ssh <user>@<public IP address>.
If you get a message regarding encryption keys, enter y\yes as this is the first time signing into this machine.
On the right find the button Add inbound port rule. Change the Destination port ranges to 80, Protocol to TCP, Priority to 300, and Name to anything you like.
This step is necessary to access the site once you deploy it.
CodaLab has documentation regarding their preferred installation configuration. The two best sources are the following:
The base code for CodaLab can be set up on different cloud providers (Google Cloud, AWS, Azure). The CodaLab team has made Docker images for AWS and Google cloud that in theory should just run once some settings are established, but require a good working knowledge of Docker. For the purposes of MedICI, it is recommended to follow the “Configure CodaLab from scratch (harder documentation)” procedure found in the first link above.
Before we do any github cloning we need to install docker and docker-compose. First docker:
This link details installing docker for Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/. For someone not familiar with linux there is a lot going on on that page.
So for a basic installation this is what I ran in order:
$ sudo apt-get remove docker docker-engine docker.io containerd runc $ sudo apt-get update $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo apt-key fingerprint 0EBFCD88 $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io $ sudo docker run hello-world |
The result shows on the following screen.
Now if we run ‘docker’, we should get the options list telling us how to use this command verifying it is installed and we can use it.
Next docker-compose. In the terminal on your new VM check to see if docker-compose is installed. If not which it is not for me then we need to install it. While it seems a ‘sudo apt install docker-compose’ should work, the CodaLab documentation from link “Configure CodaLab from scratch (harder documentation)” says to go here and install from dockers website. The command I’m actually running is this:
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
Now we have to change the permissions in /usr/local/bin/docker-compose to use it:
sudo chmod +x /usr/local/bin/docker-compose |
Now if we run ‘docker-compose’, we should get the options list telling us how to use this command verifying it is installed and we can use it.
The latest and greatest code is located here: https://github.com/codalab/codalab-competitions. Both sets of instructions want you to clone this repo locally to the VM. Before we get started I want to say since we will be making our own customizations down the road we will fork the repo CodaLab has so generously provided and do two things:
Clone the MedICI project. This follows CodaLabs instructions but with our github repo instead. Below is a picture of the commands I’ve executed from “Configure CodaLab from scratch (harder documentation)”. The green circles represent once inside the “src” folder, the changes that are not in the raw CodaLab github repo. This is the start of our customizations.
We can now push these changes into our branch.
At this point the app should be ready to deploy so we run ‘$ docker compose up -d’. However I have an error:
Turns out I needed to run with sudo or add myself to the docker group:
Or
The flag ‘-d’ means to run in detached mode. If you don’t use it you will notice your command prompt is in a live feed mode telling you everything that is going on with this docker.
Using this documentation( [2] from earlier): https://codalab-competitions.readthedocs.io/en/latest/
Below is the blob storage section for Azure:
You may sign up for an Azure account here, then follow the directions below.
This is the BLOB settings:
The CodaLab documentation leaves one final step out. We NEED to enable CORS. Click CORS in the above image and add these settings (https://stackoverflow.com/questions/50785255/azure-storage-got-403-url-cors-not-enabled-or-no-matching-rule-found-for-thi): If you don’t, uploading a competition will give you CORS errors in the browser: Once applied uploading works: |
Follow the Codalab instructions for creating a custom logo but note that you must be the super user to log in to the customizer. You must log in to the database as the super user. Django doesn’t have a super user by default, so you must create it. To do so, create a secure connection to your VM that hosts the site and run this command:
$ docker exec -it django python manage.py createsuperuser |
Now use CodaLabs instructions and navigate to http://your-instance.com/customizer.
Log in with the newly made credentials. Choose a new file to be your logo.