GithubHelp home page GithubHelp logo

cloudsigma / docker-machine-driver-cloudsigma Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 131 KB

Docker Machine CloudSigma Driver

License: BSD 3-Clause "New" or "Revised" License

Go 92.92% Makefile 7.08%
cloudsigma docker-machine-driver

docker-machine-driver-cloudsigma's Introduction

Docker Machine CloudSigma Driver

Release License Unit Tests Go Report Card

Create Docker machines on CloudSigma.

You need to use your e-mail address as username and password and pass that to docker-machine create with --cloudsigma-username and --cloudsigma-password options.

Usage

$ docker-machine create --driver cloudsigma \
    --cloudsigma-username <YOUR-EMAIL> \
    --cloudsigma-password <YOUR-PASSWORD> \
    MY_COMPUTE_INSTANCE

If you encounter any troubles, activate the debug mode with docker-machine --debug create ....

When explicitly passing environment variables

$ export CLOUDSIGMA_USERNAME=<YOUR-EMAIL>; export CLOUDSIGMA_PASSWORD=<YOUR-PASSWORD>
$ docker-machine create --driver cloudsigma MY_COMPUTE_INSTANCE

Options

  • --cloudsigma-api-location: CloudSigma API location endpoint code.
  • --cloudsigma-cpu: CPU clock speed for the host in MHz.
  • --cloudsigma-cpu-type: CPU type
  • --cloudsigma-drive-name: CloudSigma drive name (latest version will be used).
  • --cloudsigma-drive-size: Drive size for the host in GiB.
  • --cloudsigma-drive-uuid: CloudSigma drive uuid.
  • --cloudsigma-memory: Size of memory for the host in MB.
  • --cloudsigma-password: required Your CloudSigma password.
  • --cloudsigma-ssh-port: SSH port to connect.
  • --cloudsigma-ssh-user: SSH username to connect.
  • --cloudsigma-static-ip: CloudSigma network adapter’s static IP address.
  • --cloudsigma-username: required Your CloudSigma user email.

Environment variables and default values

CLI option Environment variable Default
--cloudsigma-api-location CLOUDSIGMA_API_LOCATION zrh
--cloudsigma-cpu CLOUDSIGMA_CPU 2000
--cloudsigma-cpu-type CLOUDSIGMA_CPU_TYPE -
--cloudsigma-drive-name CLOUDSIGMA_DRIVE_NAME ubuntu
--cloudsigma-drive-size CLOUDSIGMA_DRIVE_SIZE 20
--cloudsigma-drive-uuid CLOUDSIGMA_DRIVE_UUID -
--cloudsigma-memory CLOUDSIGMA_MEMORY 1024
--cloudsigma-password CLOUDSIGMA_PASSWORD -
--cloudsigma-ssh-port CLOUDSIGMA_SSH_PORT 22
--cloudsigma-ssh-user CLOUDSIGMA_SSH_USER cloudsigma
--cloudsigma-static-ip CLOUDSIGMA_STATIC_IP -
--cloudsigma-username CLOUDSIGMA_USERNAME -

Frequently Asked Questions

I get error after restarting the docker machine

If you do not use --cloudsigma-static-ip option, then your machine will become always a new IP address after restarting. You will see something like that by running docker-machine ls command:

$ docker-machine ls
NAME   ACTIVE  DRIVER      STATE    URL                   SWARM    DOCKER    ERRORS
my vm  -       cloudsigma  Running  tcp://185.x.x.x:2376  Unknown  Unable to query docker version: Get https://185.x.x.x:2376/v1.15/version: x509: certificate is valid for 31.x.x.x, not 185.x.x.x

In this case you should regenerate certificates with docker-machine regenerate-certs.

Contributing

We hope you'll get involved! Read our Contributors' Guide for details.

docker-machine-driver-cloudsigma's People

Contributors

bogdan-ds avatar pavel-github avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-machine-driver-cloudsigma's Issues

Missing image for default drive UUID

If I run

sudo docker-machine create --driver cloudsigma testinstance

as per documentation, I get an error with

[{Message:Object with uuid 6fe24a6b-b5c5-40ba-8860-771044d2500d does not exist Point: Type:notexist}]

I assume this is the default drive when not specified and it must have been removed somehow?

Expected Behavior

A new machine should be created

Current Behavior

Error message

[{Message:Object with uuid 6fe24a6b-b5c5-40ba-8860-771044d2500d does not exist Point: Type:notexist}]

Possible Solution

Steps to Reproduce

  1. Just run the code mentioned above

Detailed Description

Error by using drive-uuid because drive-name is set by default

Bug report

Describe the issue

I am running into this error: https://github.com/cloudsigma/docker-machine-driver-cloudsigma/blob/master/cloudsigma.go#L321
When only providing --cloudsigma-drive-uuid=3b80db9b-1d57-457c-b72e-ea06029b84ce because as it looks like the drive-name is set by default to "ubuntu" here https://github.com/cloudsigma/docker-machine-driver-cloudsigma/blob/master/cloudsigma.go#L119

