Version 5

    General information

    On boot, the agent sets up the postgresql databases, and starts the service, putting it in the started state.

     

    PostgreSQL service uses the postgresql prefix.

     

    This document describes features that will be part of v1.0beta (marked v1), and other features that will be in a future version (marked future)

    Actions

    Status

    This is a very important action which returns current state of the service (v1), along with a list of databases (future).

     

    GET /service/postgresql/status

     

    Return:

     

    {
      "state": "started",
      {
        "databases":
        [
         "somedb"
        ]
      } 
    }

    Available states

    • stopped
    • started
    • error

    Configure

    The configure command allows management of the databases. There are three commands that can be sent as part of a configuration message:

    1. create_admin (v1)
    2. create_database (future)
    3. destroy_database (future)

     

    Configure call is executed with following request:

     

    POST /service/postgresql/configure

     

    Body of this request will wary. Every configure request will require body sent in config parameter.

     

    create_admin (v1)

    This  command is a request for the agent to create an admin user for the database. This user will have full rights to manage databases and roles.

     

    {

      "create_admin":

      {

        "user": "admin_user",

        "password": "sekret"

      }

    }

     

    On  success, the response will be empty. In the case of an error, the  response will contain an error key and message for the database.

     

    {

      "error": "The user already exists"

    }

    create_database (future)

    This  command is a request for the agent to create a database. Each database will have its own user that is created at the same time, and the name and password for this user must be included in the request.

     

    {

      "create_database":

      {

        "name": "db_name1",

        "user": "db_name1_user",

        "password": "the_pw"

      }

    }

     

    On success, the response will be empty. In the case of an error, the response will contain an error key and message for the database.

     

    {

      "error": "The database already exists"

    }

    destroy_database (future)

    This  command is a request for the agent to destroy a database. The user for the database will be destroyed as well. The request must include the database name and user name.

     

    {

      "destroy_database":

      {

        "name": "db_name1",

        "user": "db_name1_user"

      }

    }

     

    On success, the response will be empty. In the case of an error, the response will contain an error key and message for the database.

     

    {

      "error": "The database does not exist"

    }

    Start (v1)

    Start action starts the service. It can only be executed when the service is in the stopped or error state. This call is not executed in background. Status action is returned.

     

    There is no request body required.

     

    POST /service/postgresql/start

     

    {
      "state": "started"
    }

    Stop (v1)

    Stop  action stops the service. It can only be executed when the service is in the started state. This call is not executed in background. Status action is returned.


    There is no request body required.

     

    POST /service/postgresql/stop

     

    Return:

     

    {
      "state": "stopped"
    }

    Restart (v1)

    Restart action restarts the service. It can only be executed when the service is in the started state. This call is not executed in background. Status action is returned.

     

    There is no request body required.

     

    POST /service/postgresql/restart

     

    Example return:

     

    {
      "state": "started"
    }

     

     

    Deploy, Undeploy, Artifacts

    This service does not provide any deployment or artifact management features in v1.