Giter Club home page Giter Club logo

pitchfork's Introduction

Build Status

Pitchfork

Rackspace Cloud API Interactive Application

Using a browser you can execute any Rackspace API command for any Cloud product without the need to get on a command line or use another CLI tool.

To use the application just login with your username and Cloud Account API key. The application does not store the API key and keeps no record of it. It only uses the API key to make the authentication call so that the application can generate the token. The token is then used in subsequent API calls, and is kept as long as there is a session. A logout will clear the session of any data, or when the token expires whichever comes first.

View Authentication Call details

The application is divided up by the different cloud products that are available to all customers. Each call includes the following information:

  • Variables needed with descriptions, data types, and what is required
  • Endpoint and URI
  • Links to the API docs specific section for the call you are needing more information for.

For each API call you will be shown the following information in the browser.

  • Request URL
  • Request Headers
  • Request Object (If data object is used i.e. on Create and Update Statements)
  • Response Headers
  • Response Body

Warnings are on the calls that do things that could potentially impact an account (creates, updates, deletes, etc.).

Mocking is available to allow for the call to be built out using the parameters you have chosen so you can see all of the details. The only difference is the call will not actually be executed.

Note: You do not have to login to the application in order to use the Mock capability for any product

Want to run it locally?

All you need is Python 2.7, Mongodb, and a web browser or use docker

Create a virtual environment

Note: The below example uses virtualenvwrapper

mkvirtualenv pitchfork
cd pitchfork
git clone https://github.com/oldarmyc/pitchfork.git
cd pitchfork
workon pitchfork
Use pip to install the requirements:
pip install -r requirements.txt
Setup the config file:
cp pitchfork/config/config.example.py pitchfork/config/config.py
vi pitchfork/config/config.py

Change the following for your setup:
MONGO_DATABASE : Database name to use
ADMIN : Cloud account username for first admin
ADMIN_NAME : Full name of admin for the account above SECRET_KEY : Used for sessions

Optional Additions:
MONGO_USER = 'Username for mongo database instance'
MONGO_PASS = 'Password for mongo database instance'

You can add to the KWARGS config item to add a replica set.
MONGO_KWARGS = {'tz_aware': True, 'replicaSet': 'my_replica_set'}

For more information on the options for Mongo see the hapPyMongo documentation.
https://github.com/sivel/happymongo

Running the Application:

After you have saved the config file and your mongo database is up and running, run the following command to start the application.

python runapp.py

Browse to http://localhost:5000 to view the application and login using your Cloud credentials

Run the application using docker

Create and git the code
mkdir pitchfork
git clone https://github.com/oldarmyc/pitchfork.git
cd pitchfork
Copy over sample configs
cp pitchfork/config/config.example.py pitchfork/config/config.py
Edit the config.py file
vim pitchfork/config/config.py
Add import at top of file
import os
Change MONGO_HOST from localhost to the following:
MONGO_HOST = os.environ['PITCHFORK_DB_1_PORT_27017_TCP_ADDR']
Start the build
docker-compose build
Bring the containers up and run in the background
docker-compose up -d
Verify that everything is running
docker ps
Stoping the application
docker-compose stop

Upgrading

To upgrade an existing install to work with the recent changes do the following:

git pull origin master
pip install -r requirements

Log into mongodb. The command below assumes the database is named pitchfork.

use pitchfork
db.settings.remove()
db.api_settings.remove()
db.reporting.remove()

Browse to the home page and after it loads refresh the page. The refresh will force the app to repopulate the settings, reporting, and api_settings collections automatically to work with the new changes.

Adding API Calls

Pitchfork API Calls

The download above will provide all of the mongodb bson files for each of the Rackspace products. Once you download the files you can do the following to restore all of the product collections to the pitchfork database.

tar xzvf api_calls.tar.gz
mongorestore -d pitchfork --drop pitchfork/

