maryvilledev/cnvm

语言: Shell

git: https://github.com/maryvilledev/cnvm

Cloud Native VM
Cloud Native VM
README.md (中文)

cnvm

Cloud Native Virtual Machine

A cnvm is a cloud native virtual machine, that is to say, a virtual machine that is as portable as a container.

CNVM GlobeTrotter Demo Video

WARNING EXPERIMENTAL: We are not suggesting this be used in production, yet. We are adding functionality all the time. Please help us make it better!

Cloud Native VM平台允许您部署以下虚拟机:

  • Vendor-Agnostic
  • Cloud-Agnostic
  • Agile (dynamic, fluid, etc.)
  • Software Defined (compute, networking, storage, etc.)
  • Persistent
  • Identical
  • 安全
  • 开放和共享

许多优秀的开源项目使cnvm成为可能,包括:

  • Linux
  • RUNC
  • 认为
  • 编织
  • Docker - 尤其是@boucher目前的cr-combined fork
  • Phusion

(P.S.顺便说一句 - 你可以执行cnvm的热/冷迁移以及'经典'微服务容器) (P.P.S.运动鞋是这项工作的内部项目名称 - 因此您在docs / vids / code中看到它的原因)


Scripts

We have put together a set of scripts that will build it for you on most hypervisors and cloud providers

混合云方法:在Virtualbox和AWS之间传输cnvm

n-node-cloud method: Transport a cnvm between the N-nodes within the provider of your choosing


hybrid-cloud-method

If you want to try CNVM out using the automated hybrid-cloud creator (using Virtualbox and AWS):

混合云方法最低要求:

  • A Linux or Mac OSX workstation
  • 2 GB可用内存,20 GB可用磁盘空间
  • 工作站上安装了Vagrant(当前版本要求:1.7.4)
  • Virtualbox安装在您的工作站上
  • git客户端安装在您的工作站上
  • An AWS account
  • An AWS security group configured to allow the following ports: 22/tcp, 6783/tcp, and 6783/udp, from the world

Let's get started with the hybrid-cloud-method! (note you can replace aws with any provider in the below example as long as you have the environment variables configured appropriately)

  1. 设置以下环境变量以反映AWS账户的正确设置

导出您所在地区的AWS_AMI = <UBUNTU 15.04 Vivid x64服​​务器AMI图像> - 我在US-WEST使用了ami-01729c45   export AWS_REGION = <AWS REGION>   export AWS_SECURITYGROUP = <VPC SECURITY GROUP>   export AWS_INSTANCE = t2.medium   导出AWS_KEYPATH = <PATH到您的.PEM文件,与您的AWS_KEYNAME相匹配>   export AWS_KEYNAME = <SSH KEY PAIR NAME>   export AWS_ACCESS_KEY = <AWS ACCESS KEY>   export AWS_SECRET_KEY = <AWS SECRET KEY> 2.克隆工作站上的cnvm repo:

user @ workstation:〜$:git clone https://github.com/gonkulator/cnvm.git 3.转到cnvm目录,然后执行boostrap脚本,如下所示:

user @ workstation:〜$:cd cnvm

user@workstation:~/cnvm$: ./footlocker-bootstrap.sh hybrid-demo virtualbox aws

  1. This will kick off the build of 3 hosts. A build host (in virtualbox, in your workstation), and two footlockers (one in virtualbox and one up at AWS). A footlocker is a host that is prepped to host cnvms. This step will take approximately 10 minutes depending on your local workstation horsepower and network connectivity. When completed you will be returned to the prompt, and you may then log into cnvm-host-01 to deploy your first cnvm:

user @ workstation~ / cnvm $:vagrant ssh cnvm-host-01

  1. 你会看到一个Ubuntu横幅,你需要su到'cnvm'用户,以建立网络覆盖并启动初始cnvm。执行此操作的脚本将在成功su时自动触发。完成后,您将收到有关其IP地址,连接密码以及它在线的通知。

