Stack

A stack is the unit of deployment in Run-App. It holds one or more services and the environment shared between them.

All requests go to the Run-App gateway and need the authentication headers. Every argument table lists subscriptionId as optional because it is optional in the schema; the frontend always sends it. The productId / appCode arguments belong to the Pay As You Go flow and are not sent by the frontend.

Create Stack

Mutation · container_createStack

Creates a run-app stack.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoID of subscription. Optional in the schema; always sent by the frontend
inputcontainer_CreateStackInput!YesStack configuration
productIdStringNoPay As You Go only; not sent by the frontend
appCodecontainer_AppCodeNoPay As You Go only; not sent by the frontend

input

container_CreateStackInput

FieldTypeRequiredDescription
stackNameString!YesName of the stack being created
deployNowBooleanNoDeploy the stack right after saving it
pullImageBooleanNoPull the images when deploying. The frontend always sends the same value as deployNow
serviceReferenceIdStringNoNot sent by the frontend
environments[container_EnvironmentInput!]NoStack-level environment variables
services[container_ServiceInput!]!YesServices belonging to the stack

environments

container_EnvironmentInput — used both at stack level and at service level.

FieldTypeRequiredDescription
envKeyStringNoThe key for the environment variable
envValueStringNoThe value for the environment variable

services

container_ServiceInput

FieldTypeRequiredDescription
serviceNameString!YesName of the service
imageString!YesContainer image to use for the service
domainNameStringNoDomain name associated with the service
portIntNoContainer port for the service. The frontend sends null when no port is published
entrypointStringNoCommand to execute when the container starts
isPrivateRegistryBooleanNoSpecifies if the image is from a private registry
containerRegistryIdStringNoID of the container registry. The frontend sends "" for public images
environments[container_EnvironmentInput!]NoService-level environment variables
restartPolicycontainer_RestartPolicyInput!YesRestart behaviour — see below
resourcescontainer_ResourceInput!YesCPU and memory allocation — see below
replicasIntNoNumber of copies of the service. The frontend sends 1 by default
mountVolume[container_MountVolumeInput!]NoNot sent by the frontend — see below
dependsOn[String!]NoNot sent by the frontend

restartPolicy

container_RestartPolicyInput

FieldTypeRequiredDescription
maxAttemptInt!YesMaximum number of restart attempts, e.g. 5
restartWindowString!YesTime window for restarts, e.g. 120s
delayString!YesDelay between restart attempts, e.g. 5s
conditioncontainer_RestartPolicyCondition!YesEnum: NONE, ON_FAILURE, ANY. The frontend defaults to ANY

resources

container_ResourceInput

FieldTypeRequiredDescription
cpuFloat!YesCPU allocation per replica, e.g. 0.5, 1
memoryFloat!YesMemory allocation per replica, e.g. 512, 1024

mountVolume

container_MountVolumeInput

FieldTypeRequiredDescription
volumeIdStringNo
containerPathStringNo
readOnlyBooleanNo

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "input": {
    "stackName": "app_01",
    "deployNow": true,
    "pullImage": true,
    "environments": [
      {
        "envValue": "http:192.189.1.1/graphql",
        "envKey": "api"
      }
    ],
    "services": [
      {
        "serviceName": "service_01",
        "restartPolicy": {
          "maxAttempt": 5,
          "restartWindow": "120s",
          "delay": "5s",
          "condition": "NONE"
        },
        "resources": {
          "memory": 512,
          "cpu": 0.5
        },
        "replicas": 1,
        "port": 80,
        "isPrivateRegistry": true,
        "image": "node:11",
        "entrypoint": "entrypoint",
        "domainName": "test01.com",
        "containerRegistryId": "66d7ca042d67cb0ada9d8408",
        "environments": [
          {
            "envValue": "127.1.1.1/graphql",
            "envKey": "url"
          }
        ]
      }
    ]
  }
}

Request

mutation Container_createStack($input: container_CreateStackInput!, $subscriptionId: String) {
  container_createStack(input: $input, subscriptionId: $subscriptionId) {
    id
    serviceCode
    serviceReferenceId
    subscriptionId
    productId
    mysabayUserId
    stackName
    status
    environment {
      envKey
      envValue
    }
    numberOfService
    serviceReference
    services {
      id
      stackId
      containerName
      serviceName
      image
      status
      replicas
      restartPolicy {
        condition
        delay
        maxAttempt
        restartWindow
      }
      dependsOn
      resource {
        cpu
        memory
      }
      entrypoint
      domain {
        domainName
        containerPort
        domainVerified
        domainGenerated
      }
      containerRegistry {
        containerRegistryId
        containerRegistryProvider
        portainerRegistryId
      }
      isPrivateRegistry
    }
  }
}

Response

Trimmed: the selection above also requests serviceCode, serviceReferenceId, productId, mysabayUserId, serviceReference and services.

