All Projects → jonamat → hetzner-rescaler

jonamat / hetzner-rescaler

Licence: MIT license
Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to hetzner-rescaler

hetzner-k3s
A Ruby gem (and Docker image) to install and manage Kubernetes clusters in Hetzner Cloud using the lightweight distribution k3s by Rancher.
Stars: ✭ 201 (+356.82%)
Mutual labels:  hetzner, hetzner-cloud, hetzner-api
ui-driver-hetzner
Rancher UI driver for the Hetzner Cloud docker driver.
Stars: ✭ 238 (+440.91%)
Mutual labels:  hetzner, hetzner-cloud
hcloud-pricing-exporter
A prometheus exporter for the current pricing and costs of your HCloud account
Stars: ✭ 19 (-56.82%)
Mutual labels:  hetzner, hetzner-cloud
hcloud-rust
Unofficial Rust crate for accessing the Hetzner Cloud API
Stars: ✭ 22 (-50%)
Mutual labels:  hetzner, hetzner-cloud
minectl
minectl 🗺 is a cli for creating Minecraft server on different cloud provider.
Stars: ✭ 85 (+93.18%)
Mutual labels:  hetzner, hetzner-cloud
hetzner.hcloud
A collection containing modules to manage resources on the Hetzner Cloud.
Stars: ✭ 58 (+31.82%)
Mutual labels:  hetzner, hetzner-cloud
molecule-hetznercloud
Molecule Hetzner Cloud driver 💀
Stars: ✭ 21 (-52.27%)
Mutual labels:  hetzner, hetzner-cloud
docker-volume-hetzner
Docker Volume Plugin for accessing Hetzner Cloud Volumes
Stars: ✭ 81 (+84.09%)
Mutual labels:  hetzner, hetzner-cloud
hcloud-ruby
Native ruby client for HetznerCloud
Stars: ✭ 29 (-34.09%)
Mutual labels:  hetzner, hetzner-cloud
packer-builder-hcloud
Packer builder plugin for Hetzner Cloud - https://hetzner.cloud
Stars: ✭ 24 (-45.45%)
Mutual labels:  hetzner, hetzner-cloud
wireguard-setup
WireGuard and Unbound setup with Packer and Terraform.
Stars: ✭ 55 (+25%)
Mutual labels:  hetzner, hetzner-cloud
disk-encryption-hetzner
Encrypt a hetzner server from the "serverbörse" and unlock it remote via ssh
Stars: ✭ 122 (+177.27%)
Mutual labels:  hetzner
kube-hetzner
Optimized and Maintenance-free Kubernetes on Hetzner Cloud in one command!
Stars: ✭ 937 (+2029.55%)
Mutual labels:  hetzner-cloud
prometheus-hetzner-sd
Prometheus Service Discovery for Hetzner
Stars: ✭ 15 (-65.91%)
Mutual labels:  hetzner
terraform-provider-hetznerdns
Terraform provider for Hetzner DNS
Stars: ✭ 78 (+77.27%)
Mutual labels:  hetzner
hcloud-ip-floater
k8s controller for Hetzner Cloud floating IPs
Stars: ✭ 43 (-2.27%)
Mutual labels:  hetzner
Guide
Kubernetes clusters for the hobbyist.
Stars: ✭ 5,150 (+11604.55%)
Mutual labels:  hetzner-cloud
community-content
Hetzner Online Community Project
Stars: ✭ 149 (+238.64%)
Mutual labels:  hetzner
hcloud-js
A Node.js module for the Hetzner Cloud API
Stars: ✭ 40 (-9.09%)
Mutual labels:  hetzner
cluster-api-provider-hcloud
Cluster API infrastructure provider for Hetzner's Hcloud
Stars: ✭ 26 (-40.91%)
Mutual labels:  hetzner

Hetzner rescaler

Release Docker Image Size (tag) GitHub go.mod Go version GitHub Workflow Status

Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending, scaling to a cheaper machine when you don't need or need few resources, and scaling to a more performant one when you know the load will be higher.

Usage

First, you need to generate an Hetzner API Token.

Next you need to create your configuration file or export the required environment variables for the tool.
The config command helps you generate a valid configuration, warning you if there are any logic errors and validating your input.

hetzner-rescaler config

Keep in mind if env vars are defined, they will take priority.
After setting the configuration, you can start the tool by running

hetzner-rescaler start

Use with environmental variables

Export these env vars to override or completely bypass the generated configuration:

Variable Description
HCLOUD_TOKEN A valid Hetzner API Token
SERVER_ID The ID of the target server
BASE_SERVER_NAME The code of the cheap server type
TOP_SERVER_NAME The code of the high performance server type
HOUR_START 24h format, colon separated hour when the server should be upgraded
HOUR_STOP 24h format, colon separated hour when the server should be downgraded
TZ If defined, change the timezone of the timer

Use with Docker

Pull the image from dockerhub

docker pull jonamat/hetzner-rescaler

Opt A: Create a config file inside the container & start immediately beta

docker run -ti jonamat/hetzner-rescaler hetzner-rescaler plug

Opt B: Mounting a configuration file

docker run -v ~/.hetzner-rescaler.yaml:/.hetzner-rescaler.yaml jonamat/hetzner-rescaler

Opt C: Passing config as env vars

docker run \
-e HCLOUD_TOKEN=abc123 \
-e SERVER_ID=4567 \
-e BASE_SERVER_NAME=cpx11 \
-e TOP_SERVER_NAME=cpx21 \
-e HOUR_START=09:00 \
-e HOUR_STOP=20:00 \
jonamat/hetzner-rescaler

You can also pass a partial configuration file and define the missing vars as env vars (useful eg to hide the API key)

Use with compose/swarm stacks

version: '3.7'

services:
  hetzner-rescaler:
    image: jonamat/hetzner-rescaler

    // Provide the env vars
    environment:
      HCLOUD_TOKEN: abc123
      SERVER_ID: 4567
      BASE_SERVER_NAME: cpx11
      TOP_SERVER_NAME: cpx21
      HOUR_START: "09:00"
      HOUR_STOP: "20:00"
    
    // ...or mount the config file
    volumes:
      - /var/hetzner/config-file.yaml:/.hetzner-rescaler.yaml

The configuration file

The default path for the config file is ~/.hetzner-rescaler.yaml.
You can provide (and create) a custom config path passing the --config /custom/path/config.yml flag.

Config yaml file example

hcloud_token: abc123
server_id: 15393230
base_server_name: cx11
top_server_name: cx21
hour_start: "09:00"
hour_stop: "20:00"

Commands

Usage:
  hetzner-rescaler [command]

Available Commands:
  config      Create the configuration file
  help        Help about any command
  plug        Configure and start immediately
  start       Start rescale timers
  try         Try a complete rescale cycle

Flags:
      --config string   config file (default is $HOME/.hetzner-rescaler.yaml)
  -h, --help            help for hetzner-rescaler

Use "hetzner-rescaler [command] --help" for more information about a command.

Use cases

This tool was developed for a my specific use case: I use an Hetzner server for remote development, using the Remote SSH extension to simplify my cross-device development workflow. This machine also serve some personal services, which require very little resources but cannot be stopped for a long time.
It could be useful for all servers running applications related to a company's opening hours, such as booking, delivery or management software.

License

MIT

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].