Minimal Vagrantfile for CoreOS
Ruby Shell
Pull request Compare This branch is 2 commits ahead, 11 commits behind coreos:master.
Permalink
Failed to load latest commit information.
docs
host/bin
modules
.gitattributes
.gitignore
CONTRIBUTING.md
DCO
LICENSE
MAINTAINERS
NOTICE
README.md
Vagrantfile
config.rb.2.sample
config.rb.sample
sync-folders.yml.sample
user-data.2.sample
user-data.sample
utils.rb

README.md

CoreOS Vagrant

This repo provides a template Vagrantfile to create a CoreOS virtual machine using the VirtualBox software hypervisor. After setup is complete you will have a single CoreOS virtual machine running on your local machine.

Streamlined setup

1) Install dependencies

2) Clone this project and get it running!

git clone https://github.com/coreos/coreos-vagrant/
cd coreos-vagrant

3) Startup and SSH

There are two "providers" for Vagrant with slightly different instructions. Follow one of the following two options:

VirtualBox Provider

The VirtualBox provider is the default Vagrant provider. Use this if you are unsure.

vagrant up
vagrant ssh

VMware Provider

The VMware provider is a commercial addon from Hashicorp that offers better stability and speed. If you use this provider follow these instructions.

VMware Fusion:

vagrant up --provider vmware_fusion
vagrant ssh

VMware Workstation:

vagrant up --provider vmware_workstation
vagrant ssh

vagrant up triggers vagrant to download the CoreOS image (if necessary) and (re)launch the instance

vagrant ssh connects you to the virtual machine. Configuration is stored in the directory so you can always return to this machine by executing vagrant ssh from the directory where the Vagrantfile was located.

4) Get started using CoreOS

Shared Folder Setup

NFS

There is optional shared folder setup. You can try it out by adding a section to your Vagrantfile like this.

config.vm.network "private_network", ip: "172.17.8.150"
config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true,  :mount_options   => ['nolock,vers=3,udp']

After a 'vagrant reload' you will be prompted for your local machine password.

Samba

On windows, prefers samba for simplicity and performance. Completly inspired by https://github.com/blinkreaction/boot2docker-vagrant You will find utils.rb which contains code to mount any type of endpoint and sync-folders.yml which contains share parameters. take a look at this file for more configuration details (samba version, domain, ...etc).

Provisioning with user-data

The Vagrantfile will provision your CoreOS VM(s) with coreos-cloudinit if a user-data file is found in the project directory. coreos-cloudinit simplifies the provisioning process through the use of a script or cloud-config document.

To get started, copy user-data.sample or user-data.x.sample to user-data and make any necessary modifications. Check out the coreos-cloudinit documentation to learn about the available features.

Reapply user-data on prexistant instance

command line option : '--reapply-user-data' force coreos on startup to reapply your user-data. e.g.:

vagrant  --reapply-user-data up

Configuration

The Vagrantfile will parse a config.rb file containing a set of options used to configure your CoreOS cluster. See config.rb.sample for more information.

Cluster Setup

Launching a CoreOS cluster on Vagrant is as simple as configuring $num_instances in a config.rb file to 3 (or more!) and running vagrant up. Make sure you provide a fresh discovery URL in your user-data if you wish to bootstrap etcd in your cluster.

Proxy

You set proxy information in config.rb with vagrant_proxy_* variable

Docker Docker Swarm / Manager

You can enable Docker Swarm by setting to true

$vagrant_module_docker_compose=true
$vagrant_module_docker_swarm=true

Systemd-docker

a provision script is call to install systemd-docker.

New Box Versions

CoreOS is a rolling release distribution and versions that are out of date will automatically update. If you want to start from the most up to date version you will need to make sure that you have the latest box file of CoreOS. Simply remove the old box file and vagrant will download the latest one the next time you vagrant up.

vagrant box remove coreos --provider vmware_fusion
vagrant box remove coreos --provider vmware_workstation
vagrant box remove coreos --provider virtualbox

Docker Forwarding

By setting the $expose_docker_tcp configuration value you can forward a local TCP port to docker on each CoreOS machine that you launch. The first machine will be available on the port that you specify and each additional machine will increment the port by 1.

Follow the Enable Remote API instructions to get the CoreOS VM setup to work with port forwarding.

Then you can then use the docker command from your local shell by setting DOCKER_HOST:

export DOCKER_HOST=tcp://localhost:2375

More information on this fork

Docker sur CoreOS par Vagrant Déployer Docker Compose et Swarm sur coreOS Truc et astuces sur Systemd et CoreOs