Unfortunately this project is being archived since hyper.sh shutdown
Hyperb is a Hyper.sh API ruby gem.
This gem is under active development.
Add this line to your application"s Gemfile:
gem "hyperb"
And then execute:
$ bundle
Or install it yourself as:
$ gem install hyperb
Hyper.sh requires you to create credentials on their dashboard, after that you can configure your client as following:
client = Hyperb::Client.new(access_key: "ak", secret_key: "sk", region: "us-west-1")
or
client = Hyperb::Client.new do |client|
client.secret_key = "secret_key"
client.access_key = "access_key"
client.region = "eu-central-1"
end
If region
is not set, us-west-1
is set by default.
After configuring a client
, you can run the following examples.
get api version
client.version
fetch all images
client.images
remove an image
client.remove_image id: "id-or-name"
create an image (pull)
client.create_image from_image: "busybox"
pull an image from gcr (using service account)
client.create_image from_image: "gcr.io/project/owner/gcr", x_registry_auth: { username: "_json_key", password: File.new("./path/service-account.json"), email: "e@e.com", serveraddress: "https://gcr.io" }
create container (defaults to s1 size)
client.create_container name: "nginx-container", image: "nginx"
create container with specific size
client.create_container name: "nginx-container", image: "nginx", labels: { sh_hyper_instancetype: "m1" }
start container
client.start_container name: "nginx-container"
container logs
logs = client.container_logs id: "nginx", stdout: true, stderr: true, follow: true
while body = logs.readpartial(1024)
puts body
end
allocate an floating ip
ips = client.fip_allocate count: 2
puts ips
#["8.8.8.8", "5.5.5.5"]
For more usage examples, please see the full documentation.
- inspect image
- create image
- list images
- remove images
- list volumes
- inspect volume
- create volume
- remove volume
- create container (not all arguments supported yet)
- start container
- stop container
- kill container
- get container logs
- get container stats
- remove containers
- rename container
- floating ip allocate
- floating ip release
- floating ip list
- floating ip attach
- floating ip detach
- floating ip name
- compose create
- compose up
- compose down
- compose rm
- create snapshot
- create service
- remove service
- inspect service
- list services
- create func
- remove func
- list funcs
- func status
- call func
- version
- info
wip
wip
wip
Bug reports and pull requests are welcome at https://github.com/drish/hyperb.
The gem is available as open source under the terms of the MIT License.