corectl

command module
v0.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2015 License: Apache-2.0 Imports: 46 Imported by: 0

README

CoreOS over OS X made simple

built on top of xhyve's golang bindings

caveats

  • xhyve, on top of we built, is a young project, so expect bugs!
  • You must be running OS X Yosemite, 10.10.3, or later on a 2010, or later, Mac (i.e. one with a CPU that supports EPT) for things to work.
  • if you use any version of VirtualBox prior to VirtualBox 4.3.30 then xhyve will crash your system either if VirtualBox is running, or had been run previously after the last reboot (see xhyve's issues #5 and #9 for the full context). So, if you are unable to update VirtualBox to the latest, either of the 4.x or 5.x streams, and were using it in your current session please do restart your Mac before attempting to run corectl.

step by step instructions

install corectl
- installing a release build (prefered for end users)
  • via homebrew's
    ❯❯❯ brew install corectl
    
  • downloading from GitHub just go to our releases page and download the binary to your system, and then rename it to corectl placing it in some directory in your PATH (/usr/local/bin/ is a good choice)
- build it locally (for power users)
❯❯❯ git clone git@github.com:TheNewNormal/corectl.git
❯❯❯ cd corectl
❯❯❯ make
kickstart a CoreOS VM

the following command will fetch the latest CoreOS Alpha image available, verify it with the build public key, add an OEM xhyve personality and then load it over xhyve.

❯❯❯ sudo corectl run

In your terminal you should see something along this:

(...)
This is localhost (Linux x86_64 4.1.5-coreos) 13:23:20
SSH host key: d0:b7:8e:5a:ef:c3:ef:f5:4d:69:c0:ba:35:62:28:3c (DSA)
SSH host key: 2d:11:6f:7c:84:f7:36:34:e7:b9:a8:73:f9:1d:ae:72 (ED25519)
SSH host key: 31:02:9b:95:99:60:d8:5f:74:36:44:30:be:aa:65:ef (RSA)
eth0: 192.168.64.220 fe80::7817:77ff:fe6f:cf32

localhost login: core (automatic login)

CoreOS stable (779.0.0)
Update Strategy: No Reboots
Last login: Tue Aug 25 13:23:20 +0000 2015 on /dev/tty1.
core@localhost ~ $

you 'll find out that /Users is available (via NFS) already inside your VM. that will come handy when you come to play with docker volumes later...

usage
CoreOS over OSX made simple.
❯❯❯ http://github.com/TheNewNormal/corectl


Usage:
  corectl [flags]
  corectl [command]

Available Commands:
  rm          Removes one or more CoreOS images from local fs
  kill        Halts one or more running CoreOS instances
  ls          Lists locally available CoreOS images
  load        Loads from an instrumentation file (in TOML, JSON or YAML) one or more CoreOS instances
  version     Shows corectl version information
  ps          Lists running CoreOS instances
  pull        Pulls a CoreOS image from upstream
  run         Starts a new CoreOS instance
  ssh         Attach to or run commands inside a running CoreOS instance

Flags:
      --debug[=false]: adds extra verbosity, and options, for debugging purposes and/or power users

Use "corectl [command] --help" for more information about a command.

All flags can also be configured via upper-case environment variables prefixed with "COREOS_"
For example, "--debug" => "COREOS_DEBUG"

read here the full auto-generated documentation.

simple usage recipe: a docker and rkt playground
  • create a volume to store your persistent data. (will be /var/lib/{docker|rkt})

    ❯❯❯ dd if=/dev/zero of=var_lib_docker.img  bs=1G count=16
    

    in this case we created it with 16GB.

  • format it

    requires homebrew's e2fsprogs package installed.

    ❯❯❯ brew install e2fsprogs

    ❯❯❯ /usr/local/Cellar/e2fsprogs/1.42.12/sbin/mke2fs  -t ext4 -m0 -F var_lib_docker.img
    
  • label it

    ❯❯❯ /usr/local/Cellar/e2fsprogs/1.42.12/sbin/e2label var_lib_docker.img rkthdd
    

    here, we labeled our volume rkthdd which is the signature that our recipe expects.

    by relying in labels for volume identification we get around the issues we'd have otherwise if we were depending on the actual volume name (/dev/vd...) as those would have to be hardcoded (an issue, if one is mix and matching multiple recipes all dealing with different volumes...)

  • start your docker and rkt playground.

    ❯❯❯ sudo UUID=deadbeef-dead-dead-dead-deaddeafbeef \
      ./corectl run --volume absolute_or_relative_path/to/persistent.img \
      --cloud_config cloud-init/docker-only-with-persistent-storage.txt \
      --cpus 2 --memory 2048 --name containerland -d
    

this will start a VM named containerland in the background (-d) with the volume we created previously feeded, 2 virtual cores and 2GB of RAM. The provided cloud-config will format the given volume (if it wasn't yet) and bind mount both ``/var/lib/rktand/var/lib/docker` on top of it. docker will also become available through socket activation. above we passed arguments to the VM both via environment variables and command flags. both ways work, just use whatever suits your taste best.

Regarding docker, CoreOS shipped the 1.7 stream in all releases older than the 801.0.0 one. So, if you plan to run any of these releases, in order to talk to CoreOS' docker daemon you'll need on your Mac a matching docker client,as Homebrew is already defaulting on docker 1.8.x...

❯❯❯ brew remove docker
❯❯❯ brew tap homebrew/versions
❯❯❯ brew install docker171
  • now, from another shell in your mac...

    ❯❯❯ ./corectl ps
    

found 2 running VMs, summing 3 vCPUs and 4096MB in use.

  • containerland, alpha/794.0.0, PID 17645 (detached=true), up 1m28.687154135s

    • 2 vCPU(s), 2048 RAM
    • cloud-config: /Users/am/go/src/github.com/AntonioMeireles/corectl/cloud-init/docker-only-with-persistent-storage.txt
    • Network Interfaces:
      • eth0 (public interface) 192.168.64.14
    • Volumes:
      • /dev/vda (/Users/am/go/src/github.com/AntonioMeireles/corectl/var_lib_docker.img)
  • xpto, alpha/794.0.0, PID 17648 (detached=true), up 1m26.141238951s

    • 1 vCPU(s), 2048 RAM
    • Network Interfaces:
      • eth0 (public interface) 192.168.64.15
      • eth1 (private interface/tap0 on host)
    
    

    ❯❯❯ docker -H 192.168.64.220:2375 images -a REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE busybox latest 8c2e06607696 4 months ago 2.43 MB 6ce2e90b0bc7 4 months ago 2.43 MB

or ...

❯❯❯ ./corectl ssh containerland
Last login: Wed Sep  2 17:02:44 2015
CoreOS stable (789.0.0)
Update Strategy: No Reboots
core@localhost ~ $
❯❯❯ ./corectl ssh containerland "sudo rkt list"
UUID	ACI	STATE	NETWORKS

  • have fun!

projects using corectl

acknowledgements

contributing

corectl is an open source project under the Apache License, Version 2.0, ence contributions are gladly welcomed!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/deoxxa/gocpio
Package cpio implements access to cpio archives.
Package cpio implements access to cpio archives.
_workspace/src/github.com/google/go-github/github
Package github provides a client for using the GitHub API.
Package github provides a client for using the GitHub API.
_workspace/src/github.com/google/go-querystring/query
Package query implements encoding of structs into URL query parameters.
Package query implements encoding of structs into URL query parameters.
_workspace/src/github.com/hashicorp/hcl
Package hcl decodes HCL into usable Go structures.
Package hcl decodes HCL into usable Go structures.
_workspace/src/github.com/hashicorp/hcl/hcl/ast
Package ast declares the types used to represent syntax trees for HCL (HashiCorp Configuration Language)
Package ast declares the types used to represent syntax trees for HCL (HashiCorp Configuration Language)
_workspace/src/github.com/hashicorp/hcl/hcl/parser
Package parser implements a parser for HCL (HashiCorp Configuration Language)
Package parser implements a parser for HCL (HashiCorp Configuration Language)
_workspace/src/github.com/hashicorp/hcl/hcl/printer
Package printer implements printing of AST nodes to HCL format.
Package printer implements printing of AST nodes to HCL format.
_workspace/src/github.com/hashicorp/hcl/hcl/scanner
Package scanner implements a scanner for HCL (HashiCorp Configuration Language) source text.
Package scanner implements a scanner for HCL (HashiCorp Configuration Language) source text.
_workspace/src/github.com/hashicorp/hcl/hcl/token
Package token defines constants representing the lexical tokens for HCL (HashiCorp Configuration Language)
Package token defines constants representing the lexical tokens for HCL (HashiCorp Configuration Language)
_workspace/src/github.com/kr/fs
Package fs provides filesystem-related functions.
Package fs provides filesystem-related functions.
_workspace/src/github.com/kr/pretty
Package pretty provides pretty-printing for Go values.
Package pretty provides pretty-printing for Go values.
_workspace/src/github.com/kr/text
Package text provides rudimentary functions for manipulating text in paragraphs.
Package text provides rudimentary functions for manipulating text in paragraphs.
_workspace/src/github.com/kr/text/colwriter
Package colwriter provides a write filter that formats input lines in multiple columns.
Package colwriter provides a write filter that formats input lines in multiple columns.
_workspace/src/github.com/kr/text/mc
Command mc prints in multiple columns.
Command mc prints in multiple columns.
_workspace/src/github.com/magiconair/properties
Package properties provides functions for reading and writing ISO-8859-1 and UTF-8 encoded .properties files and has support for recursive property expansion.
Package properties provides functions for reading and writing ISO-8859-1 and UTF-8 encoded .properties files and has support for recursive property expansion.
_workspace/src/github.com/mitchellh/mapstructure
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
_workspace/src/github.com/pkg/sftp
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
_workspace/src/github.com/pkg/sftp/examples/buffered-read-benchmark
buffered-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to a []byte on the client via io.Copy.
buffered-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to a []byte on the client via io.Copy.
_workspace/src/github.com/pkg/sftp/examples/buffered-write-benchmark
buffered-write-benchmark benchmarks the peformance of writing a single large []byte on the client to /dev/null on the server via io.Copy.
buffered-write-benchmark benchmarks the peformance of writing a single large []byte on the client to /dev/null on the server via io.Copy.
_workspace/src/github.com/pkg/sftp/examples/sftp-server
An example SFTP server implementation using the golang SSH package.
An example SFTP server implementation using the golang SSH package.
_workspace/src/github.com/pkg/sftp/examples/streaming-read-benchmark
streaming-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to /dev/null on the client via io.Copy.
streaming-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to /dev/null on the client via io.Copy.
_workspace/src/github.com/pkg/sftp/examples/streaming-write-benchmark
streaming-write-benchmark benchmarks the peformance of writing from /dev/zero on the client to /dev/null on the server via io.Copy.
streaming-write-benchmark benchmarks the peformance of writing from /dev/zero on the client to /dev/null on the server via io.Copy.
_workspace/src/github.com/russross/blackfriday
Blackfriday markdown processor.
Blackfriday markdown processor.
_workspace/src/github.com/satori/go.uuid
Package uuid provides implementation of Universally Unique Identifier (UUID).
Package uuid provides implementation of Universally Unique Identifier (UUID).
_workspace/src/github.com/shurcooL/sanitized_anchor_name
Package sanitized_anchor_name provides a func to create sanitized anchor names.
Package sanitized_anchor_name provides a func to create sanitized anchor names.
_workspace/src/github.com/spf13/cobra
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
_workspace/src/github.com/spf13/pflag
Package pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
Package pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
_workspace/src/github.com/spf13/viper/remote
Package remote integrates the remote features of Viper.
Package remote integrates the remote features of Viper.
_workspace/src/github.com/yeonsh/go-ps
ps provides an API for finding and listing processes in a platform-agnostic way.
ps provides an API for finding and listing processes in a platform-agnostic way.
_workspace/src/golang.org/x/crypto/cast5
Package cast5 implements CAST5, as defined in RFC 2144.
Package cast5 implements CAST5, as defined in RFC 2144.
_workspace/src/golang.org/x/crypto/curve25519
Package curve25519 provides an implementation of scalar multiplication on the elliptic curve known as curve25519.
Package curve25519 provides an implementation of scalar multiplication on the elliptic curve known as curve25519.
_workspace/src/golang.org/x/crypto/openpgp
Package openpgp implements high level operations on OpenPGP messages.
Package openpgp implements high level operations on OpenPGP messages.
_workspace/src/golang.org/x/crypto/openpgp/armor
Package armor implements OpenPGP ASCII Armor, see RFC 4880.
Package armor implements OpenPGP ASCII Armor, see RFC 4880.
_workspace/src/golang.org/x/crypto/openpgp/clearsign
Package clearsign generates and processes OpenPGP, clear-signed data.
Package clearsign generates and processes OpenPGP, clear-signed data.
_workspace/src/golang.org/x/crypto/openpgp/elgamal
Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v.
Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v.
_workspace/src/golang.org/x/crypto/openpgp/errors
Package errors contains common error types for the OpenPGP packages.
Package errors contains common error types for the OpenPGP packages.
_workspace/src/golang.org/x/crypto/openpgp/packet
Package packet implements parsing and serialization of OpenPGP packets, as specified in RFC 4880.
Package packet implements parsing and serialization of OpenPGP packets, as specified in RFC 4880.
_workspace/src/golang.org/x/crypto/openpgp/s2k
Package s2k implements the various OpenPGP string-to-key transforms as specified in RFC 4800 section 3.7.1.
Package s2k implements the various OpenPGP string-to-key transforms as specified in RFC 4800 section 3.7.1.
_workspace/src/golang.org/x/crypto/ssh
Package ssh implements an SSH client and server.
Package ssh implements an SSH client and server.
_workspace/src/golang.org/x/crypto/ssh/agent
Package agent implements a client to an ssh-agent daemon.
Package agent implements a client to an ssh-agent daemon.
_workspace/src/golang.org/x/crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
_workspace/src/golang.org/x/crypto/ssh/test
This package contains integration tests for the golang.org/x/crypto/ssh package.
This package contains integration tests for the golang.org/x/crypto/ssh package.
_workspace/src/gopkg.in/fsnotify.v1
Package fsnotify provides a platform-independent interface for file system notifications.
Package fsnotify provides a platform-independent interface for file system notifications.
_workspace/src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
Package uuid2ip is a simple interface to interact with xhyve's networking
Package uuid2ip is a simple interface to interact with xhyve's networking

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL