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 cx21To 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-apiBy 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-apieleven hetzner --context production --region fsn1 init eleven-apior the HCLOUD_REGION environment variable:
export HCLOUD_REGION=fsn1The --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 cx11When running the init command for the first time in a region, the following components will be created:
-
A
networknamedeleven-networkwith an IPv4 CIDR block equals to10.0.0.0/16to isolate your infrastructure. -
A
subnetwith an IPv4 CIDR block equals to10.0.0.0/24that 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
servernamedeleven-${SANDBOX_NAME}-serverwith a type equals to the one passed via the--instance-typeflag orcx11by default. -
A
firewallnamedeleven-${SANDBOX_NAME}-firewallto let the server acceptsTCPconnections on served ports. -
An
SSH keynamedeleven-${SANDBOX_NAME}-ssh-keyto let you access the server viaSSH.
eleven hetzner edit eleven-apiWhen 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.shWhen 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 8080When running the unserve command, the inbound rule added by the serve command will be removed.
eleven hetzner remove eleven-apiWhen 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 uninstallWhen 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.