{
  "data": {
    "container_createStack": {
      "id": "622c782e68cba9e68b2c3989",
      "subscriptionId": "672c73b2b4858f255a3657fc",
      "stackName": "app_01",
      "status": 3,
      "environment": [
        {
          "envValue": "http:192.189.1.1/graphql",
          "envKey": "api"
        }
      ],
      "numberOfService": 1
    }
  }
}

Update Stack

Mutation · container_updateStack

Updates an existing run-app stack.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoID of subscription. Optional in the schema; always sent by the frontend
inputcontainer_UpdateStackInput!YesStack configuration
productIdStringNoPay As You Go only; not sent by the frontend
appCodecontainer_AppCodeNoPay As You Go only; not sent by the frontend

input

container_UpdateStackInput

FieldTypeRequiredDescription
stackIdString!YesID of the stack to update
deployNowBooleanNoIndicates whether the stack should be deployed immediately
pullImageBooleanNoPull the images when deploying. The frontend sends the same value as deployNow
environments[container_EnvironmentInput!]NoStack-level environment variables
services[container_ServiceInput!]!YesThe full list of services

The environments, services, restartPolicy, resources and mountVolume structures are the same as for Create Stack.

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "input": {
    "stackId": "67501d3de6d872adef006ff6",
    "deployNow": true,
    "pullImage": true,
    "services": [
      {
        "serviceName": "service_01",
        "restartPolicy": {
          "restartWindow": "120s",
          "maxAttempt": 5,
          "delay": "5s",
          "condition": "NONE"
        },
        "resources": {
          "memory": 512,
          "cpu": 0.5
        },
        "replicas": 1,
        "port": 80,
        "isPrivateRegistry": true,
        "image": "node:11",
        "environments": [
          {
            "envValue": "127.1.1.1/graphql",
            "envKey": "url"
          }
        ],
        "entrypoint": "entrypoint",
        "domainName": "test01.com",
        "containerRegistryId": "66d7ca042d67cb0ada9d8408"
      }
    ],
    "environments": [
      {
        "envValue": "http:192.189.1.1/graphql",
        "envKey": "api"
      }
    ]
  }
}

Request

mutation Container_updateStack($input: container_UpdateStackInput!, $subscriptionId: String) {
  container_updateStack(input: $input, subscriptionId: $subscriptionId) {
    message
    success
  }
}

Response

{
  "data": {
    "container_updateStack": {
      "message": "Stack updated successfully",
      "success": true
    }
  }
}

Stack List

Query · container_listStack

Lists the stacks of a subscription.

The frontend uses it on the stack list page with the page's pager, and on the CMS page with { page: 1, limit: 1 } to read the status of the subscription's stack. It is not called while the subscription is pending suspend or suspended.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoThe ID of subscription. Optional in the schema; always sent by the frontend
pagercontainer_PagerInputNoPagination options
productIdStringNoPay As You Go only; not sent by the frontend

pager

container_PagerInput

FieldTypeRequiredDescription
pageInt!YesThe number of current page
limitInt!YesThe number of items per page

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "pager": {
    "page": 1,
    "limit": 10
  }
}

Request

query Container_listStack($subscriptionId: String, $pager: container_PagerInput) {
  container_listStack(subscriptionId: $subscriptionId, pager: $pager) {
    stacks {
      id
      stackId
      serviceCode
      subscriptionId
      mysabayUserId
      stackName
      status
      environment {
        envKey
        envValue
      }
      numberOfService
      serviceReference
      services {
        id
        stackId
        containerName
      }
    }
    pagination {
      currentPage
      lastPage
      from
      perPage
      to
      total
    }
  }
}

Response

The source has no sample response; this structure is generated from the schema, and the values show field types.

{
  "data": {
    "container_listStack": {
      "stacks": [
        {
          "id": "ID",
          "stackId": "Int",
          "serviceCode": "String",
          "subscriptionId": "String",
          "mysabayUserId": "Float",
          "stackName": "String",
          "status": "Int",
          "environment": [
            {
              "envKey": "String",
              "envValue": "String"
            }
          ],
          "numberOfService": "Int",
          "serviceReference": "container_JSON",
          "services": [
            {
              "id": "ID",
              "stackId": "ID",
              "containerName": "String"
            }
          ]
        }
      ],
      "pagination": {
        "currentPage": "Int",
        "lastPage": "Int",
        "from": "Int",
        "perPage": "Int",
        "to": "Int",
        "total": "Int"
      }
    }
  }
}

Stack Information

Query · container_getStackById

Returns details for a single stack. To list the services inside it, see Service List.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoID of subscription. Optional in the schema; always sent by the frontend
stackIdString!YesThe ID of stack
productIdStringNoPay As You Go only; not sent by the frontend

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "stackId": "67501d3de6d872adef006ff6"
}

Request

