For AI agents: the complete documentation index is available at https://docs.dataplatform.ovh.net/llms.txt, the full documentation bundle is available at https://docs.dataplatform.ovh.net/llms-full.txt, and this page is available as Markdown at https://docs.dataplatform.ovh.net/sdk/api-api-launch.md.
  • πŸ‡¬πŸ‡§ English
  • Launch an API in a local environment

    Warning

    Rework pending, no delivery date. The Front App SDK (ReactJS) and the Front API SDK (NodeJS) are both being replaced. This page documents the current release, remains accurate, and is maintained until the replacement ships. Code written against it keeps working.

    While OVHcloud Data Platform is great as a tool for hosting deployed APIs during both development and production, it’s not always the natural place to edit code. Most software engineers prefer to edit their code on their computer.

    Below is how you can build and deploy an API from a local development environment.


    Requirements

    NodeJS

    Currently we use v10 in production, but we will soon update it to 14. In local, it will work with both versions, we recommend using v14 right now, but to keep a look on the functions used while the update is not done in production. Install it from here.

    Redis (optional)

    By default the API use Redis as cache in production It can be disable for dev, but you can also use a local redis

    Install redis

    If you want to have it locally, we recommand to install and use Docker. Then it is possible to:

    # start a redis locally
    docker run --name redis -d -p 6379:6379 redis
    # stop it
    docker stop redis
    # restart it
    docker start redis
    # remove it (need to be stop before, or to add the flag -f in the command)
    docker rm redis

    or Disable cache

    • Open "forepaas.json"
    • Replace these occurence
    "cache": {
        "module": "cache-redis"
    },

    by

    "_cache": {
        "module": "cache-redis"
    },
    • Remove the cache redis main occurence
        "cache-redis": {
          "version": "2.0.0"
        },

    Download and install locally

    • From the GUI, go to the API Overview https://eu.dataplatform.ovh.net/#/api/\{ProjectID\}/\{API_NAME\}
    • Select the tag you want to copy, then click on "Download that version"
    • Extract the zip in a folder of your choice
    • Install node dependencies (we use the package manager yarn by default, we recommend you to use the same to have same condition than production)
    yarn

    Launch the API

    By default you should find a "run.sh" script, already here, giving a sample of quick run

    KONG_INTERNAL_URI=false \
    FOREPAAS_APPLICATION_CREDENTIALS=./creds.json \
    FOREPAAS_QB_RESOURCE_ID=http://qb-service:9000 \
    REDIS_URI=redis://127.0.0.1 \
    ENV=development \
    yarn run start
    • KONG_INTERNAL_URI: it will disable a production mode for URL computing, we plan to remove that variable in future
    • FOREPAAS_APPLICATION_CREDENTIALS: used to link to a local creds.json file, it will be described below
    • FOREPAAS_QB_RESOURCE_ID: get legacy ACL resources
    • REDIS_URI: if using a local redis, it should override the URL here, as explained in previous section (it should already be the correct value)
    • ENV: set to development for local development
    • yarn run start: it will launch the API, use yarn run watch to reload as soon as code is updated in local environement

    If you launch the API, it should start well, but you will not be identify to the platform and your API will not be able to call the Project API. For this, you need to get authenticated.


    Manage authentication

    By default, in production on OVHcloud Data Platform, the API is self-authenticated to the other Project components. But when you are in a local development environment, you need to authenticate though the Identity Access Manager.

    The best way to do it is by generating API and secret key for a user (or a service account). You will also need your Project subdomain.

    Once you have the keys and project subdomain, you can create a file called "creds.json" at the root of the API. This file should never be committed (set in .gitignore by default).

    {
        "dataplant_url": "https://{DATAPLANT_SUBDOMAIN}.eu.dataplatform.ovh.net",
        "api_key": "610aa8766608131b00000095610aa87f6608131b00000097",
        "secret_key": "8559d0f805dbb981XXXXXXXXXXXXXXXXXXXXXXXXXXXXX8bf9af358a4"
    }

    Launch everything together

    Launch your API by calling the "run.sh" file.

    sh run.sh

    Go further

    If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.

    Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated Discord channel.

    If you need support with your OVHcloud services, create a request in our Help Centre.

    Join our community of users.