```  欢迎使用Ubuntu 15.04(GNU / Linux 3.19.0-15-通用x86_64)


Ubuntu 15.04 built 2015-10-04


vagrant @ cnvm-host-01:〜$ sudo su - cnvm  [o]在172.17.8.101上开始编织  无法在本地找到图像'weaveworks / weaveexec:1.1.2'  1.1.2:从weaveworks / weaveexec拉出  511136ea3c5a:拉出fs图层  c9fa955c112e:拉出fs图层  296b35397bd8:拉出fs图层  5c0137366a00:拉出fs图层

文字剪裁为健康<<<  状态:已下载stlalpha / myphusion的更新图片:stockticker  [o]附加全球主机名和IP sneaker01.gonkulator.io/10.100.101.111/24  10.100.101.111  [o]设置cnvm主机名  [o]成功  [o] cnvm online @ 10.100.101.111/24  转发本地端口22到10.100.101.111:2222  转发本地端口80到10.100.101.111:8080  初始cnvm在线@ 10.100.101.111 - 用ssh连接:ssh user@10.100.101.111密码:密码  CNVM @ CNVM主机-01:〜/ CNVM $  ```

  1. 您已经成功推出了第一个cnvm!    通过ssh'ing登录到:10.100.101.111

cnvm@cnvm-host-01:~/cnvm$ ssh user@10.100.101.111

password: password

无法建立主机'10 .100.101.111(10.100.101.111)'的真实性。  ECDSA密钥指纹是4a:c8:c8:f8:19:29:3f:f4:80:de:e6:38:bc:e7:e5:e5。  您确定要继续连接(是/否)吗?是  警告:永久性地将“10 .100.101.111”(ECDSA)添加到已知主机列表中。  user@10.100.101.111的密码:  上次登录:Sun Sep 13 17:13:06 2015 172.17.42.1  用户@ sneaker01:〜$

  1. 保留该终端窗口,然后打开另一个终端窗口。使用vagrant再次连接到cnvm-host-01,然后su到cnvm user @ workstation:〜$ cd cnvm user @ workstation:〜/ cnvm $ vagrant ssh cnvm-host-01  ```  欢迎使用Ubuntu 15.04(GNU / Linux 3.19.0-15-通用x86_64)
  • 文档:https://help.ubuntu.com/

Ubuntu 15.04建于2015-10-04


* vagrant @ cnvm-host-01:〜$ *`sudo su - cnvm`  CNVM @ CNVM主机-01:〜$  ```

  1. 在这个新的会话中,您将通过执行以下命令将您的cnvm从Virtualbox实例迁移(传送)到AWS中 -

cnvm@cnvm-host-01:~$ teleport sneaker01.gonkulator.io cnvm@10.100.101.2:/home/cnvm/sneakers

  1. As the command executes, you will notice that in your first terminal window (the one logged into the cnvm) the session becomes unresponsive since time has frozen and it is being transported across the network to AWS. Fear not - it will come alive again once it has reached the far side. You will see the following in the teleport terminal session:

cnvm @ cnvm-host-01:〜/ cnvm $ teleport sneaker01.gonkulator.io cnvm@10.100.101.2:/ home / cnvm / sneakers  [o]检查远程站点  [o]检查远程着陆区......  警告:永久性地将“10 .100.101.2”(ECDSA)添加到已知主机列表中。  [o]远程着陆区确定  [o]消毒网站  [o]消毒cnvm@10.100.101.2  [o]快照运动鞋:638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167  [o]设置当地登陆区......  [o] Checkpointing运动鞋638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167  [o]检查站成功......  [o]注册运动鞋图片......  [o]流动运动鞋图片......  [o]流媒体运动鞋图片COMPLETE  [o]传送运动鞋:638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167  [o]转移机器状态信息....  [o]机器状态信息传输完成  [o]创建远程代理...  [o]远程代理创建de3036ef6df035377b2996283af7f87bbbf0ce57547618058638553b43bdc336完成  [o]恢复实例运行状态......  [o]实例运行状态恢复COMPLETE  [o]更新远程本机IP地址和路由  [o]更新远程本机IP地址并路由COMPLETE  [o]打造Weave运动鞋-LAN .....  10.100.101.111  10.100.101.111  10.100.101.111  [o]编织运动鞋-LAN ONLINE  [o]实例传送完成  [o]新运动鞋编号:de3036ef6df035377b2996283af7f87bbbf0ce57547618058638553b43bdc336  [o]新的本机IP地址:172.17.0.4  [o]编织SLAN IP地址:10.100.101.111/24  [o]清理......  638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167  [o]完成  CNVM @ CNVM主机-01:〜/ CNVM $

  1. Your cnvm terminal window will now be responsive again, the session never died, and your cvnm is now live in AWS!

