Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Broer committed Oct 21, 2015
0 parents commit 0d92f0b
Show file tree
Hide file tree
Showing 8 changed files with 630 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docker-machine-vultr
build
dist
release
*.gz
3 changes: 3 additions & 0 deletions GLOCKFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github.com/ChimeraCoder/tokenbucket c5a927568de7aad8a58127d80bcd36ca4e71e454
github.com/JamesClonk/vultr 4386952ceeef607ce017e1003d88800c7662ee70
github.com/docker/machine 4c5615c5e49cab280fad3ba53df1ed97c961e619
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.PHONY : build clean fmt release

NAME=docker-machine-vultr
VERSION:=$(shell git describe --abbrev=0 --tags)

#ifdef $CIRCLE_BUILD_NUM
ifneq ($(CIRCLE_BUILD_NUM),)
BUILD:=$(VERSION)-$(CIRCLE_BUILD_NUM)
else
BUILD:=$(VERSION)
endif

LDFLAGS:=-X main.Version=$(VERSION)

all: build

build:
mkdir -p build
go build -ldflags "$(LDFLAGS)" -o build/$(NAME)-$(BUILD) ./bin

dist-clean:
rm -rf dist
rm -rf release

dist: dist-clean
mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/linux/amd64/$(NAME) ./bin
mkdir -p dist/linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -o dist/linux/armhf/$(NAME) ./bin
mkdir -p dist/darwin/amd64 && GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/$(NAME) ./bin
mkdir -p dist/windows/amd64 && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/windows/amd64/$(NAME) ./bin

release: dist
glock sync -n < GLOCKFILE
mkdir -p release
tar -cvzf release/$(NAME)-$(VERSION)-linux-amd64.tar.gz -C dist/linux/amd64 $(NAME)
tar -cvzf release/$(NAME)-$(VERSION)-linux-armhf.tar.gz -C dist/linux/armhf $(NAME)
tar -cvzf release/$(NAME)-$(VERSION)-darwin-amd64.tar.gz -C dist/darwin/amd64 $(NAME)
tar -cvzf release/$(NAME)-$(VERSION)-windows-amd64.tar.gz -C dist/windows/amd64 $(NAME).exe
ghr -t $GITHUB_TOKEN -u janeczku -r $(NAME) --replace $(VERSION) release/

get-deps:
go get github.com/robfig/glock
go get github.com/tcnksm/ghr
glock sync -n < GLOCKFILE
#go get -d -t ./bin

check-gofmt:
if [ -n "$(shell gofmt -l .)" ]; then \
echo 1>&2 'The following files need to be formatted:'; \
gofmt -l .; \
exit 1; \
fi

test:
go vet .
go test -race ./...
53 changes: 53 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!--[metadata]>
+++
title = "Vultr"
description = "Vultr driver for docker machine"
keywords = ["machine, Vultr, driver, docker"]
[menu.main]
parent="smn_machine_drivers"
+++
<![end-metadata]-->

# Vultr driver plugin for Docker Machine

Requires [Docker Machine](https://github.com/docker/machine)!

This plugin let's you create machines on the [Vultr](https://www.vultr.com/) cloud.

## Installation

Todo.

## Usage instructions

Get your API key from the [Vultr control panel](https://my.vultr.com/settings/) and pass
that to `docker-machine create` with the `--vultr-api-key` option.

$ docker-machine create --driver vultr --vultr-api-key=aa9399a2175a93b17b1c86c807e08d3fc4b test-vps

Options:

- `--vultr-api-key`: **required** Your Vultr API key.
- `--vultr-os-id`: Operating system ID (OSID) to use. See [API OS endpoint](https://www.vultr.com/api/#os_os_list).
- `--vultr-region-id`: ID of the region to create the VPS in. See [API Region endpoint](https://www.vultr.com/api/#regions_region_list).
- `--vultr-plan-id`: Plan ID (VPSPLANID).
- `--vultr-ipv6`: Enable IPv6 support for the VPS.
- `--vultr-private-networking`: Enable private networking support for the VPS.
- `--vultr-backups`: Enable automatic backups for the VPS.

The Vultr driver uses OS ID `160` (Ubuntu 14.04 x64) by default.
Since the deployment of an Ubuntu machine on Vultr can take several minutes, you can alternatively do an iPXE-based deployment of [RancherOS](http://rancher.com/rancher-os/) by supplying the following flag:

--vultr-os-id=159

Environment variables and default values:

| CLI option | Environment variable | Default |
|---------------------------------|------------------------------|--------------------|
| **`--vultr-api-key`** | `VULTR_API_KEY` | - |
| `--vultr-os-id` | `VULTR_OS` | *Ubuntu 14.04 x64* |
| `--vultr-region-id` | `VULTR_REGION` | *New Jersey* |
| `--vultr-plan-id` | `VULTR_PLAN` | *768 MB RAM* |
| `--vultr-ipv6` | `VULTR_IPV6` | `false` |
| `--vultr-private-networking` | `VULTR_PRIVATE_NETWORKING` | `false` |
| `--vultr-backups` | `VULTR_BACKUPS` | `false` |
12 changes: 12 additions & 0 deletions bin/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/docker/machine/libmachine/drivers/plugin"
"github.com/janeczku/docker-machine-vultr"
)

var Version string

func main() {
plugin.RegisterDriver(vultr.NewDriver("", ""))
}
18 changes: 18 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dependencies:
pre:
- go version
override:
- make get-deps
- make build
post:
- cp build/* $CIRCLE_ARTIFACTS

test:
override:
- /bin/true

deployment:
release:
branch: release
commands:
- make release
Loading

0 comments on commit 0d92f0b

Please sign in to comment.