Giter Club home page Giter Club logo

cyoi's Introduction

Choose Your Own Infrastructure

A library to ask an end-user to choose an infrastructure (AWS, OpenStack, etc), region, and login credentials.

This library was extracted from inception-server for reuse by bosh-bootstrap. It might also be useful to your own CLI applications that need to ask a user to give you their infrastructure credentials/region so your application can control their infrastructure (say via fog).

Build StatusCode Climate

When you use the library, your application will attempt to guess what infrastructure/credentials the user will use (via ~/.fog) and then fall back to prompting for remaining information:

Auto-detected infrastructure API credentials at ~/.fog (override with $FOG)
1. AWS (default)
2. AWS (starkandwayne)
3. Alternate credentials
Choose infrastructure:  3

1. AWS
2. OpenStack
Choose infrastructure:  1


Using provider aws:

1. *US East (Northern Virginia) Region (us-east-1)
2. US West (Oregon) Region (us-west-2)
3. US West (Northern California) Region (us-west-1)
4. EU (Ireland) Region (eu-west-1)
5. EU (Frankfurt) Region (eu-central-1)
6. Asia Pacific (Singapore) Region (ap-southeast-1)
7. Asia Pacific (Sydney) Region (ap-southeast-2)
8. Asia Pacific (Tokyo) Region (ap-northeast-1)
9. South America (Sao Paulo) Region (sa-east-1)
10. China (Beijing) Region (cn-north-1)
Choose AWS region: 2

Access key: KEYGOESHERE
Secret key: SECRETGOESHERE

Confirming: Using aws/us-west-2

Usage

provider_cli = Cyoi::Cli::Provider.new([settings_dir])
provider_cli.execute!
settings = YAML.load_file(File.join(settings_dir, "settings.yml"))

settings["provider"]["name"] # aws, openstack
settings["provider"]["region"] # us-east-1
settings["provider"]["credentials"] # aws or openstack URLs & credentials

Installation

To use as a stand-alone CLI, install the rubygem:

$ gem install cyoi

To use it as a library within your own application, add this line to your application's Gemfile:

gem "cyoi"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
  6. Send @drnic a big bag of Doritos

cyoi's People

Contributors

drnic avatar teancom avatar frodenas avatar premist avatar lnguyen avatar markkropf avatar

Stargazers

Tim Spann avatar Benjamin Fleischer avatar Eduardo Aceituno avatar

Watchers

Tyler Poland avatar  avatar Dennis J. Bell avatar Shawn Neal avatar James Cloos avatar Bertrand Lupart avatar Quintessence avatar Benjamin Gandon avatar Xiujiao Gao avatar DigitalEagle avatar  avatar  avatar

cyoi's Issues

issue in bosh-bootstrap

Hello,

We have Grizzly Open Stack installed in 3 nodes: controller, network, and compute.
We have decided to use Cloud Foundry as an Open PaaS, and we are trying to install it on the controller node.

I have reviewed both the .fog & yml files and They are as follows:

///////////////////////////////////////////////////////////////////////////////////////////////////////
~/.fog

:openstack:
:openstack_auth_url: http://10.1.9.240:5000/v2.0/tokens
:openstack_api_key: admin_pass
:openstack_username: admin
:openstack_tenant: admin
:openstack_region:
///////////////////////////////////////////////////////////////////////////////////////////////////////
~/bosh-workspace/deployments/microbosh-openstack#micro_bosh.yml

name: microbosh-openstack

logging:
level: DEBUG

network:
type: manual
#vip: <allocated_floating_ip> # Optional
ip: 192.168.20.17

cloud_properties:
net_id: 5431f17e-a868-44cb-940f-b8b39890949f
#net_id: 8d07dab9-fee6-4b41-a2e7-7bb59461d870

resources:
persistent_disk: 2048
cloud_properties:
instance_type: m1.small

cloud:
plugin: openstack
properties:
openstack:
auth_url: http://10.1.9.240:5000/v2.0/tokens
username: admin
api_key: admin_pass
tenant: admin

  region:  # Optional
  default_security_groups: ["ssh", "bosh"]
  default_key_name: cf_key
  private_key: ~/bosh-workspace/deployments/microbosh-openstack/

apply_spec:
properties:
director:
max_threads: 3
hm:
resurrector_enabled: true
ntp:
- 0.north-america.pool.ntp.org
- 1.north-america.pool.ntp.org
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
then we have deleted ~/.microbosh and execute the below steps:

root@cu-cont:/home/easi/bosh-bootstrap# rm -R ~/.microbosh/
root@cu-cont:/home/easi/bosh-bootstrap# ./bin/bosh-bootstrap deploy
Auto-detected infrastructure API credentials at ~/.fog (override with $FOG)

  1. OpenStack (openstack)
  2. Alternate credentials
    Choose an auto-detected infrastructure: 1

Using provider OpenStack
OpenStack Region (optional):

