v1beta
Double column
curl
API
CLI

Services /

Create combined service

Creates a new combined service.

URL parameters

    • project

      string required

      ID of the project

Request attributes

  • object

    • name

      string required

      The name of the service.

      pattern
      ^[a-zA-Z](-?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$
      min length
      3
      max length
      20
    • description

      string

      A description of the service.

      pattern
      ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
      max length
      200
    • billing

      object required

      • deploymentPlan

        string required

        The ID of the deployment plan to use.

        pattern
        ^[A-Za-z0-9-]+$
    • deployment

      object required

      • instances

        integer required

        The number of instances to run the service on.

    • ports

      array

      • object

        • name

          string required

          The name used to identify the port.

          pattern
          ^[a-zA-Z](-?[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$
        • internalPort

          integer required

          The port number.

          min
          1
          max
          65535
        • public

          boolean

          If true, the port will be exposed publicly.

        • protocol

          string required

          The protocol to use for the port.

          one of
          HTTP, TCP, UDP
    • security

      object

      • credentials

        array required

        An array of credentials to access the service.

        • object

          • username

            string required

            The username to access the service

            pattern
            ^[a-zA-Z0-9]+$
            min length
            3
            max length
            20
          • password

            string required

            The password to access the service with this username.

          • ports

            array

            An array of names of ports using these credentials

            • string

              The name of a port using these credentials

              pattern
              ^[a-z]-?[a-z0-9]+(-[a-z0-9]+)*$
              min length
              3
              max length
              20
          • type

            string required

            The type of authentication used

            one of
            basic-auth
      • policies

        array

        An array of IP address policies.

        • object

          • addresses

            array required

            An array of IP addresses used for this rule

            • string

              An IP address used by this rule

          • action

            string required

            The action for this rule.

            one of
            ALLOW, DENY
          • ports

            array

            An array of names of ports using these credentials

            • string

              The name of a port using these credentials

              pattern
              ^[a-z]-?[a-z0-9]+(-[a-z0-9]+)*$
              min length
              3
              max length
              20
    • vcsData

      object required

      • projectUrl

        string required

        URL of the Git repo to build.

      • projectType

        string required

        The VCS provider to use.

        one of
        bitbucket, gitlab, github, self-hosted
      • vcsId

        string

        If projectType is self-hosted, the ID of the self-hosted vcs to use.

        pattern
        ^[A-Za-z0-9-]+\/[A-Za-z0-9-]+$
      • dockerFilePath

        string required

        The file path of the Dockerfile.

        pattern
        ^\/([a-zA-Z0-9-._]+\/)*[a-zA-Z0-9-._]+$
      • dockerWorkDir

        string required

        The working directory of the Dockerfile.

        pattern
        ^\/([a-zA-Z0-9-._]+\/)*[a-zA-Z0-9-._]*$
      • projectBranch

        string required

        The name of the branch to use.

    • environment

      object

      An object containing the environment variables to set for the service

      • buildArguments

        object

        An object containing the build arguments to set for the service

      Response attributes

      • object

        • id

          string required

          The ID of the newly created service

        • serviceType

          string required

          The type of the service created

        • buildInitiated

          boolean required

          Whether the service will be built immediately

        • name

          string required

          The name of the newly created service.

        • description

          string

          The description of the newly created service.

      API
      CLI

      POST /v1/projects/{project}/services/combined

      Example request

      request body

      curl

      curl --header "Content-Type: application/json" \
        --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
        --request POST \
        --data '{"name":"Example Service","description":"A service description","billing":{"deploymentPlan":"nf-compute-20"},"deployment":{"instances":1},"ports":[{"name":"port-1","internalPort":8080,"public":true,"protocol":"HTTP"}],"security":{"credentials":[{"username":"admin","password":"password123","ports":["port-1"],"type":"basic-auth"}],"policies":[{"addresses":["127.0.0.1"],"action":"DENY","ports":["port-1"]}]},"vcsData":{"projectUrl":"https://github.com/northflank/gatsby-with-northflank","projectType":"github","dockerFilePath":"/Dockerfile","dockerWorkDir":"/","projectBranch":"master"},"environment":{"VARIABLE_1":"abcdef","VARIABLE_2":"12345"},"buildArguments":{"ARGUMENT_1":"abcdef","ARGUMENT_2":"12345"}}' \
        https://api.northflank.com/v1/projects/{project}/services/combined

      Example response

      200 OK

      Details about the newly created service.

      JSON

      {
        "id": "new-service",
        "serviceType": "combined",
        "buildInitiated": true,
        "name": "New Service",
        "description": "This is a new service."
      }

      Example response

      409 Conflict

      There is already a service with the same derived identifier

      © 2021 Northflank Ltd. All rights reserved.

      TermsPrivacy

      contact@northflank.com