您只需将本地工作站(无论在世界上的任何地方)迁移到AWS,无论您在世界中定义何处,都可以在不丢失任何状态信息的情况下将cnvm迁移到AWS。 cpu,内存,磁盘和网络状态全部转移!


n-node-method

Want to setup your own N-node test environment on the provider of your choice and play with it?

n-node-method minimum requirements:

  • Linux或Mac OSX工作站
  • Vagrant installed on your workstation (current version required: 1.7.4)
  • 访问足够的虚拟资源(不一定在本地工作站上)以运行至少(3)'footlockers' 什么是脚踏车?它是一个能够运行cnvm的主机
  • 每个footlocker至少需要1个CPU,1 GB的内存和30 GB的磁盘空间
  • 这些脚本目前在以下虚拟机管理程序和云提供程序上构建了footlockers: VMware Fusion(本地工作站) VMware Workstation(本地工作站) Virtualbox(本地工作站) 亚马逊 Google Compute Microsoft Azure 数字海洋
  • As long as they can see each other over the network, they can reside anywhere (details below)
  • About 40 minutes of clock time (varies based on internet speeds and computing resources)
  • 注意:该项目目前利用高度实验性的代码和本地分支 - 我们将主流变化作为社区中的功能表面。

让我们开始使用n-cloud方法!

  • Decide which hypervisor and/or cloud providers you are going to use as your footlockers
  • If you have chosen cloud providers, make sure that you have your account credentials and the other relevant environment variables set (see below for cloud-provider specific details BEFORE continuing.)
  • Each of the target cnvm footlockers must be able to reach each other over ports 22/tcp, 6783/tcp, and 6783/udp.
  • 如果您在公共云提供程序上运行,请确保已设置访问权限以允许来自全球的这些端口和协议
  1. 在您的工作站上,将此repo克隆到本地目录: git clone https://github.com/gonkulator/cnvm.git
  2. 执行引导程序脚本,传递您希望构建的提供程序的参数和footlocker节点的数量(请记住,一个将是构建节点,因此最终将使用N - 1个可用的footlocker节点) 完整命令应如下所示: user @ workstation~ $ cd cnvm user @ workstation~ $ ./footlocker-bootstrap.sh aws 3 注意:该脚本将接受以下有效参数:aws,azure,digital_ocean,google,virtualbox,vmware_fusion,vmware_workstation - 执行footlocker-bootstrap.sh以获取更多用法信息。
  3. 部署完成后,使用vagrant登录到cnvm-host-001(或cnvm-host-00以外的任何footlocker节点),然后su到cnvm用户。成功的su,第一个cnvm将自动启动。 user @ workstation~ $ vagrant ssh cnvm-host-01 root @ cnvm-host-01#sudo su - cnvm
  4. 脚本完成后,您可以通过以下IP连接到footlocker上运行的cnvm:10.100.101.111。 cnvm @ cnvm-host-01~ $ ssh user@10.100.101.111 密码:密码
  5. 打开第二个ssh会话到cnvm footlocker节点。并将其传送(实时迁移)到其他节点之一。要做到这一点,只需: cnvm @ cnvm-host-01~ $ teleport sneaker01.gonkulator.io cnvm @ <targetip>:/ home / cnvm / sneakers 注意:上例中的目标IP地址可以是所讨论的footlocker主机的编织IP地址。主机的编号从10.100.101.1(cnvm-host-01)开始,每个额外的footlocker节点向上编号。在上面的例子中 - cnvm-host-02将是10.100.101.2
  • 这将启动cnvm从主节点到您在命令行上指定的目标节点的实时迁移。
  • 执行此操作时 - cnvm(10.100.101.111)上的ssh会话将无响应。迁移完成后,它将立即恢复,因为它已将其所有状态迁移到目标节点!
  1. 恭喜 - 你活着迁移了一个正在运行的cnvm!

