[Getting Started] manage Online Labs from Command Line


#1

Without a cli interface no automation can be done. So I just started a commandline tool


The cli is written in golang, and binary downloads are available for linux/osx/windows
on the Release tab of the github page.

Here is a small 1minute demo:

Enjoy!


#2

Woh! you are amazing! :smile:


#3

It’s awesome!

We had a Python SDK to consume our APIS, now we have a CLI :slight_smile: Thanks a lot for your work.

Note that, for now, we may break the retro compatibility of the APIs. However, I’ll try to create a topic soon to keep track of changes.


#4

First i created a bunch of shell functions to wrap curl calls, but than i realised that an sdk/library would make more sense.

I went for golang as it always tricky to get pip/gem/npm packages right. I just love the fact of how easy os to cross-compile statically linked binaries produced with go.

For the naming i just came up with onlabs but i like ocs as its much shorter. Do you guys have a preference on the naming?

Which command would you like to see next? Feel free to create github issues: https://github.com/lalyos/onlabs/issues

Actually by implementing some of the command I already found some outdated json examples in the api doc. For example the server has a running boolean field in the docs, but its already changed to: state which is a string.

Is the documentation available in a git repo? So i can send corrections?


#5

Hello,

It’s the first time use go.

I tried to “go get github.com/lalyos/onlin/…” and it seems I need authenticate…

Is it necessary to have a gut hub account ?

Thans for your help,


#6

Ups that was a typo in the readme, the correct line is

go get github.com/lalyos/onlabs/...

But installing the bianries is the easiest way. So download from: github is the recommended way.
Put it on the PATH and that’s it.

Once installed you just have to set your Online Lab Token into an environment variable.
Your personal token can be found at: https://cloud.online.net/#/credentials

export ONLINE_TOKEN=a0635283-123a-b456-90cd-0123456abcdef


#7

Many thanks for your so quick answer Lalyos !

It’s ok now :smile:


#8

Hello back Lalyos,

I get an error when using onlabs volumes:

ERRO[0000] json: cannot unmarshal number 100000000000 into Go value of type int 

Can you help please ?

Thanks to you and all the team !!

Edit: I also have the same issue with onlabs snapshots…


#9

Please make sure you are using the latest 0.1.7 version. You can download the binary from: https://github.com/lalyos/onlabs/releases

$ onlabs --version
Online Labs Client: v0.1.7

$ onlabs volumes
vol-1  2da015cc-765b-4848-a207-427bd16a3ece      100 GB

#10

Hello Lalyos,

I’ve the good and last version, it’s ok for this point.

I tried to download the darwin binary and tested it on Mac OS (Yosemite). This was ok !

But I tried to compile this version on two servers:

  • An Ubuntu 32 bits system.
  • An Ubuntu armv7l (Online ;)) system.
    And on those 2 systems, I get the result shown above.

Is there a way to compile it on a 32 bits system ?

Many thanks for your help.


#11

Oh I see so the problem is with 32 bit systems. Could you pease open a github issue: https://github.com/lalyos/onlabs/issues


#12

The issue is opened on github.

Edit: It’s running now, many thanks Lalyos !!


#13

Thanks to @Manfred poweron/poweroff and terminate command are added!

I created a new release: https://github.com/lalyos/onlabs/releases

OSX specific installation made even easier with brew

brew cask install onlabs

If you are missing the cask plugin, get it by:

brew install caskroom/cask/brew-cask