Note: If you have added your own calls into the collections you can omit the --drop in the call above, and the calls will be added to the existing collection.

If you are running pitchfork using the docker method above, the mongo container has the port 27017 exposed to the local machine. You can connect and do the restore just as you would using the above method.

Testing

The application unit tests can be run with nose and selenium. To install the requirements to run test do the following in your virtual environment

pip install nose coverage selenium

Selenium was setup to use firefox when the tests are run. However you can update the following to use the driver of your choice.

Note: If you do not have Firefox the tests will be skipped

def setUpClass(cls):
    try:
        cls.client = webdriver.Firefox()
    except:
        pass

Documentation for selenium can be found here: http://selenium-python.readthedocs.org/en/latest/

Once you are ready to run the tests do the following. Run tests only

nosetests

Run tests with verbosity to see what tests are being run

nosetests -v

Run tests with coverage

nosetests --with-coverage --cover-erase --cover-package pitchfork

Note: Selenium tests uses port 5000 when running so ensure the application is not already running or some tests will fail.

pitchfork's People

Contributors

maxlinc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pitchfork's Issues

How do you populate API calls?

When I install and run locally, the app comes up and I can login, but I don't have any available API calls:

screen shot 2014-07-16 at 12 34 15 pm

How are you supposed to populate the database?

agent.filesystem_state missing from select options

Is it possible to add "agent.filesystem_state" to the drop down of options when adding a Rackspace Monitoring check here https://pitchfork.cloudapi.co/monitoring/ ?

It does appear in the API response from "List Check Types" but not in the select options:

        {
            "category": "agent_system", 
            "fields": [], 
            "supported_platforms": [
                "Linux"
            ], 
            "type": "agent", 
            "id": "agent.filesystem_state", 
            "channel": "stable"
        }, 

Create/Update/Delete Notification Plans

Want to be able to be create, update and delete notification plans for Cloud Monitoring.

Functionality exists for notifications, but not notification plans.

SSL certificate private keys stored on your systems

Hey

When using Pitchfork to add SSL certificates the private key is stored as a byproduct of facilitating the API call history log.

Ideally, this wouldn't be stored at all for security reasons (login compromised, database hacked, etc)

Failing that, a mechanism for clearing the history would be a step in the right direction.

Add server shutdown (not reboot) call to pitchfork

Hey all,

I realize the use case for this call is fairly small, but it would still be helpful. Sometimes customers wish to shutdown servers temporarily, but not come back with a reboot right away. Full shutdowns can also be used as troubleshooting steps beyond regular reboots for certain issues within OS or within the cloud infrastructure.

I'd like to ask that this call be added to the calls currently available to cloud servers, as I believe this would help customers as well as Rackspace support personnel troubleshoot issues and improve ease of use for day to day operations as well by providing a wrapper for this call to less technically inclined customers.

The relevant API documentation for this call can be found at the provided link.

https://developer.rackspace.com/docs/cloud-servers/v2/api-reference/svr-basic-operations/#stop-specified-server

Thanks!
Jake Regan

Agent Check Types

It looks like in the GUI, some of the check types are not listed:

CheckType: id=agent.mssql_version
CheckType: id=agent.mssql_database
CheckType: id=agent.mssql_buffer_manager
CheckType: id=agent.mssql_sql_statistics
CheckType: id=agent.mssql_memory_manager
CheckType: id=agent.mssql_plan_cache

Could these types be added?

Allow for multiple load-balancers in the update launch configuration GUI

The SYD office has started using pitchfork quite extensively and we've encountered a restrictions in the GUI that prevent us from easily setting certain configurations that customers need. I'll create issues for both of them. This ticket is for multiple load-balancerss.

An autoscale group can have multiple load balancers associated with it. Many of our customers often have internet traffic that exceeds the baseline for a single CLB so we often end up recommending they use 2 or more CLBs and use DNS round-robin with them. This in turn means that the autoscaling groups that they use need to be configured with multiple load balancers. Autoscaling allows for this provision because the load_balancers field is a list of values, however it's not currently possible to set multiple load balancers through Reach.