特定于云提供商的设置

请阅读下面的详细信息,了解您要使用的提供商。

在运行footlocker-bootstrap.sh之前设置这些环境变量。

  • 您需要一组访问凭据才能访问vpc和区域以供部署。您选择的AWS_SECURITYGROUP应该打开端口22 / tcp,6783 / tcp和6783 / udp以便从世界连接。
  • 您需要设置以下环境变量:
export AWS_KEY=<INSERT VALUE HERE>
export AWS_AMI=<UBUNTU 15.04 Vivid x64 Server AMI IMAGE in your region> - I used ami-01729c45 in US-WEST
export AWS_REGION=<AWS REGION>
export AWS_SECURITYGROUP=<VPC SECURITY GROUP>
export AWS_INSTANCE=<INSTANCE TYPE>t2.medium
export AWS_KEYPATH=<PATH TO YOUR .PEM FILE THAT MATCHES YOUR AWS_KEYNAME BELOW>
export AWS_KEYNAME=<SSH KEY PAIR NAME>
export AWS_ACCESS_KEY=<AWS ACCESS KEY>
export AWS_SECRET_KEY=<AWS SECRET KEY>

天蓝

  • 您需要创建Azure管理证书并将其上载到Azure。有关如何生成管理证书的具体说明,请参阅此链接。您还需要Azure订阅ID。您需要创建tcp端点以允许来自世界的22 / tcp,6783 / tcp和6783 / udp访问。
  • 您将需要以下环境变量集:
export AZURE_MGMT_CERT=<PATH TO MANAGENT CERT FILE>
export AZURE_MGMT_ENDPOINT='https://management.core.windows.net'
export AZURE_SUB_ID=<AZURE SUBSCRIPTION ID>
export AZURE_DEPLOYMENT_NAME='gonkcnvm'
export AZURE_LOCATION=<AZURE LOCATION - I used 'Central US'>
export AZURE_STORAGE_ACCT='gonk2'
export AZURE_VM_IMAGE='b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-15_04-amd64-server-20151021-en-us-30GB'
export AZURE_SSH_PRIV_KEY=<PATH TO AZURE RSA PRIV KEY YOU WANT TO USE FOR LOGIN>
export AZURE_PRIV_KEY=<PATH TO AZURE RSA PRIV KEY YOU WANT TO USE FOR LOGIN>
export AZURE_CERT_FILE=<PATH TO AZURE RSA PRIV KEY YOU WANT TO USE FOR LOGIN>
export AZURE_VM_SIZE='Standard_D1'

digitalocean

  • 您需要从管理登录名创建访问令牌。
  • 您需要设置以下环境变量:
export DO_OVERRIDE_KEY=<PATH TO SSH KEY YOU WISH TO USE>
export DO_SIZE=2GB
export DO_REGION=<DATACENTER YOU WANT TO USE - I USED NY3 FOR TESTING>
export DO_IMAGE=ubuntu-15-04-x64
export DO_TOKEN=<YOUR DIGITAL OCEAN API TOKEN>

谷歌

  • 您需要创建一个项目,并授予其访问Google Compute API和您的客户电子邮件地址的权限。您将设置一个具有计算访问API的服务帐户 - 这就是您在下面输入的GC_CLIENT_EMAIL。设置API访问时,您将创建一个客户端KEY来识别您 - 该文件是您在下面引用的GC_KEY_LOCATION。您需要在项目的默认网络上设置防火墙规则,允许来自世界的22 / tcp,6783 / tcp和6783 / udp。
  • 您将需要以下环境变量集:
