UCL-CloudLabs / user-portal

Front end user portal for CloudLabs
0 stars 0 forks source link

Explore using new Azure Container instances instead of VM+docker #22

Open raquelalegre opened 7 years ago

raquelalegre commented 7 years ago

At the moment it's taking quite long to deploy an app on CloudApps. Part of this execution time goes to updating apt-get and installing docker. Azure has launched Azure Containers instances which don't need those two steps and might save some deployment time. I don't know if more than one container can be launch, and if not, how to orchestrate different instances, plus I don't think Terraform has implemented this so quickly. Need to investigate.

https://docs.microsoft.com/en-us/azure/container-instances/

ageorgou commented 6 years ago

Tried out one of the available Azure options ("Docker on Ubuntu Server"), which appears to just be an Ubuntu VM with docker already installed. Can confirm that it is possible to build and run multiple containers simultaneously.

One important thing to note is that port access seems to be differently configured (compared to the "standard" Azure VM currently deployed). By default, no ports are accessible, and they have to be opened explicitly. On the Azure Portal, this is configured under "Endpoints". Will investigate whether/how Terraform can handle these.

raquelalegre commented 6 years ago

I have finally been able to create a "Docker for Azure CE VM" (CE stands for Community Edition). It failed on initial attempts, but after filing a support request, they said:

Given the fact that this image you wish to deploy is the Community Edition, there are some specific requirements we detected. In order for the deployment to be successful, you need to add the username “docker” in the deployment process. In addition, this image can be deployed only using a SSH private key. Otherwise, it will fail.

So I created a new one with docker username and ssh key config instead of password, and it has been created.

However this might not be a good option either, because we are forcing the cloudlabs users to be "docker" in order to access their machines. So discarded.

For @ageorgou "Docker on Ubuntu Server", we could still use the terraform configuration for the network security group where the inbound/outbound rules are configured. Here's a link:

https://www.terraform.io/docs/providers/azure/r/security_group_rule.html

ageorgou commented 6 years ago

From looking at this earlier, I believe that we can specify the Docker VMs in terraform as an extension. See: https://docs.microsoft.com/en-gb/azure/virtual-machines/linux/dockerextension?toc=%2Fazure%2Fvirtual-machines%2Flinux%2Ftoc.json and https://www.terraform.io/docs/providers/azurerm/r/virtual_machine_extension.html

raquelalegre commented 6 years ago

I have just created an Azure Data Science VM, and it has docker installed as well as other useful stuff like python 3.5, pip, etc. It'd be nice to use this, but Terraform doesn't seem to provide support. I've asked them on StackOverflow if I'm missing something. They normally reply quickly.