go-sleep

command module
v0.0.0-...-22a6142 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2017 License: MIT Imports: 21 Imported by: 0

README

Build Status GoDoc codecov Go Report Card

go-sleep

go-sleep helps to automatically start cloud instances Google Compute Engine / Amazon EC2 by request (HTTP) and stopping unused instances, after some time.

Here is basic workflow: the go-sleep handles all incoming requests, if instance running, proxy all traffic. Else request start instance and waiting him.

Diagram

Installation

Download latest binary from https://github.com/silentsokolov/go-sleep/releases

Getting started

Run ./go-sleep -config=/path/to/config.toml

Config

Please refer to the config.sample.toml to get full documentation.

Global
# Port
# Reserved for web API interface
port = ":9090"

# Secret key
# Is passed along with every request to that site in the X-Go-Sleep-Key header
secret_key = "my-secret-key"

# Log level
log_level = "info"
Basic auth
# Group user for basic auth
# Passwords can be encoded in MD5, SHA1 and BCrypt: you can use htpasswd to generate those ones

# [auth]
#  [auth.<group_name>]
#    users = ["<user>:<password>", "<user>:<password>"]

# This example register two groups admins/freelancers with user "test" with password "test"
[auth]
  [auth.admins]
    users = ["test:$apr1$bfLZ0ZMK$CYhTBqS.Yl.V1hbOpHze51"]
  [auth.freelancers]
    users = ["test:$apr1$bfLZ0ZMK$CYhTBqS.Yl.V1hbOpHze51"]
Instance (Google Compute Engine)
# This example register one GCE instance with two hostnames (example.com and www.example.com) on 80/443 port (with TLS)
# Access is limited basic auth (for group "admins")
[[gce]]
jwt_path = "/path/to/key_jwt.json"
project_id = "project-test-12"
zone = "europe-west1-a"
name = "instance-1"
  [[gce.route]]
  address = ":80"
  hostnames = ["example.com", "www.example.com"]
  auth_group = "admins"

  [[gce.route]]
  address = ":443"
  hostnames = ["example.com", "www.example.com"]
  auth_group = "admins"
  backend_port = 80
    [[gce.route.certificate]]
    cert_file = "/path/to/server.crt"
    key_file = "/path/to/server.key"

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL