os

command module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

README

RancherOS

The smallest, easiest way to run Docker in production at scale. Everything in RancherOS is a container managed by Docker. This includes system services such as udev and rsyslog. RancherOS includes only the bare minimum amount of software needed to run Docker. This keeps the binary download of RancherOS to about 20MB. Everything else can be pulled in dynamically through Docker.

How this works

Everything in RancherOS is a Docker container. We accomplish this by launching two instances of Docker. One is what we call the system Docker which runs as PID 1. System Docker then launches a container that runs the user Docker. The user Docker is then the instance that gets primarily used to create containers. We created this separation because it seemed logical and also it would really be bad if somebody did docker rm -f $(docker ps -qa) and deleted the entire OS.

How it works

Latest Release

v0.1.2 - Docker 1.5.0 - Linux 3.18.6

ISO

https://github.com/rancherio/os/releases/download/v0.1.2/rancheros.iso

Amazon
Region Type AMI
ap-northeast-1 PV ami-95db3395
ap-southeast-1 PV ami-64073136
ap-southeast-2 PV ami-c588f9ff
eu-west-1 PV ami-57cd5f20
sa-east-1 PV ami-a311a8be
us-east-1 PV ami-90f6d3f8
us-west-1 PV ami-5992751d
us-west-2 PV ami-2b67451b

SSH keys are added to the rancher user.

Running

Cloud

Currently we only have RancherOS available in EC2 but more clouds will come based on demand. Follow the links in the Release section above to deploy using our AMIs.

Vagrant

Vagrant is the simplest way to try out RancherOS from the desktop. Refer to the RancherOS Vagrant project

Other

QEMU, VirtualBox, and VMware are all supported. Just boot from the rancheros.iso with at least 1GB of memory.

Logging in

If you are using EC2 or Vagrant then SSH keys are properly put into place. This means ssh -i <KEY> -l rancher <IP> for EC2 and vagrant ssh for Vagrant.

If you boot with the ISO the login is hard coded to rancher/rancher. Only the ISO has the password hard coded. If you run from a cloud or install to disk, SSH keys or a password of your choice is expected to be used.

Persisting State

If you are running from the ISO RancherOS will be running from memory. In order to persist to disk you need to format a file system with the label RANCHER_STATE. For example

docker run --privileged -it debian mkfs.ext4 -L RANCHER_STATE /dev/sda

Installing to Disk

To install RancherOS on a new disk you can now use the rancheros-install command.

For non-ec2 installs, before getting started create a cloud-init file that will provide your initial ssh keys. At a minimum something like:

 #cloud-config
 ssh_authorized_keys:
  - ssh-rsa AAA... user@rancher

See section below for current supported cloud-init functionality.

The command arguments are as follows:

Usage:
  rancheros-install [options]
Options:
  -c cloud-config file
      needed for SSH keys.
  -d device
  -f [ DANGEROUS! Data loss can happen ] partition/format without prompting
  -t install-type:
       generic
       amazon-ebs
  -v os-installer version.
  -h print this

This command orchestrates installation from the rancher/os-installer container.

####Examples: Virtualbox installation:

sudo rancheros-install -d /dev/sda -c ./cloud_data.yml -v v0.1.1 -t generic

Configuring

The entire state of RancherOS is controlled by a single configuration document. Please refer to the full documentation.

Cloud Init