We are aiming to use pitchfork to configure AS for our customers, but the pitchfork gui also does not give the option to specify multiple load balancers. Would it be possible to change the pitchfork gui in a way that it would allow the specification of multiple load balancers in the launch configuration update API call?

Thanks!
j

screen shot 2014-09-03 at 10 35 57

No TOS, No Privacy Policy, No Evidence of Trustworthiness

I was just told by Rackspace support to use this website. I get that that's probably not an issue with this site exactly, but I want to flag the many issues I had with this advice. Some of these may be real and others perceived, but I'm really shocked that Rackspace support told me to give my API key to a website.

Some issues:

  • This website wants my API key, which controls all of my servers. Rackspace support should NEVER, ever tell people to give their API key to a third party.
  • There's no privacy policy, and anyway, the privacy policy isn't Rackspace's privacy policy.
  • There are no terms of service. Say something goes wrong as a result of a bug in this software and it damages a server I have. I can't restore for some reason and my business collapses. Are you ready for that lawsuit?
  • There's no contact info. That's not good. The footer says the site is maintained by a Rackspace employee. Who?

I think the fix to these issues is fairly simple: Just don't ask for API information and don't do anything on the user's behalf. Basically, make the site into an interactive API documentation and that's it.

PS: Sorry to be a wet blanket. But ultimately, some things shouldn't exist because of the security concerns that they create. If these API calls are indeed needed by the Rackspace community, then Rackspace should build them into the UI or make a website like this that it owns and operates itself.

meta_value does not accept strings when creating server

On the current version at https://pitchfork.cloudapi.co/. When creating a server the meta_value attribute only accepts Boolean values, if using something like the RackConnnect Auto NAT feature http://www.rackspace.com/knowledge_center/article/rackconnect-auto-nat-feature need to type an IP address into this field. It would also be nice if you could add additional items of metadata when creating a server.

You were able to type in a IP address into the meta_value in a previous version.

Allow for multiple networks in the update launch configuration GUI

The update launch configuration GUI also does not allow for specifying more than one network, despite the fact that the autoscale API does support multiple networks. Our customers often need to specify a private network when using autoscaling, often for back-end traffic between application servers in an AS group.

Would it be possible to modify the pitchfork GUI in a way such that it would allow the input of multiple networks in the update launch configuration API call?

thanks
j

screen shot 2014-09-03 at 10 35 57

API calls that return a large list of objects not fully shown

Currently when you try to get a list of a large number of objects it doesn't return all of the items. Two examples of this are the following RESTful API calls:

List Images
Endpoint: https://{data_center}.images.api.rackspacecloud.com/v2/{ddi}
URI: /images
Verb: GET

List Roles
Endpoint: https://identity.api.rackspacecloud.com/v2.0
URI: /OS-KSADM/roles
Verb: GET
Docs: API Reference Document

Both of these have parameters that I think needs to be added, most importantly the limit parameter that can be used to fetch all of the records if given a large number:

List Images
{?limit,​marker,​name,​visibility,​member_status,​owner,​tag,​status,​size_min,​size_max,​sort_key,​sort_dir}

List Roles
{?serviceId,​marker,​limit}

Change references from data_center to region

Right now, it appears that the term "data_center" is being used in the endpoints. Can you please update this to region to be consistent with other cloud documentation and terminology? Thanks!

Allow unauthenticated access?

All of Pitchfork at cloud-api.info is hidden behind authentication. It seems like authentication should only be required for the "Send API Call" actions, especially now that some services have a "Mock API Call". I'd like to to share links for others to look at Pitchfork without requiring them to put in their API key.

P.s.: Does "Mock API Call" use mimic or is Pitchfork doing its own mocking?

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.