# CIRCLE Project - Salt Installer

## OS Support

* Red Hat Linux family:
    * under development
* Debian Linux family:
    * Ubuntu linux 18.04 LTS

## Prerequisites

### Red Hat family

TBD

### Debian family

For Devenv start a new ubuntu 18.04 with least 4G RAM.
Set the proper hostname.

In circle VMs you can set the name to mycircel-dev using the following commands.
```bash
sudo sed -ie 1,\$s/$(hostname)/mycircle-dev/ /etc/hosts
sudo bash -c "echo mycircle-dev > /etc/hostname"
sudo reboot  - it not neccessary because the next steps
```

Refresh your system:
```bash
sudo apt update && sudo apt upgrade -y 
sudo reboot
```

Install some important packages
```bash 
sudo apt install python3 python3-pip python3-dev virtualenvwrapper git vim -y 
```

## Get the installer
Clone circle installer git repository into cloud home

```bash
git clone https://git.ik.bme.hu/CIRCLE3/salt.git
```

## Single node quick install
```bash
sudo salt/install --local [--defpass]
```

Open the port 443 for the portal 
```bash 
ufw allow 443
```

## Quickstart - Standalone Node

### Login
Log in into the Circle website with admin (the site is accessable on the 443 port). Name and password is in the `salt/pillar/installer.sls`.

### Create Node
To run virtual machines, we need to create nodes - and add to the system. Click on the new icon in the dashboard, Nodes menu.

#### Configure Node

To standalone configuration, type the current machine's hostname to Host/name, MAC address to Host/MAC, IP to HOST/IP. Choose managed-vm as VLAN.

#### Activate Node

Click on the 'Activate' icon to use the Node.

### Start Virtual Machine

To create new Virtual Machine, we use Templates - images based on previously saved VMs. Currently we haven't got any template - so let's create a new one. Click on Templates/new icon and choose 'Create a new base VM without disk'.

#### Configure Template

Set name, CPU and RAM settings, architecture. Check in the boot menu box, select network and lease, write down, which operating system will you use. Finally, create a template.
> The rows marked with astersk need to be filled.

![configure standalone node](_static/images/configure_node.jpg)

#### Add disk

Currently we don't have any disks attached to our VM. To add, click on the Resources menu, 'create disk' icon, set the name and size.

![disk setup](_static/images/disk.jpg)

#### Attach ISO

To install an OS, we can use ISO images, to boot from. Click on 'download disk' and type the ISO's URL.

![download iso](_static/images/iso.jpg)

### Start Virtual Machine
Finally, we can run the machine. Click on 'deploy' and start it. You can choose, on which node do you want to run.

![ubuntu 14.04](_static/images/ubuntu.png)

## Troubleshooting ##

### Portal won't load
Maybe port 443 is closed. Check and open it.


### Portal won't load on Ubuntu 14.04
```bash
sudo service nginx restart
```

### Cannot reach the internet on VM-s on distro from Red Hat family
```bash
sudo systemctl restart systemd-sysctl
```
