github.com/mfpierre/corectl@v0.5.6/README.md (about) 1 # CoreOS _over_ OS X made simple 2 ###### built on top of [xhyve](https://github.com/xhyve-xyz/xhyve)'s _golang_ [bindings](https://github.com/hooklift/xhyve) 3 4 **caveats** 5 ----------- 6 7 > - `xhyve`, on top of we built, is a young project, so expect bugs! 8 > - You must be running OS X Yosemite, 10.10.3, or later on a 2010, 9 > or later, Mac (i.e. one with a CPU that supports EPT) for things to work. 10 > - if you use **any** version of VirtualBox prior to VirtualBox 4.3.30 then 11 > `xhyve` will crash your system either if VirtualBox is running, or had been 12 > run previously after the last reboot (see `xhyve`'s issues 13 > [#5](https://github.com/mist64/xhyve/issues/5) and 14 > [#9](https://github.com/mist64/xhyve/issues/9) for the full context). So, 15 > if you are unable to update VirtualBox to the latest, either of the 4.x or 16 > 5.x streams, and were using it in your current session please do restart 17 > your Mac before attempting to run `corectl`. 18 19 20 ## step by step instructions 21 22 ### install `corectl` 23 #### - installing a release build (prefered for end users) 24 - via [homebrew's](http://brew.sh) 25 ``` 26 ❯❯❯ brew install corectl 27 ``` 28 - downloading from GitHub 29 just go to our [releases](https://github.com/TheNewNormal/corectl/releases) page 30 and download the binary to your system, and then rename it to `corectl` placing 31 it in some directory in your PATH (`/usr/local/bin/` is a good choice) 32 33 #### - build it locally (for power users) 34 ``` 35 ❯❯❯ git clone git@github.com:TheNewNormal/corectl.git 36 ❯❯❯ cd corectl 37 ❯❯❯ make 38 ``` 39 ### kickstart a CoreOS VM 40 the following command will fetch the `latest` CoreOS Alpha image 41 available, verify it with the build public key, add an OEM `xhyve` 42 personality and then load it over `xhyve`. 43 44 ``` 45 ❯❯❯ sudo corectl run 46 47 ``` 48 49 In your terminal you should see something along this: 50 51 ``` 52 (...) 53 This is localhost (Linux x86_64 4.1.5-coreos) 13:23:20 54 SSH host key: d0:b7:8e:5a:ef:c3:ef:f5:4d:69:c0:ba:35:62:28:3c (DSA) 55 SSH host key: 2d:11:6f:7c:84:f7:36:34:e7:b9:a8:73:f9:1d:ae:72 (ED25519) 56 SSH host key: 31:02:9b:95:99:60:d8:5f:74:36:44:30:be:aa:65:ef (RSA) 57 eth0: 192.168.64.220 fe80::7817:77ff:fe6f:cf32 58 59 localhost login: core (automatic login) 60 61 CoreOS stable (779.0.0) 62 Update Strategy: No Reboots 63 Last login: Tue Aug 25 13:23:20 +0000 2015 on /dev/tty1. 64 core@localhost ~ $ 65 ``` 66 you 'll find out that your `${HOME}` become available (via NFS) inside your VM. 67 that will come handy when you come to play with `docker` volumes later... 68 69 ### usage 70 ``` 71 CoreOS over OSX made simple. 72 ❯❯❯ http://github.com/TheNewNormal/corectl 73 74 75 Usage: 76 corectl [flags] 77 corectl [command] 78 79 Available Commands: 80 rm Removes one or more CoreOS images from local fs 81 kill Halts one or more running CoreOS instances 82 ls Lists locally available CoreOS images 83 load Loads from an instrumentation file (in TOML, JSON or YAML) one or more CoreOS instances 84 version Shows corectl version information 85 ps Lists running CoreOS instances 86 pull Pulls a CoreOS image from upstream 87 run Starts a new CoreOS instance 88 ssh Attach to or run commands inside a running CoreOS instance 89 90 Flags: 91 --debug[=false]: adds extra verbosity, and options, for debugging purposes and/or power users 92 93 Use "corectl [command] --help" for more information about a command. 94 95 All flags can also be configured via upper-case environment variables prefixed with "COREOS_" 96 For example, "--debug" => "COREOS_DEBUG" 97 ``` 98 > read [here](documentation/markdown/corectl.md) the full 99 > auto-generated documentation. 100 101 ### simple usage recipe: a docker and rkt playground 102 - create a volume to store your persistent data. (will be 103 `/var/lib/{docker|rkt}`) 104 ``` 105 ❯❯❯ dd if=/dev/zero of=var_lib_docker.img bs=1G count=16 106 ``` 107 in this case we created it with 16GB. 108 109 - *format* it 110 > requires [homebrew's](http://brew.sh) e2fsprogs package installed. 111 > 112 > `❯❯❯ brew install e2fsprogs` 113 114 ``` 115 ❯❯❯ /usr/local/Cellar/e2fsprogs/1.42.12/sbin/mke2fs -t ext4 -m0 -F var_lib_docker.img 116 ``` 117 118 - *label* it 119 ``` 120 ❯❯❯ /usr/local/Cellar/e2fsprogs/1.42.12/sbin/e2label var_lib_docker.img rkthdd 121 ``` 122 here, we labeled our volume `rkthdd` which is the *signature* that our 123 [*recipe*](cloud-init/docker-only-with-persistent-storage.txt) expects. 124 125 >by relying in *labels* for volume identification we get around the issues we'd 126 >have otherwise if we were depending on the actual volume name (/dev/vd...) as 127 >those would have to be hardcoded (an issue, if one is mix and matching 128 >multiple recipes all dealing with different volumes...) 129 130 - start your `docker` and `rkt` playground. 131 ``` 132 ❯❯❯ sudo UUID=deadbeef-dead-dead-dead-deaddeafbeef \ 133 ./corectl run --volume absolute_or_relative_path/to/persistent.img \ 134 --cloud_config cloud-init/docker-only-with-persistent-storage.txt \ 135 --cpus 2 --memory 2048 --name containerland -d 136 ``` 137 this will start a VM named `containerland` in the background (`-d`) with the 138 volume we created previously feeded, 2 virtual cores and 2GB of RAM. The 139 provided [cloud-config](cloud-init/docker-only-with-persistent-storage.txt) 140 will format the given volume (if it wasn't yet) and bind mount both 141 ``/var/lib/rkt` and `/var/lib/docker` on top of it. docker will also become 142 available through socket activation. above we passed arguments to the VM both 143 via environment variables and command flags. both ways work, just use whatever 144 suits your taste best. 145 146 > Regarding `docker`, CoreOS shipped the 1.7 stream in all releases older than 147 > the 801.0.0 one. So, if you plan to run any of these releases, in order 148 > to talk to CoreOS' docker daemon you'll need on your Mac a matching docker 149 client,as Homebrew is already defaulting on docker 1.8.x... 150 > ``` 151 > ❯❯❯ brew remove docker 152 > ❯❯❯ brew tap homebrew/versions 153 > ❯❯❯ brew install docker171 154 > ``` 155 156 - now, from another *shell* in your mac... 157 158 ``` 159 ❯❯❯ ./corectl ps 160 found 2 running VMs, summing 3 vCPUs and 4096MB in use. 161 - containerland, alpha/794.0.0, PID 17645 (detached=true), up 1m28.687154135s 162 - 2 vCPU(s), 2048 RAM 163 - cloud-config: /Users/am/go/src/github.com/AntonioMeireles/corectl/cloud-init/docker-only-with-persistent-storage.txt 164 - Network Interfaces: 165 - eth0 (public interface) 192.168.64.14 166 - Volumes: 167 - /dev/vda (/Users/am/go/src/github.com/AntonioMeireles/corectl/var_lib_docker.img) 168 - xpto, alpha/794.0.0, PID 17648 (detached=true), up 1m26.141238951s 169 - 1 vCPU(s), 2048 RAM 170 - Network Interfaces: 171 - eth0 (public interface) 192.168.64.15 172 - eth1 (private interface/tap0 on host) 173 174 ``` 175 176 ``` 177 ❯❯❯ docker -H 192.168.64.220:2375 images -a 178 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 179 busybox latest 8c2e06607696 4 months ago 2.43 MB 180 <none> <none> 6ce2e90b0bc7 4 months ago 2.43 MB 181 <none> <none> 182 ``` 183 or ... 184 185 ``` 186 ❯❯❯ ./corectl ssh containerland 187 Last login: Wed Sep 2 17:02:44 2015 188 CoreOS stable (789.0.0) 189 Update Strategy: No Reboots 190 core@localhost ~ $ 191 ``` 192 ``` 193 ❯❯❯ ./corectl ssh containerland "sudo rkt list" 194 UUID ACI STATE NETWORKS 195 196 ``` 197 - have fun! 198 199 ## projects using `corectl` 200 - [Rimas Mocevicius](https://github.com/rimusz) entire toolset of OS X GUI apps 201 is now using `corectl` underneath. 202 - [coreos-osx](https://github.com/TheNewNormal/coreos-osx) - **CoreOS VM for OS X** 203 - [kube-solo-osx](https://github.com/TheNewNormal/kube-solo-osx) - 204 **Kubernetes Solo Cluster for OS X** 205 - [kube-cluster-osx](https://github.com/TheNewNormal/kube-cluster-osx) - 206 **Multi node Kubernetes Cluster for OS X (work in progress)** 207 208 ## acknowledgements 209 - [Michael Steil](https://github.com/mist64) for releasing in the wild his 210 awesome [xhyve](https://github.com/mist64/xhyve) lightweight OS X 211 virtualization solution and [Jeremy Sequoia](https://github.com/jeremyhu), 212 from Apple, for taking stewardship of it allowing it to move 213 [forward](https://github.com/xhyve-xyz). 214 - [Camilo Aguilar](https://github.com/c4milo) for his 215 [xhyve](https://github.com/mist64/xhyve) golang 216 [bindings](https://github.com/hooklift/xhyve) 217 - [Brandon Philips](https://github.com/philips) who come with the 218 original, `bash` based, [coreos-xhyve](https://github.com/coreos/coreos-xhyve) 219 prototype that this project supersedes 220 221 ## contributing 222 `corectl` is an [open source](http://opensource.org/osd) project under the 223 [Apache License, Version 2.0](http://opensource.org/licenses/Apache-2.0), ence 224 contributions are gladly welcomed!