A beaker extension for provision Hetzner Cloud instances.
Include this gem alongside Beaker in your Gemfile or project.gemspec. E.g.
# Gemfile
gem 'beaker', '~> 5.0'
gem 'beaker-hcloud'
# project.gemspec
s.add_runtime_dependency 'beaker', '~> 5.0'
s.add_runtime_dependency 'beaker-hcloud'
You need to create an API token using Hetzner's cloud console. Make sure to create the token in the correct project.
beaker-hcloud
expects the token to be in the BEAKER_HCLOUD_TOKEN
environment variable.
Some options can be set to influence how and where server instances are being created:
configuration option | required | default | description |
---|---|---|---|
image |
true | The name of one of Hetzner's provided images, e.g. ubuntu-20.04 , or a custom one, i.e. a snapshot in your account. |
|
server_type |
false | cx11 |
Hetzner cloud server type |
location |
false | nbg1 |
One of Hetzner's datacenter locations |
Every created cloud instance gets a label delete_vm_after: 1698792887
. By
default this is the UNIX timestamp during VM creation + an hour.
You can modify the default of an hour by setting the BEAKER_HCLOUD_DELETE_VM_AFTER
environment variable to any positive integer. It will be interpreted as seconds.
In cases where the beaker process is killed before finishing, it may leave
resources in Hetzner cloud. These will need to be manually deleted. Look for
servers in your project named exactly as the ones in your beaker host
configuration and SSH keys with names beginning with Beaker-
.
You can also periodically scan for VMs where the delete_vm_after
points to a
past timestamp and delete them.
Please refer to voxpupuli/beaker's contributing guide.