All Projects → JonasProgrammer → Docker Machine Driver Hetzner

JonasProgrammer / Docker Machine Driver Hetzner

Licence: mit
Docker machine driver for the new hetzner cloud API

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Docker Machine Driver Hetzner

node-docker-machine
Programmatic API to Docker Machine.
Stars: ✭ 21 (-93.18%)
Mutual labels:  machine, docker-machine
Docker Machine Driver Pwd
Docker machine PWD driver
Stars: ✭ 54 (-82.47%)
Mutual labels:  driver, machine
reinforcement-learning-resources
A curated list of awesome reinforcement courses, video lectures, books, library and many more.
Stars: ✭ 38 (-87.66%)
Mutual labels:  machine
Vjoy
Virtual Joystick
Stars: ✭ 284 (-7.79%)
Mutual labels:  driver
Displaylink Rpm
RPM sources for the DisplayLink USB display adapters
Stars: ✭ 266 (-13.64%)
Mutual labels:  driver
machine
Machine setup, powered by Ansible
Stars: ✭ 48 (-84.42%)
Mutual labels:  machine
Efifs
EFI FileSystem drivers
Stars: ✭ 272 (-11.69%)
Mutual labels:  driver
Si446x
Si4463 Radio Library for AVR and Arduino
Stars: ✭ 52 (-83.12%)
Mutual labels:  driver
Sharplearning
Machine learning for C# .Net
Stars: ✭ 294 (-4.55%)
Mutual labels:  machine
Ur modern driver
(deprecated) ROS 1 driver for CB1 and CB2 controllers with UR5 or UR10 robots from Universal Robots
Stars: ✭ 265 (-13.96%)
Mutual labels:  driver
Psycopg3
New generation PostgreSQL database adapter for the Python programming language
Stars: ✭ 278 (-9.74%)
Mutual labels:  driver
Rtl8723bs
Realtek SDIO Wi-Fi driver
Stars: ✭ 260 (-15.58%)
Mutual labels:  driver
arangodb-java-driver-async
ArangoDB Asynchronous Java driver
Stars: ✭ 45 (-85.39%)
Mutual labels:  driver
Mirage
kernel-mode Anti-Anti-Debug plugin. based on intel vt-x && ept technology
Stars: ✭ 272 (-11.69%)
Mutual labels:  driver
ros-tritech-micron
🔊 Tritech Micron SONAR ROS driver
Stars: ✭ 19 (-93.83%)
Mutual labels:  driver
Winfsp
Windows File System Proxy - FUSE for Windows
Stars: ✭ 4,071 (+1221.75%)
Mutual labels:  driver
kuka
ROS-Industrial KUKA support (http://wiki.ros.org/kuka)
Stars: ✭ 23 (-92.53%)
Mutual labels:  driver
Neo4j Go Driver
Neo4j Bolt Driver for Go
Stars: ✭ 258 (-16.23%)
Mutual labels:  driver
Razer Laptop Control
Project to create driver/software to control performance of razer laptops
Stars: ✭ 268 (-12.99%)
Mutual labels:  driver
Vertica Python
Official native Python client for the Vertica Analytics Database.
Stars: ✭ 301 (-2.27%)
Mutual labels:  driver

Hetzner Cloud Docker machine driver

Go Report Card License Build Status

This library adds the support for creating Docker machines hosted on the Hetzner Cloud.

You need to create a project-specific access token under Access > API Tokens in the project control panel and pass that to docker-machine create with the --hetzner-api-token option.

Installation

You can find sources and pre-compiled binaries here.

# Download the binary (this example downloads the binary for linux amd64)
$ wget https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/3.3.0/docker-machine-driver-hetzner_3.3.0_linux_amd64.tar.gz
$ tar -xvf docker-machine-driver-hetzner_3.3.0_linux_amd64.tar.gz

# Make it executable and copy the binary in a directory accessible with your $PATH
$ chmod +x docker-machine-driver-hetzner
$ cp docker-machine-driver-hetzner /usr/local/bin/

Usage

$ docker-machine create \
  --driver hetzner \
  --hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
  some-machine

Using environment variables

$ HETZNER_API_TOKEN=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
  && HETZNER_IMAGE=centos-7 \
  && docker-machine create \
     --driver hetzner \
     some-machine

Dealing with kernels without aufs

If you use an image without aufs, like the one currently supplied with the debian-9 image, you can try specifying another storage driver, such as overlay2. Like so:

$ docker-machine create \
  --engine-storage-driver overlay2 \
  --driver hetzner \
  --hetzner-image debian-9 \
  --hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
  some-machine

Using Cloud-init

$ CLOUD_INIT_USER_DATA=`cat <<EOF
#cloud-config
write_files:
  - path: /test.txt
    content: |
      Here is a line.
      Another line is here.
EOF
`

$ docker-machine create \
  --driver hetzner \
  --hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
  --hetzner-user-data="${CLOUD_INIT_USER_DATA}" \
  some-machine

Using a snapshot

Assuming your snapshot ID is 424242:

$ docker-machine create \
  --driver hetzner \
  --hetzner-api-token=QJhoRT38JfAUO037PWJ5Zt9iAABIxdxdh4gPqNkUGKIrUMd6I3cPIsfKozI513sy \
  --hetzner-image-id=424242 \
  some-machine

Options

  • --hetzner-api-token: required. Your project-specific access token for the Hetzner Cloud API.
  • --hetzner-image: The name of the Hetzner Cloud image to use, see Images API for how to get a list (defaults to ubuntu-18.04).
  • --hetzner-image-id: The id of the Hetzner cloud image (or snapshot) to use, see Images API for how to get a list (mutually excludes --hetzner-image).
  • --hetzner-server-type: The type of the Hetzner Cloud server, see Server Types API for how to get a list (defaults to cx11).
  • --hetzner-server-location: The location to create the server in, see Locations API for how to get a list.
  • --hetzner-existing-key-path: Use an existing (local) SSH key instead of generating a new keypair. If a remote key with a matching fingerprint exists, it will be used as if specified using --hetzner-existing-key-id, rather than uploading a new key.
  • --hetzner-existing-key-id: requires --hetzner-existing-key-path. Use an existing (remote) SSH key instead of uploading the imported key pair, see SSH Keys API for how to get a list
  • --hetzner-additional-key: Upload an additional public key associated with the server, or associate an existing one with the same fingerprint. Can be specified multiple times.
  • --hetzner-user-data: Cloud-init based User data
  • --hetzner-volumes: Volume IDs or names which should be attached to the server
  • --hetzner-networks: Network IDs or names which should be attached to the server private network interface
  • --hetzner-use-private-network: Use private network
  • --hetzner-firewalls: Firewall IDs or names which should be applied on the server
  • --hetzner-server-label: key=value pairs of additional metadata to assign to the server.

Existing SSH keys

When you specify the --hetzner-existing-key-path option, the driver will attempt to copy (specified file name) and (specified file name).pub to the machine's store path. They public key file's permissions will be set according to your current umask and the private key file will have 600 permissions.

When you additionally specify the --hetzner-existing-key-id option, the driver will not create an SSH key using the API but rather try to use the existing public key corresponding to the given id. Please note that during machine creation, the driver will attempt to get the key and compare it's fingerprint to the local public key's fingerprtint. Keep in mind that the both the local and the remote key must be accessible and have matching fingerprints, otherwise the machine will fail it's pre-creation checks.

Also note that the driver will attempt to delete the linked key during machine removal, unless --hetzner-existing-key-id was used during creation.

Environment variables and default values

CLI option Environment variable Default
--hetzner-api-token HETZNER_API_TOKEN -
--hetzner-image HETZNER_IMAGE ubuntu-18.04
--hetzner-image-id HETZNER_IMAGE_ID -
--hetzner-server-type HETZNER_TYPE cx11
--hetzner-server-location HETZNER_LOCATION - (let Hetzner choose)
--hetzner-existing-key-path HETZNER_EXISTING_KEY_PATH - (generate new keypair)
--hetzner-existing-key-id HETZNER_EXISTING_KEY_ID 0 (upload new key)
--hetzner-additional-key HETZNER_ADDITIONAL_KEYS -
--hetzner-user-data HETZNER_USER_DATA -
--hetzner-networks HETZNER_NETWORKS -
--hetzner-firewalls HETZNER_FIREWALLS -
--hetzner-volumes HETZNER_VOLUMES -
--hetzner-use-private-network HETZNER_USE_PRIVATE_NETWORK false
--hetzner-server-label HETZNER_SERVER_LABELS []

Building from source

Use an up-to-date version of Go to use Go Modules.

To use the driver, you can download the sources and build it locally:

# Enable Go Modules if you are not outside of your $GOPATH
$ export GO111MODULE=on

# Get sources and build the binary at ~/go/bin/docker-machine-driver-hetzner
$ go get github.com/jonasprogrammer/docker-machine-driver-hetzner

# Make the binary accessible to docker-machine
$ export GOPATH=$(go env GOPATH)
$ export GOBIN=$GOPATH/bin
$ export PATH="$PATH:$GOBIN"
$ cd $GOPATH/src/jonasprogrammer/docker-machine-driver-hetzner
$ go build -o docker-machine-driver-hetzner
$ cp docker-machine-driver-hetzner /usr/local/bin/docker-machine-driver-hetzner

Development

Fork this repository, yielding github.com/<yourAccount>/docker-machine-driver-hetzner.

# Get the sources of your fork and build it locally
$ go get github.com/<yourAccount>/docker-machine-driver-hetzner

# * This integrates your fork into the $GOPATH (typically pointing at ~/go)
# * Your sources are at $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner
# * That folder is a local Git repository. You can pull, commit and push from there.
# * The binary will typically be at $GOPATH/bin/docker-machine-driver-hetzner
# * In the source directory $GOPATH/src/github.com/<yourAccount>/docker-machine-driver-hetzner
#   you may use go get to re-build the binary.
# * Note: when you build the driver from different repositories, e.g. from your fork
#   as well as github.com/jonasprogrammer/docker-machine-driver-hetzner,
#   the binary files generated by these builds are all called the same
#   and will hence override each other.

# Make the binary accessible to docker-machine
$ export GOPATH=$(go env GOPATH)
$ export GOBIN=$GOPATH/bin
$ export PATH="$PATH:$GOBIN"

# Make docker-machine output help including hetzner-specific options
$ docker-machine create --driver hetzner
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].