query Container_getStackById($stackId: String!, $subscriptionId: String) {
  container_getStackById(stackId: $stackId, subscriptionId: $subscriptionId) {
    id
    stackId
    serviceCode
    serviceReferenceId
    subscriptionId
    productId
    mysabayUserId
    stackName
    planType
    status
    environment {
      envKey
      envValue
    }
    createdAt
    updatedAt
    numberOfService
    serviceReference
    services {
      id
      stackId
      containerName
      serviceName
      image
      mountVolume {
        volumeId
        volumePath
        containerPath
        readOnly
        volumeName
      }
      status
      replicas
      restartPolicy {
        condition
        delay
        maxAttempt
        restartWindow
      }
      dependsOn
      resource {
        cpu
        memory
      }
      entrypoint
      domain {
        domainName
        containerPort
        domainVerified
        domainGenerated
      }
      containerRegistry {
        containerRegistryId
        containerRegistryProvider
        portainerRegistryId
      }
      isPrivateRegistry
      createdAt
      updatedAt
    }
  }
}

Response

Trimmed: the selection above also requests stackId, serviceCode, serviceReferenceId, productId, mysabayUserId, planType, serviceReference and services.

{
  "data": {
    "container_getStackById": {
      "id": "672c7b16a0deed3f1f3d6961",
      "subscriptionId": "66d7c0fef0b997c90679b0b3",
      "stackName": "app_02",
      "status": 1,
      "environment": [
        {
          "envKey": "api",
          "envValue": "/http:192.189.1.1/graphql"
        }
      ],
      "createdAt": 1730968342568,
      "updatedAt": 1733210386593,
      "numberOfService": 1
    }
  }
}

Remove Stack

Mutation · container_deleteStackById

Removes a stack.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoThe ID of subscription. Optional in the schema; always sent by the frontend
stackIdString!YesThe ID of stack

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "stackId": "67501d3de6d872adef006ff6"
}

Request

mutation Container_deleteStackById($subscriptionId: String, $stackId: String!) {
  container_deleteStackById(subscriptionId: $subscriptionId, stackId: $stackId) {
    message
    success
  }
}

Response

{
  "data": {
    "container_deleteStackById": {
      "message": "Stack is being processed",
      "success": true
    }
  }
}

Stop Stack

Mutation · container_stopStackById

Stops a running stack.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoThe ID of subscription. Optional in the schema; always sent by the frontend
stackIdString!YesThe ID of stack

Variables

{
  "stackId": "67501d3de6d872adef006ff6",
  "subscriptionId": "67ab067f092e8f8c2beb2df5"
}

Request

mutation Container_stopStackById($subscriptionId: String, $stackId: String!) {
  container_stopStackById(subscriptionId: $subscriptionId, stackId: $stackId) {
    message
    success
  }
}

Response

{
  "data": {
    "container_stopStackById": {
      "message": "Stack is being processed",
      "success": true
    }
  }
}

Start Stack

Mutation · container_startStackById

Starts a stopped stack, without re-pulling images.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoThe ID of subscription. Optional in the schema; always sent by the frontend
stackIdString!YesThe ID of stack

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "stackId": "67501d3de6d872adef006ff6"
}

Request

mutation Container_startStackById($subscriptionId: String, $stackId: String!) {
  container_startStackById(subscriptionId: $subscriptionId, stackId: $stackId) {
    message
    success
  }
}

Response

{
  "data": {
    "container_startStackById": {
      "message": "Stack is being processed",
      "success": true
    }
  }
}

Restart Stack

Mutation · container_updateStack

Restarts a stack (the Pull & Restart action in the frontend). This reuses the Update Stack mutation with a dedicated payload.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoID of subscription. Optional in the schema; always sent by the frontend
inputcontainer_UpdateStackInput!YesRestart payload

input

FieldTypeRequiredDescription
stackIdString!YesThe ID of stack
services[container_ServiceInput!]!YesValue of []
pullImageBooleanNoOptional in the schema. Value of true

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "input": {
    "pullImage": true,
    "services": [],
    "stackId": "67501d3de6d872adef006ff6"
  }
}

Request

mutation Container_updateStack($input: container_UpdateStackInput!, $subscriptionId: String) {
  container_updateStack(input: $input, subscriptionId: $subscriptionId) {
    message
    success
  }
}

Response

{
  "data": {
    "container_updateStack": {
      "message": "Stack updated successfully",
      "success": true
    }
  }
}

Pull & Deploy Stack

Mutation · container_deployStackById

Pulls the latest images and deploys the stack. In the frontend this is the Deploy action for a stack that was never deployed, and Rebuild Stack otherwise: it recreates the stack on the latest images, and services are down until it finishes.

Arguments

NameTypeRequiredDescription
subscriptionIdStringNoID of subscription. Optional in the schema; always sent by the frontend
stackIdString!YesThe ID of stack
productIdStringNoPay As You Go only; not sent by the frontend
appCodecontainer_AppCodeNoPay As You Go only; not sent by the frontend

Variables

{
  "subscriptionId": "67ab067f092e8f8c2beb2df5",
  "stackId": "67501d3de6d872adef006ff6"
}

Request

mutation Container_deployStackById($subscriptionId: String, $stackId: String!) {
  container_deployStackById(subscriptionId: $subscriptionId, stackId: $stackId) {
    message
    success
  }
}

Response

{
  "data": {
    "container_deployStackById": {
      "message": "Stack is being processed",
      "success": true
    }
  }
}