export GC_PROJECT=<PROJECT NAME>
export GC_CLIENT_EMAIL=<CLIENT EMAIL>
export GC_KEY_LOCATION=<PATH TO API ACCOUNT CERT FILE DESCRIBED ABOVE>
export GC_IMAGE='ubuntu-1504-vivid-v20150911'
export GC_OVERRIDE_KEY=<THE SSH KEY YOU WANT TO USE TO LOGIN TO THE MACHINES>
export GC_MACHINETYPE='n1-standard'

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

cnvm

Cloud Native Virtual Machine

A cnvm is a cloud native virtual machine, that is to say, a virtual machine that is as portable as a container.

CNVM GlobeTrotter Demo Video

WARNING EXPERIMENTAL: We are not suggesting this be used in production, yet. We are adding functionality all the time. Please help us make it better!

The Cloud Native VM platform allows you to deploy Virtual Machines that are:

  • Vendor-Agnostic
  • Cloud-Agnostic
  • Agile (dynamic, fluid, etc.)
  • Software Defined (compute, networking, storage, etc.)
  • Persistent
  • Identical
  • Secure
  • Open and Shared

cnvm is made possible by many outstanding open-source projects including:

(P.S. btw - you can execute hot / cold migrations of cnvm's as well as 'classic' microservice containers)
(P.P.S. sneakers was the internal project name for this effort - hence why you see it in the docs/vids/code)


Scripts

We have put together a set of scripts that will build it for you on most hypervisors and cloud providers

hybrid-cloud method: Transport a cnvm between Virtualbox and AWS

n-node-cloud method: Transport a cnvm between the N-nodes within the provider of your choosing


hybrid-cloud-method

If you want to try CNVM out using the automated hybrid-cloud creator (using Virtualbox and AWS):

hybrid-cloud-method minimum requirements:

  • A Linux or Mac OSX workstation
  • 2 gb of available memory, 20gb of available disk space
  • Vagrant installed on your workstation (current version required: 1.7.4)
  • Virtualbox installed on your workstation
  • The git client installed on your workstation
  • An AWS account
  • An AWS security group configured to allow the following ports: 22/tcp, 6783/tcp, and 6783/udp, from the world

Let's get started with the hybrid-cloud-method! (note you can replace aws with any provider in the below example as long as you have the environment variables configured appropriately)

  1. Set the following environment variables to reflect the correct settings for your AWS account

export AWS_AMI=<UBUNTU 15.04 Vivid x64 Server AMI IMAGE in your region> - I used ami-01729c45 in US-WEST export AWS_REGION=<AWS REGION> export AWS_SECURITYGROUP=<VPC SECURITY GROUP> export AWS_INSTANCE=t2.medium export AWS_KEYPATH=<PATH TO YOUR .PEM FILE THAT MATCHES YOUR AWS_KEYNAME BELOW> export AWS_KEYNAME=<SSH KEY PAIR NAME> export AWS_ACCESS_KEY=<AWS ACCESS KEY> export AWS_SECRET_KEY=<AWS SECRET KEY>
2. Clone the cnvm repo on your workstation:

user@workstation:~$: git clone https://github.com/gonkulator/cnvm.git
3. Change into the cnvm directory, and execute the boostrap script as follows:

user@workstation:~$: cd cnvm

user@workstation:~/cnvm$: ./footlocker-bootstrap.sh hybrid-demo virtualbox aws

  1. This will kick off the build of 3 hosts. A build host (in virtualbox, in your workstation), and two footlockers (one in virtualbox and one up at AWS). A footlocker is a host that is prepped to host cnvms. This step will take approximately 10 minutes depending on your local workstation horsepower and network connectivity. When completed you will be returned to the prompt, and you may then log into cnvm-host-01 to deploy your first cnvm:

user@workstation~/cnvm$: vagrant ssh cnvm-host-01

  1. You will be greeted with an Ubuntu banner, and you need to su to the 'cnvm' user in order to establish the network overlay and launch the initial cnvm. A script to do this will fire automatically upon a successful su. When complete you will be notified of its ip address, password to connect, and that it is online.

```
Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic x86_64)


Ubuntu 15.04 built 2015-10-04


vagrant@cnvm-host-01:~$ sudo su - cnvm
[o] Starting weave on 172.17.8.101
Unable to find image 'weaveworks/weaveexec:1.1.2' locally
1.1.2: Pulling from weaveworks/weaveexec
511136ea3c5a: Pulling fs layer
c9fa955c112e: Pulling fs layer
296b35397bd8: Pulling fs layer
5c0137366a00: Pulling fs layer

TEXT CLIPPED FOR BREVITY<<<
Status: Downloaded newer image for stlalpha/myphusion:stockticker
[o] Attaching global hostname and IP sneaker01.gonkulator.io/10.100.101.111/24
10.100.101.111
[o] Setting cnvm hostname
[o] Success
[o] cnvm online @ 10.100.101.111/24
Forwarding local port 22 to 10.100.101.111:2222
Forwarding local port 80 to 10.100.101.111:8080
Initial cnvm online @ 10.100.101.111 -- Connect with ssh: ssh user@10.100.101.111 password: password
cnvm@cnvm-host-01:~/cnvm$
```

  1. You have successfully launched your first cnvm!
    Log into it by ssh'ing to: 10.100.101.111

cnvm@cnvm-host-01:~/cnvm$ ssh user@10.100.101.111

password: password

The authenticity of host '10.100.101.111 (10.100.101.111)' can't be established. ECDSA key fingerprint is 4a:c8:c8:f8:19:29:3f:f4:80:de:e6:38:bc:e7:e5:e5. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.100.101.111' (ECDSA) to the list of known hosts. user@10.100.101.111's password: Last login: Sun Sep 13 17:13:06 2015 from 172.17.42.1 user@sneaker01:~$

  1. Leave that terminal window logged in, and open another terminal window. Use vagrant to connect to cnvm-host-01 again, and then su to cnvm

    user@workstation:~$ cd cnvm

    user@workstation:~/cnvm$ vagrant ssh cnvm-host-01
    ```
    Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic x86_64)


Ubuntu 15.04 built 2015-10-04


*vagrant@cnvm-host-01:~$* `sudo su - cnvm`
cnvm@cnvm-host-01:~$
```

  1. From this new session, you are going to live migrate (teleport) your cnvm from your Virtualbox instance, into AWS - by executing:

cnvm@cnvm-host-01:~$ teleport sneaker01.gonkulator.io cnvm@10.100.101.2:/home/cnvm/sneakers

  1. As the command executes, you will notice that in your first terminal window (the one logged into the cnvm) the session becomes unresponsive since time has frozen and it is being transported across the network to AWS. Fear not - it will come alive again once it has reached the far side. You will see the following in the teleport terminal session:

cnvm@cnvm-host-01:~/cnvm$ teleport sneaker01.gonkulator.io cnvm@10.100.101.2:/home/cnvm/sneakers [o] Checking remote site [o] Checking remote landing-zone... Warning: Permanently added '10.100.101.2' (ECDSA) to the list of known hosts. [o] Remote landing zone OK [o] Sanitizing site [o] Sanitizing cnvm@10.100.101.2 [o] Snapshotting sneaker: 638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167 [o] Setting up local landing-zone... [o] Checkpointing sneaker 638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167 [o] Checkpoint success... [o] Registering sneaker image... [o] Streaming sneaker image... [o] Streaming sneaker image COMPLETE [o] Teleporting sneaker: 638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167 [o] Transferring machine state information.... [o] Machine state information transfer COMPLETE [o] Creating remote surrogate... [o] Remote surrogate creation de3036ef6df035377b2996283af7f87bbbf0ce57547618058638553b43bdc336 COMPLETE [o] Restoring instance run state... [o] Instance run state restoration COMPLETE [o] Updating remote native IP addr and routes [o] Updating remote native IP addr and routes COMPLETE [o] Bringing up Weave sneaker-LAN..... 10.100.101.111 10.100.101.111 10.100.101.111 [o] Weave sneaker-LAN ONLINE [o] Instance teleportation COMPLETE [o] New sneaker id: de3036ef6df035377b2996283af7f87bbbf0ce57547618058638553b43bdc336 [o] New native IP ADDR: 172.17.0.4 [o] Weave SLAN IP ADDR: 10.100.101.111/24 [o] Cleaning up... 638f6c319bc06148afc5f8ca01e0890522b1e6643aefe656ccedc1f9d74de167 [o] DONE cnvm@cnvm-host-01:~/cnvm$

  1. Your cnvm terminal window will now be responsive again, the session never died, and your cvnm is now live in AWS!

You just live-migrated a cnvm from your local workstation, wherever that is in the world, to AWS, wherever you defined in the world, without losing any state information. The cpu, memory, disk and network states were all transferred!


n-node-method

Want to setup your own N-node test environment on the provider of your choice and play with it?

n-node-method minimum requirements:

  • A Linux or Mac OSX workstation
  • Vagrant installed on your workstation (current version required: 1.7.4)
  • Access to enough virtual resources (not necessarily on the local workstation) to run a minimum of (3) 'footlockers'
    • What's a footlocker? It's a host that is capable of running cnvm's
  • Each footlocker will need a minimum of 1 CPU, 1 gb of memory and 30gb of disk space
  • The scripts currently build footlockers on the following hypervisors and cloud providers:
    • VMware Fusion (local workstation)
    • VMware Workstation (local workstation)
    • Virtualbox (local workstation)
    • Amazon
    • Google Compute
    • Microsoft Azure
    • Digital Ocean
  • As long as they can see each other over the network, they can reside anywhere (details below)
  • About 40 minutes of clock time (varies based on internet speeds and computing resources)
  • NOTE: this project currently leverages highly experimental code and local forks - we will incorporate the mainstream changes as the functionality surfaces in the community.

Let's get started with the n-cloud-method!

  • Decide which hypervisor and/or cloud providers you are going to use as your footlockers
  • If you have chosen cloud providers, make sure that you have your account credentials and the other relevant environment variables set (see below for cloud-provider specific details BEFORE continuing.)
  • Each of the target cnvm footlockers must be able to reach each other over ports 22/tcp, 6783/tcp, and 6783/udp.
  • If you are running on a public cloud provider, make sure you have set up access to allow these ports and protocols from the world
  1. On your workstation, clone this repo to a local directory:

    git clone https://github.com/gonkulator/cnvm.git

  2. Execute the bootstrap script passing in the argument for the provider you wish to build against and the number of footlocker nodes (remember that one will be the build node, so you will end up with N - 1 usable footlocker nodes)

    • The full command should look something like this:

      user@workstation~$ cd cnvm

      user@workstation~$ ./footlocker-bootstrap.sh aws 3

      NOTE: the script will accept the following as valid arguments: aws, azure, digital_ocean, google, virtualbox, vmware_fusion, vmware_workstation - execute footlocker-bootstrap.sh for more usage information.

  3. Once the deployment is complete, use vagrant to log into cnvm-host-001 (or any footlocker node other than cnvm-host-00) and then su to the cnvm user. On successful su, the first cnvm will automatically launch.

    user@workstation~$ vagrant ssh cnvm-host-01

    root@cnvm-host-01# sudo su - cnvm

  4. When the script completes, you can connect to the running cnvm from the footlocker at the following IP: 10.100.101.111.

    cnvm@cnvm-host-01~$ ssh user@10.100.101.111

    password: password

  5. Open a second ssh session to the cnvm footlocker node. And teleport (live-migrate) it to one of the other nodes. To do this simply:

    cnvm@cnvm-host-01~$ teleport sneaker01.gonkulator.io cnvm@<targetip>:/home/cnvm/sneakers

    NOTE: The target IP address in the above example can be the weave ip address of the footlocker host in question. The hosts are numbered starting at 10.100.101.1 (cnvm-host-01) and upwards for each additional footlocker node. In the above example - cnvm-host-02 would be 10.100.101.2

  • This will initiate a live-migration of the cnvm from the master node, to the target node you specified on the command line.
  • When this executes - your ssh session on the cnvm (10.100.101.111) will become unresponsive. As soon as the migration has completed, it will resume since it has been migrated with all of its state to the target node!
  1. Congratulations - you live-migrated a running cnvm!

Cloud Provider-Specific Setups

Read the details below for the provider you want to use.

Set these environment variables BEFORE running footlocker-bootstrap.sh.

aws

  • You need a set of access credentials with access to a vpc and region for you to deploy. The AWS_SECURITYGROUP that you select should have port 22/tcp, 6783/tcp, and 6783/udp open for connectivity from the world.

  • You need to have the following environmental variables set:

export AWS_KEY=<INSERT VALUE HERE>
export AWS_AMI=<UBUNTU 15.04 Vivid x64 Server AMI IMAGE in your region> - I used ami-01729c45 in US-WEST
export AWS_REGION=<AWS REGION>
export AWS_SECURITYGROUP=<VPC SECURITY GROUP>
export AWS_INSTANCE=<INSTANCE TYPE>t2.medium
export AWS_KEYPATH=<PATH TO YOUR .PEM FILE THAT MATCHES YOUR AWS_KEYNAME BELOW>
export AWS_KEYNAME=<SSH KEY PAIR NAME>
export AWS_ACCESS_KEY=<AWS ACCESS KEY>
export AWS_SECRET_KEY=<AWS SECRET KEY>

azure

  • You will need to have created an Azure Management Certificate and uploaded it to Azure. See this link for specific instructions on how to generate a management certificate. You will also need your Azure Subscription ID. You will need to have tcp endpoints created to allow 22/tcp, 6783/tcp, and 6783/udp access from the world.

  • You will need the following environment variables set:

export AZURE_MGMT_CERT=<PATH TO MANAGENT CERT FILE>
export AZURE_MGMT_ENDPOINT='https://management.core.windows.net'
export AZURE_SUB_ID=<AZURE SUBSCRIPTION ID>
export AZURE_DEPLOYMENT_NAME='gonkcnvm'
export AZURE_LOCATION=<AZURE LOCATION - I used 'Central US'>
export AZURE_STORAGE_ACCT='gonk2'
export AZURE_VM_IMAGE='b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-15_04-amd64-server-20151021-en-us-30GB'
export AZURE_SSH_PRIV_KEY=<PATH TO AZURE RSA PRIV KEY YOU WANT TO USE FOR LOGIN>
export AZURE_PRIV_KEY=<PATH TO AZURE RSA PRIV KEY YOU WANT TO USE FOR LOGIN>
export AZURE_CERT_FILE=<PATH TO AZURE RSA PRIV KEY YOU WANT TO USE FOR LOGIN>
export AZURE_VM_SIZE='Standard_D1'

digitalocean

  • You need to create an access token from the administrative login.

  • You need the following environment variables set:

export DO_OVERRIDE_KEY=<PATH TO SSH KEY YOU WISH TO USE>
export DO_SIZE=2GB
export DO_REGION=<DATACENTER YOU WANT TO USE - I USED NY3 FOR TESTING>
export DO_IMAGE=ubuntu-15-04-x64
export DO_TOKEN=<YOUR DIGITAL OCEAN API TOKEN>

google

  • You need to create a project and give it access to the Google Compute API and your client email address. You will setup a service account that has compute access API - thats the GC_CLIENT_EMAIL that you enter below. When setting up the API access you will create a client KEY to identify you - and that file is what you reference below as GC_KEY_LOCATION. You need to have a firewall rules set on the project's default network that allow 22/tcp, 6783/tcp, and 6783/udp from the world.

  • You will need the following environment variables set:

export GC_PROJECT=<PROJECT NAME>
export GC_CLIENT_EMAIL=<CLIENT EMAIL>
export GC_KEY_LOCATION=<PATH TO API ACCOUNT CERT FILE DESCRIBED ABOVE>
export GC_IMAGE='ubuntu-1504-vivid-v20150911'
export GC_OVERRIDE_KEY=<THE SSH KEY YOU WANT TO USE TO LOGIN TO THE MACHINES>
export GC_MACHINETYPE='n1-standard'