https://github.com/silentsokolov/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.
https://github.com/silentsokolov/go-sleep
amazon-ec2 ec2 gce go golang google-compute-engine
Last synced: 7 months ago
JSON representation
go-sleep helps to automatically start cloud instances Google Compute Engine / Amazon EC2 by request (HTTP) and stopping unused instances, after some time.
- Host: GitHub
- URL: https://github.com/silentsokolov/go-sleep
- Owner: silentsokolov
- License: mit
- Created: 2017-02-06T19:07:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T09:14:30.000Z (over 8 years ago)
- Last Synced: 2025-03-17T12:41:39.723Z (about 1 year ago)
- Topics: amazon-ec2, ec2, gce, go, golang, google-compute-engine
- Language: Go
- Homepage:
- Size: 15.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/silentsokolov/go-sleep)
[](https://godoc.org/github.com/silentsokolov/go-sleep/) [](https://codecov.io/gh/silentsokolov/go-sleep)
[](https://goreportcard.com/report/github.com/silentsokolov/go-sleep)
# go-sleep
go-sleep helps to automatically start cloud instances [Google Compute Engine](https://cloud.google.com/compute/) / [Amazon EC2](https://aws.amazon.com/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.

## 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](https://github.com/silentsokolov/go-sleep/blob/master/config.sample.toml) to get full documentation.
### Global
```toml
# 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
```toml
# Group user for basic auth
# Passwords can be encoded in MD5, SHA1 and BCrypt: you can use htpasswd to generate those ones
# [auth]
# [auth.]
# users = [":", ":"]
# 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)
```toml
# 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"
```