This repository contains the source code that implements the Hetzner cloud provider for the Eleven CLI.
eleven hetzner --context production --region fsn1 init eleven-api --instance-type cx21
To begin, create your first sandbox using the command:
eleven hetzner init <sandbox_name>
Once created, you may want to connect your editor to it using the command:
eleven hetzner edit <sandbox_name>
If you don't plan to use this sandbox again, you could remove it using the command:
eleven hetzner remove <sandbox_name>
Usage:
eleven hetzner [command]
Examples:
eleven hetzner init eleven-api --instance-type cx21
eleven hetzner edit eleven-api
eleven hetzner remove eleven-api
Available Commands:
edit Connect your editor to a sandbox
init Initialize a sandbox
remove Remove a sandbox
serve Allow TCP traffic on a port
uninstall Uninstall Eleven
unserve Disallow TCP traffic on a port
Flags:
--context string the configuration context to use to access your Hetzner account
-h, --help help for hetzner
--region string the region to use to access your Hetzner account
Use "eleven hetzner [command] --help" for more information about a command.
In order to access your Hetzner account, the Eleven CLI will first look for credentials in the following environment variable:
HCLOUD_TOKEN
If not found, the configuration files created by the Hetzner CLI (via hcloud context create
) will be used.
If you have configured the Hetzner CLI with multiple configuration contexts, you could tell Eleven which one to use via the --context
flag:
eleven hetzner --context production init eleven-api
By default, Eleven will use the active
context.
If you want to overwrite the region resolved by the Eleven CLI, you could use the --region
flag:
eleven hetzner --region fsn1 init eleven-api
eleven hetzner --context production --region fsn1 init eleven-api
or the HCLOUD_REGION
environment variable:
export HCLOUD_REGION=fsn1
The --region
flag takes precedence over the HCLOUD_REGION
environment variable.
Your API token needs to have Read & Write
permissions. (See the next sections to learn more about the actions that will be done on your behalf).
To be used with Eleven, the chosen instance must be a cloud instance.
cx11, cpx31, cx51...
The schema above describe all the components that may be created in your Hetzner account. The next sections will describe their lifetime according to your use of the Eleven CLI.
eleven hetzner init eleven-api
eleven hetzner init eleven-api --instance-type cx11
When running the init
command for the first time in a region, the following components will be created:
-
A
network
namedeleven-network
with an IPv4 CIDR block equals to10.0.0.0/16
to isolate your infrastructure. -
A
subnet
with an IPv4 CIDR block equals to10.0.0.0/24
that will contain the servers running your sandboxes.
Each time the init
command is run for a new sandbox, the following components will be created:
-
A
server
namedeleven-${SANDBOX_NAME}-server
with a type equals to the one passed via the--instance-type
flag orcx11
by default. -
A
firewall
namedeleven-${SANDBOX_NAME}-firewall
to let the server acceptsTCP
connections on served ports. -
An
SSH key
namedeleven-${SANDBOX_NAME}-ssh-key
to let you access the server viaSSH
.
eleven hetzner edit eleven-api
When running the edit
command, nothing will be done to your infrastructure.
eleven hetzner serve eleven-api 8080
eleven hetzner serve eleven-api 8080 --as api.eleven.sh
When running the serve
command without the --as
flag, an inbound
rule will be added to the firewall
of the server running your sandbox.
This rule will allow all TCP
traffic from any IP address
to the specified port.
When the --as
flag is used, nothing is done to your infrastructure.
eleven hetzner unserve eleven-api 8080
When running the unserve
command, the inbound
rule added by the serve
command will be removed.
eleven hetzner remove eleven-api
When running the remove
command, all the components associated with the sandbox will be removed.
In other words:
-
The
server
. -
The
firewall
. -
The
SSH key
.
eleven hetzner uninstall
When running the uninstall
command, all the components shared by your sandboxes in the resolved region will be removed.
In other words:
-
The
subnet
. -
The
network
.
The cost of running a sandbox on Hetzner is equal to the cost of the cloud server
used.
All other components are 100% free.
Eleven is available as open source under the terms of the MIT License.