System information

  • docker-machine-driver-cloudsigma version: v2.0.0
  • golang version:
  • OS: Ubuntu 22.04

Reproduction instructions

Create a docker machine using only uuid instead of name.

Expected behavior

Docker machine is created by defined drive uuid and not throwing an error.

Notes

Not sure if related to anything but i am using this driver in a gitlab runner instance, by using following configuration:

           "cloudsigma-api-location=...",
           "cloudsigma-username=....",
           "cloudsigma-password=.....",
           "cloudsigma-cpu=8000",
           "cloudsigma-memory=8192",
           "cloudsigma-drive-name=Ubuntu 20.04 LTS",
#           "cloudsigma-drive-uuid=3b80db9b-1d57-457c-b72e-ea06029b84ce",
           "cloudsigma-drive-size=250"

If i change it to

           "cloudsigma-api-location=...",
           "cloudsigma-username=....",
           "cloudsigma-password=.....",
           "cloudsigma-cpu=8000",
           "cloudsigma-memory=8192",
#           "cloudsigma-drive-name=Ubuntu 20.04 LTS",
           "cloudsigma-drive-uuid=3b80db9b-1d57-457c-b72e-ea06029b84ce",
           "cloudsigma-drive-size=250"

It is throwing the error mentioned above.

Provide better documentation

Files:

  • README.md
  • .github/CONTRIBUTING.md

Godoc:

  • all public method should be documented (with URL links to CloudSigma API if REST calls)

Add settings for using static IP address

After start/stop a server a new IP address will be assigned. That leads that server certificates are not valid anymore => user have to regenerate certificates with docker-machine regenerate-certs <vm>.

We want to add possibility to use static IP address and prevent regeneration of certificates.

To do:

  • enhance API client to handle static IP address during VM creation
  • add additional driver flag for using static IP address

Add a few new flags

Could we add a new flag to specify a SSH key to be used? eg --cloudsigma-ssh-key. Either the location on the client or a UUID to the cloudsigma key. This would save generating a new key each time and other benefits.

Also, could we add a flag(s) for machines which we want to be created within a VLAN and, possibly, without any public IP?

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce

Detailed Description

Make location for API endpoint configurable

There are 4 locations available:

  • Honolulu, United States
  • San Jose, United States
  • Washington DC, United States
  • Zurich, Switzerland

To make API client more configurable we should enable to configure it via location code (so it will be easier later to support new locations)

TODO:

  • enhance api/client.go
  • add new parameter --cloudsigma-api-location with environment variable
  • update readme file

Provisioning on Ubuntu 16.04 LTS image doesn't work

Bug description

It looks like in Ubuntu 16.04 LTS library drive (e47f39e0-075f-4b38-83e6-1b9dce36d0f1) dpkg process hangs or running during making image. Ubuntu 14.04 works without issues.

Any log files or outputs

Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

Suggestion to solve

We have two options to solve it:

  • build a new image without running dpkg command or
  • force delete lock files (can break system):
    • /var/lib/apt/lists/lock
    • /var/cache/apt/archives/lock
    • /var/lib/dpkg/lock

Integrating another option to set EPC size

Have an option --cloudsgima-epc-size and the input should be an integer. Upon setting this option the guest should be created with this parameter in the JSON:

"cpu_epc": "8"

Example

{
"objects": [
{
"cpu": 1000,
"mem": 536870912,
"name": "testServerAcc",
"vnc_password": "testserver1",
"cpu_epc": "8"
}
]
}

Even though the input is an integer, it's passed as a string here, but don't mind that.

Note, this will not work in any exposed locations.

Exclude vendor folder for older go versions

Cannot build driver with Go version 1.8 and eariler

Expected Behavior

No exception.

Current Behavior

Exception occurs

Possible Solution

Exclude vendor folder for go tools if using older Go versions.

Steps to Reproduce

mage build

Detailed Description

vendor\github.com\Azure\go-ansiterm\parser.go:139: arg newState.Name in printf call is a function value, not a function call
exit status 1
vendor\golang.org\x\sys\windows\zsyscall_windows.go:1150: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:1249: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:1255: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:1511: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:1565: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:2322: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:2349: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\zsyscall_windows.go:2377: possible misuse of unsafe.Pointer
vendor\golang.org\x\sys\windows\asm_windows_amd64.s:12: [amd64] loadlibrary: wrong argument size 8; expected $...-24

Implement basis command

Should be done after #3.

Following commands should be implemented:

  • create
  • rm
  • start
  • stop
  • restart
  • status

IP flag not working

The cloudsigma-static-ip is not working as I would expect.

Expected Behavior

I add --cloudsigma-static-ip 192.22.0.1 (for istance) and I would expect the machine to be greated with the static IP I selected.

Current Behavior

The call fails and it says Object with uuid 192.22.0.1 does not exist. I assume this static IP is for a public IP then?

Possible Solution

Steps to Reproduce

Detailed Description

Provide API bindings

Because there is no official Go library to accessing CloudSigma API so this functionality should be provided:

  • define authentication method (likely basic auth)
  • define needed API endpoints

P.S. Should be configurable so it can be extracted into separate library later (?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.