Giter Club home page Giter Club logo

hyphe_openstack_client's Introduction

Openstack Client API for Hyphe

How to use it

This is a complete example :

// instanciate the client
const client = new OpenStackClient("https://auth.cloud.ovh.net/v3");

// authenticate the user
client.authenticate("user", "password");

// retrieve the available regions for the 'compute' service.
const regions = client.getRegions("compute")

// Get the available images for a region
const images = await client.getImages(regions[0].region_id);

// Get the available 'compute' flavor for a region
const flavors = await client.getComputeFlavors(regions[0].region_id)

// Create a server
const server = await client.createComputeServer( regions[0].region_id, "my-new-server-name", images[0].id, flavors[0].id );

...

On createComputeServer you can add at the end of the method’s params, an objet that match the following optional params : https://docs.openstack.org/api-ref/compute/?expanded=create-server-detail#id11

For example, it can be useful to upload a bash script that will be executed once the server is launched :

const script = "echo 'test'"
const server = await client.createComputeServer( regions[0].region_id, "my-new-server-name", images[0].id, flavors[0].id, {user_data: btoa(script)} );

Development

Build

To build the lib, just run npm run build

Tests

To run them you must have those environment variables `:

# FOR UNIT TEST
export OPENSTACK_USER="XXX"
export OPENSTACK_PASSWORD="YYYYY"
export OPENSTACK_DOMAIN="Default"
export OPENSTACK_PROJECT="ZZZZZ"
export OPENSTACK_URL="https://auth.vexxhost.net/v3"
export OPENSTACK_REGION="sjc1"
export OPENSTACK_IMAGE="Debian GNU/Linux 10 (buster) [2019-12-02]"
export OPENSTACK_FLAVOR="v2-standard-1"
# FOR FULL DEPLOY
export OPENSTACK_SSHKEY_NAME="my-ssh-key";
export OPENSTACK_SSHKEY_PUB=$(cat ~/.ssh/id_rsa.pub)

There is two kind of tests :

  • paid : You can run them with the command npm run test:paid. Those tests spawn some servers, so they are not free of charge.

  • free : You can run them with the command npm run test:unit.

Note
The command npm test run all tests (free & paid).
Note
You can use the paid test to deploy a server, just comment the after method
Important
Unit test fails on network for OVH

Annexe

Hyphe configuration

Description

Hyphe configuration is a parameter of the method hypheDeploy. The configuration must be a map of strings. Exemple :

{
  "HYPHE_MAXDEPTH": "4",
  "HYPHE_DOWNLOAD_DELAY": "2",
  "HYPHE_MAX_SIM_REQ": "13",
  "HYPHE_HOST_MAX_SIM_REQ": "2",
  "HYPHE_PROXY_PORT": "1",
  "HYPHE_STORE_CRAWLED_HTML": "true",
  "HYPHE_TRAPH_KEEPALIVE": "1801",
  "HYPHE_TRAPH_MAX_SIM_PAGES": "251",
  "HYPHE_OPEN_CORS_API": "true",
  "HYPHE_DEFAULT_STARTPAGES_MODE": "[\"homepage\",\"pages-6\"]",
  "HYPHE_CREATION_RULES": "{\"twitter.com\":\"path-1\"}"
}
Note
All those parameters are set in the files config-*.env.

Deploy hyphe with text indexation

If you want o deploy hyphe with the text indexation feature, you need to add the following parameter in the config : "COMPOSE_FILE"="docker-compose.yml:docker-compose-text_indexation.yml"

The COMPOSE_FILE is set as a global variable on the server, so docker will launch the adequate docker compose files (see https://docs.docker.com/compose/reference/envvars/#compose_file)

Providers

OVH

  • It’s a public cloud service, so every servers are available on internet.

  • We don’t need to have a project

STATUS: [OK]

Vexxhost

  • Flavors doesn’t include storage, we need to create one.

  • Need to change the rules on the security group to allow HTTP, HTTPS & SSH from anywhere

STATUS: [OK]

City Cloud

All the network layout have to be done before to create a server. For example, per defaut a server has no network interface, except if a network is already present.

So we need to :

  • Create a network in the interface (it create the subnet + router …​)

  • Create the server

  • Assign a floating IP address to server

STATUS: [OK] (but need some manual actions on the interface)

ElastX

All the network layout have to be done when we create a server.

So we need to :

  • Create a network

  • Create a subnet

  • Create a security group with rules

  • Create a router between the public network and the created one

  • Create and assign a floating IP address to server

STATUS: [KO]

hyphe_openstack_client's People

Contributors

sim51 avatar paulgirard avatar

Watchers

 avatar James Cloos avatar Benjamin Ooghe-Tabanou avatar Guillaume Plique avatar Béatrice Mazoyer avatar  avatar

hyphe_openstack_client's Issues

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.