We currently support a very small portion of cloud-init. If the user_data is a script (starting with the proper #!) we will execute it. If the user_data starts with #cloud-config it will be processed by cloud-init. The below directives are supported.

#cloud-config

ssh_authorized_keys:
  - ssh-rsa AAA... darren@rancher

write_files:
  write_files:
  - path: /opt/rancher/bin/start.sh
    permissions: 0755
    owner: root
    content: |
      #!/bin/bash
      echo "I'm doing things on start"

Useful Commands

Command Description
docker Good old Docker, use that to run stuff.
system-docker The docker instance running the system containers. Must run as root or using sudo
rancherctl Control and configure RancherOS

Customizing the console

Since RancherOS is so small the default console is based off of Busybox. This it not always the best experience. The intention with RancherOS is to allow you to swap out different consoles with something like Ubuntu, Fedora, or CentOS. Currently we have Ubuntu configured but we will add more. To enable the Ubuntu console do the following.

sudo rancherctl addon enable ubuntu-console

Run the above but with disable to turn it off. Currently you have to reboot the system to enable the new console. I the future it will be dynamic and just require you to log out and back in.

Console is ephemeral

The console (and all system containers) are ephemeral. This means on each reboot of the system all changes to the console are lost. Any changes in /home or /opt will be persisted though. Additionally, on startup of the console container, if /opt/rancher/bin/start.sh exists, it will be executed. You can add anything to that script to configure your console the way you want it.

In the future we will allow one to provide a custom image for the console container, but we just haven't gotten around yet to enabling that.

Building

Docker 1.5+ required.

./build.sh

When the build is done the ISO should be in dist/artifacts

Developing

Development is easiest done with QEMU on Linux. If you aren't running Linux natively then we recommend you run VMware Fusion/Workstation and enable VT-x support. Then, QEMU (with KVM support) will run sufficiently fast inside a Linux VM.

First run ./build.sh to create the initial bootstrap Docker images. After that if you make changes to the go code only run ./scripts/build. To launch RancherOS in QEMU from your dev version run ./scripts/run. You can SSH in using ssh -l rancher -p 2222 localhost. Your SSH keys should have been populated so you won't need a password. If you don't have SSH keys then the password is "rancher".

#License Copyright (c) 2014-2015 Rancher Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/codegangsta/cli
Package cli provides a minimal framework for creating and organizing command line Go applications.
Package cli provides a minimal framework for creating and organizing command line Go applications.
_workspace/src/github.com/coreos/go-systemd/dbus
Integration with the systemd D-Bus API.
Integration with the systemd D-Bus API.
_workspace/src/github.com/coreos/yaml
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
_workspace/src/github.com/docker/docker/api/stats
This package is used for API stability in the types and response to the consumers of the API stats endpoint.
This package is used for API stability in the types and response to the consumers of the API stats endpoint.
_workspace/src/github.com/docker/docker/pkg/mflag
Package flag implements command-line flag parsing.
Package flag implements command-line flag parsing.
_workspace/src/github.com/docker/docker/pkg/pools
Package pools provides a collection of pools which provide various data types with buffers.
Package pools provides a collection of pools which provide various data types with buffers.
_workspace/src/github.com/docker/libcontainer/netlink
Packet netlink provide access to low level Netlink sockets and messages.
Packet netlink provide access to low level Netlink sockets and messages.
_workspace/src/github.com/docker/libtrust
Package libtrust provides an interface for managing authentication and authorization using public key cryptography.
Package libtrust provides an interface for managing authentication and authorization using public key cryptography.
_workspace/src/github.com/fsouza/go-dockerclient
Package docker provides a client for the Docker remote API.
Package docker provides a client for the Docker remote API.
_workspace/src/github.com/fsouza/go-dockerclient/testing
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
_workspace/src/github.com/guelfey/go.dbus
Package dbus implements bindings to the D-Bus message bus system.
Package dbus implements bindings to the D-Bus message bus system.
_workspace/src/github.com/guelfey/go.dbus/introspect
Package introspect provides some utilities for dealing with the DBus introspection format.
Package introspect provides some utilities for dealing with the DBus introspection format.
_workspace/src/github.com/guelfey/go.dbus/prop
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
_workspace/src/github.com/kless/term
Package term provides a portable interface for terminal I/O. It manages input and output (I/O) for character-mode applications.
Package term provides a portable interface for terminal I/O. It manages input and output (I/O) for character-mode applications.
_workspace/src/github.com/kless/term/readline
Package readline provides simple functions for both line and screen editing.
Package readline provides simple functions for both line and screen editing.
_workspace/src/github.com/kless/term/sys
Package sys contains low-level operating system primitives of the term.
Package sys contains low-level operating system primitives of the term.
_workspace/src/github.com/kless/term/test
Package test checks the functions that depend of the standard input, which is changed by `go test` to the standard error.
Package test checks the functions that depend of the standard input, which is changed by `go test` to the standard error.
_workspace/src/github.com/vishvananda/netlink
Package netlink provides a simple library for netlink.
Package netlink provides a simple library for netlink.
_workspace/src/github.com/vishvananda/netlink/nl
Package nl has low level primitives for making Netlink calls.
Package nl has low level primitives for making Netlink calls.
_workspace/src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
cmd

Jump to

Keyboard shortcuts

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