Confirming: Using OpenStack (user: admin)

  1. (192.168.10.0/24)
  2. (10.1.9.249/24)
  3. (192.168.20.0/24)
  4. (192.168.2.0/24)
  5. SecondSubnet (192.168.22.0/24)
    Choose a subnet: 3

Choose IP |192.168.20.2| 192.168.20.17

Confirming: Using address 192.168.20.17
Reusing security group ssh
-> no additional ports opened
Reusing security group dns_server
/var/lib/gems/1.9.1/gems/fog-1.20.0/lib/fog/core/attributes.rb:180:in requires': parent_group_id is required for this operation (ArgumentError) from /var/lib/gems/1.9.1/gems/fog-1.20.0/lib/fog/openstack/models/compute/security_group_rule.rb:17:insave'
from /var/lib/gems/1.9.1/gems/fog-1.20.0/lib/fog/core/collection.rb:51:in create' from /var/lib/gems/1.9.1/gems/cyoi-0.8.3/lib/cyoi/providers/clients/openstack_provider_client.rb:84:inauthorize_port_range'
from /var/lib/gems/1.9.1/gems/cyoi-0.8.3/lib/cyoi/providers/clients/fog_provider_client.rb:121:in block (2 levels) in create_security_group' from /var/lib/gems/1.9.1/gems/cyoi-0.8.3/lib/cyoi/providers/clients/fog_provider_client.rb:118:ineach'
from /var/lib/gems/1.9.1/gems/cyoi-0.8.3/lib/cyoi/providers/clients/fog_provider_client.rb:118:in block in create_security_group' from /var/lib/gems/1.9.1/gems/cyoi-0.8.3/lib/cyoi/providers/clients/fog_provider_client.rb:116:ineach'
from /var/lib/gems/1.9.1/gems/cyoi-0.8.3/lib/cyoi/providers/clients/fog_provider_client.rb:116:in create_security_group' from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/network_providers/openstack.rb:11:inblock in perform'
from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/network_providers/openstack.rb:10:in each' from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/network_providers/openstack.rb:10:inperform'
from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/network.rb:15:in deploy' from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/cli/commands/deploy.rb:46:inselect_or_provision_public_networking'

    from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/cli/commands/deploy.rb:21:in `perform'
    from /home/easi/bosh-bootstrap/lib/bosh-bootstrap/thor_cli.rb:11:in `deploy'
    from /usr/lib/ruby/vendor_ruby/thor/task.rb:27:in `run'
    from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:120:in `invoke_task'
    from /usr/lib/ruby/vendor_ruby/thor.rb:275:in `dispatch'
    from /usr/lib/ruby/vendor_ruby/thor/base.rb:425:in `start'
    from ./bin/bosh-bootstrap:9:in `<main>'

root@cu-cont:/home/easi/bosh-bootstrap#

Please advice.
Regards

Error creating project for vSphere infrastructure

get this error when generating a vpshere project.

/usr/local/lib/ruby/gems/2.2.0/gems/cyoi-0.11.3/lib/cyoi/cli/providers/provider_cli_vsphere.rb:22:in setup_credentials': undefined local variable or method h1' for #Cyoi::Cli::Providers::ProviderCliVsphere:0x00558d8b5e97c8 (NameError)
from /usr/local/lib/ruby/gems/2.2.0/gems/cyoi-0.11.3/lib/cyoi/cli/providers/provider_cli_vsphere.rb:6:in perform_and_return_attributes' from /usr/local/lib/ruby/gems/2.2.0/gems/cyoi-0.11.3/lib/cyoi/cli/provider.rb:18:in execute!'

credentials["vsphere_server"] = hl.ask("Server: ").to_s unless credentials.exists?("vsphere_server")
credentials["vsphere_expected_pubkey_hash"] = hl.ask("Expected public key hash: ").to_s unless credentials.exists?("vsphere_expected_pubkey_hash")

2nd line here uses h1 with a lower-case L

Non-sequential/discrete port lists in security groups should be possible

As-is, you are unable to create a security group with a discrete, non-sequential list of ports.

"bosh" => [4222, 6868, 25250, 25555, 25777]

will result in it creating a single rule with a range from 4222 to 25777:

Custom TCP Rule TCP (6) 4222-25777 0.0.0.0/0

Not only does this open (at lot) more ports than necessary, but if the order in the list was different, say [6868, 4222, 25250, 25555, 25777], then it wouldn't work as intended at all.

Color

Bring green/yellow/red (like thor) to cyoi

Bump release for vsphere support

it would be helpful bump the CYOI release to include the commit to fix #16 that were made just after v0.11.3 for downstream projects like traveling-bosh to then pull in ... verified vsphere works fine in traveling-bosh / bosh-bootstrap with just that typo fix

upgrade raring to trusty

raring on ap-southeast-2 isn't working

Err http://ap-southeast-2.ec2.archive.ubuntu.com raring/universe amd64 Packages
  404  Not Found [IP: 91.189.91.14 80]

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.