Container Platform

Below are the endpoints that allow interaction with Tempico Labs PaaS workloads.

Any services unrelated to cloud hosting will return an error stating: "This action cannot be applied to the chosen service."

[GET] List all services

Endpoint
[GET] https://api.itsecurity.ee/v4/services
Description

The API endpoint allows listing all Container Platform services linked to the customer's account.


Response Keys
  • updated_at (str): UTC time at which the service was last updated.
  • service_id (str): Unique identifier of the service.
  • title (str): Human-friendly name or title of the service.

Example Response
{
  "additional_data": {},
  "payload": [
    {
      "updated_at": "2023-01-15 16:55:09",
      "service_id": "6076e602ce06b33a30c15cb1",
      "title": "Container: A CPU-hungry service"
    },
    {
      "updated_at": "2023-01-10 10:05:12",
      "service_id": "63cdb0c05648af84b9c570aa",
      "title": "Container: Database cluster example"
    }
  ],
  "success": true
}

[GET] Service status

Endpoint
[GET] https://api.itsecurity.ee/v4/services/{service_id}
Description

This endpoint returns information about the specified service with the given service_id , providing its current status and details of active instances.


Response Keys
  • allocations (list): List of active instances of the service.
  • allocation_id (str): Unique identifier of the allocation.
  • allocation_type (str): Type of the allocation (service or batch).
  • cpu_arch (str): Architecture of the CPU on the underlying host.
  • cpu_core_quota (float): Normalized number of cores allowed for concurrent use on the underlying host.
  • cpu_frequency (int): Core frequency on the underlying host (MHz).
  • cpu_utilization (float): Current CPU use as a percentage against the quota.
  • created_at (str): UTC time at which the allocation was started on the underlying host.
  • datacenter (str): Code of the datacenter where the allocation was started.
  • image (str): The repository URL for the container image used.
  • cpu_throttled_periods (int): Indicates the number of CPU throttling events since the allocation started. Large rising numbers hint at the need for more CPU resources than the current plan provides.
  • node_id (str): Unique identifier of the underlying node where the allocation is started.
  • ram_max_utilization (float): Observed maximum memory utilization (in megabytes) since the allocation started.
  • ram_quota (int): Amount of RAM dedicated to the allocation (in megabytes).
  • ram_utilization (float): Current RAM use (in megabytes).
  • status (str): Status of the allocation (queued, starting, running, failed, or lost).
  • storage_class (str): Type of backend storage technology used (hdd, ssd, nvme).
  • volume_mounts (list): Describes volumes attached to the allocation.
    • path (str): Path inside the allocation.
    • read_only (bool): Mode (read-only).
  • updated_at (str): UTC time at which the service was last updated.
  • failed (int): Calculated amount of allocations that have failed.
  • running (int): Calculated amount of allocations that are currently running.
  • starting (int): Calculated amount of allocations that are starting.
  • recent_log_events_count (int): Count of log lines produced by the service for the last 5 minutes.
  • http_access_log_enabled (bool): Indicates if http access log collection via public Load Balancer is enabled.
  • service_id (str): Unique identifier of the service.
  • state (str): Calculated state of the service.
  • title (str): Human-friendly name of the service.

Example Response
{
  "additional_data": {},
  "payload": [
    {
      "allocations": [
        {
          "allocation_id": "5c2e9cb6-8f5f-37f9-b592-274c41251db8",
          "allocation_type": "service",
          "cpu_arch": "amd64",
          "cpu_core_quota": 0.08,
          "cpu_frequency": 3675,
          "cpu_utilization": 38.45,
          "created_at": "2023-01-17 13:57:24",
          "datacenter": "de2",
          "image": "registry.domain/awesome/service:v1.0"
          "is_cpu_throttled": false,
          "node_id": "8a594db1-e521-494c-a8f1-3f901230d0a2",
          "ram_max_utilization": 489.21,
          "ram_quota": 512,
          "ram_utilization": 419.5,
          "status": "running",
          "storage_class": "nvme",
          "volume_mounts": [
            {
              "path": "/data/",
              "read_only": false
            }
          ]
        }
      ],
      "updated_at": "2023-01-10 12:00:09",
      "failed": 0,
      "running": 1,
      "starting": 0,
      "recent_log_events_count": 94,
      "http_access_log_enabled": true,
      "service_id": "62f59112afa80131ad6cb10c",
      "state": "running",
      "title": "Container: Awesome service"
    }
  ],
  "success": true
}

[POST] Stop service

Endpoint
[POST] https://api.itsecurity.ee/v4/services/{service_id}/stop
Description

This API endpoint allows to send the stop command to the service specified by service_id . When a service is stopped, its operation is suspended, and it will no longer consume CPU, RAM, or network resources. However, some resources, like NVMe disk storage, shared MongoDB/MySQL databases, S3, etc., may still be consumed by the stopped service.

If a stateless service remains stopped for an extended period (weeks), it may eventually be removed from the account. If a stopped service is required again, please contact the support team to request recovery.

Example Response
{
  "additional_data": {},
  "payload": {
    "status": "The stop command sent successfully"
  },
  "success": true
}

[POST] Start Service

Endpoint
[POST] https://api.itsecurity.ee/v4/services/{service_id}/start
Description

The API endpoint allows triggering the start process for a service that was previously stopped, identified by the {service_id} parameter. When a service is started, it will return to full functionality, and resource usage, including CPU, RAM, and Network consumption, will be billed again accordingly.


Example Response
{
  "additional_data": {},
  "payload": {
    "status": "The start command sent successfully"
  },
  "success": true
}

[POST] Restart service

Endpoint
[POST] https://api.itsecurity.ee/v4/services/{service_id}/restart
Description

Utilize this API endpoint to perform a rolling restart for a service that's already running and identified by the service_id parameter. The rolling restart functionality proves highly beneficial when deploying updated container images, as it ensures a smooth update process without disrupting the ongoing service operations.


Example Response
{
  "additional_data": {},
  "payload": {
    "restarted_instances": 1,
    "status": "Rolling restart successfully completed"
  },
  "success": true
}

[POST] Scale Service

Endpoint
[POST] https://api.itsecurity.ee/v4/services/{service_id}/scale?count=3
Description

The system allows adjusting the scale of a specific service identified by the {service_id} parameter. By using the count parameter, the service can be scaled to a desired number of instances. The system will automatically add or remove instances as needed to reach the desired count. The scaling takes effect immediately, and the progress can be monitored in real-time using the /status endpoint.


Example Response
{
  "additional_data": {},
  "payload": {
    "status": "The scale command sent successfully"
  },
  "success": true
}

[GET] Get service logs

Billable

Endpoint
[GET] https://api.itsecurity.ee/v4/services/{service_id}/logs?date_from=2022-01-14%2017%3A15&date_to=2022-09-01%2023%3A00&term=exception&limit=10000000&format=text&stream=stderr&follow
Description

This API endpoint enables the retrieval of logs aggregated from all workloads within the specified service. The logs can be filtered by various parameters, including date range, search term, log stream, and limit for the number of log lines.


Log Formatting

The default log format is text , which is suitable for most use cases. Alternatively, logs can be sent in newline-delimited JSON format (jsonl ). Depending on the stream , the JSON format may contain more data.

For example, HTTP access logs in text mode provide essential information about the request. However, HTTP access logs in jsonl format include raw request and response headers, among other details, for more in-depth troubleshooting. Similarly, WAF logs in jsonl format contain additional information such as matched strings and rule details.


Filters

The endpoint allows log filtering based on a search term , log stream , date range (date_from /date_to ), and limit for output lines. In jsonl mode, it performs a case-insensitive search on the entire JSON object, making it useful for retrieving events related to a specific string (e.g., application's component, error, IP, user agent, query). The filtering arguments are optional, with default values for date_from : 00:00 of the current day (UTC), and limit / date_to : unlimited. When using the follow argument, date_from , date_to , and limit are ignored.


Storage Quota & Retention

Historical logs have a storage limit of 100 megabytes in the free tier and can be extended up to 20 gigabytes per service. The oldest log entries are automatically deleted when the retention limit is reached or when the oldest event exceeds 60 days.

The logs are retained during workload updates and are deleted entirely when a service is scheduled for complete removal from the account.

To increase the log storage quota, please get in touch with Support or your dedicated Account Manager.


Streams

Streams are used to separate different types of log events. The default log streams, such as stdout , stderr , and access may be extended with a custom streams assigned to a specific service or group of services.

All streams share the same log storage quota and the retention policy.


Parameters

Here are the parameters for the GET request to retrieve service logs:

  • date_from : 2022-01-14%2017%3A15 (Timestamp in ISO8601 format - URL-encoded if necessary) - Start date and time for log retrieval. Logs from this date onwards will be included in the response.
  • date_to : 2022-09-01%2023%3A00 (Timestamp in ISO8601 format - URL-encoded if necessary) - End date and time for log retrieval. Logs up to this date will be included in the response.
  • term : exception (Case-insensitive search term - URL-encoded if necessary) - Filter logs based on a specific search term. Only logs containing this term will be included in the response.
  • limit :10000000 (Limit for log lines returned) - Set the maximum number of log lines to be returned. If not specified, logs will be returned without a limit.
  • format : text (Format of logs returned: text / jsonl) - Determines the format of the logs to be returned. By default, logs are returned in text format, but "jsonl" can be chosen for newline-delimited JSON format.
  • stream : stderr (Filter by log stream) - Allows filtering logs based on a specific log stream. For example, "stderr" filters logs related to standard error output.
  • follow : (Follow new events instead of fetching historical data) - If included and set to true, the API will continuously stream new log events as they occur. The date_from , date_to , and limit parameters will be ignored when follow is specified. This parameter is optional.

These parameters offer flexibility in customizing log retrieval according to needs and are optional.


Example Response (text)
[2022-08-12 00:16:19.248001] 63b544fcb1/stdout> Loading modules
[2022-08-12 00:16:21.143514] 63b544fcb1/stdout> Debug mode: False
[2022-08-12 00:16:14.915000] 63b544fcb1/stdout> Running on http://127.0.0.1:5000 (CTRL + C to quit)
Example Response (jsonl)
{"timestamp": 1695219789.57, "source": "63b544fcb1", "stream": "stdout", "message": "Running on http://127.0.0.1:5000 (CTRL + C to quit)", "event_id": "650b2a7d78ee7c001251b2f9"}
Example Response (access log, jsonl)
{"timestamp": 1700791812.312, "datetime": "2023-11-24 04:10:12", "source": "tl-ingress", "stream": "access", "message": {"client_ip": "143.42.97.213", "client_port": 50916, "client_username": null, "duration_ms": 3, "retry_attempts": 0, "tls_version": "1.3", "tls_cipher": "TLS_AES_128_GCM_SHA256", "request": {"body_size": 0, "scheme": "https", "protocol": "HTTP/2.0", "method": "GET", "uri": "/", "host": "example.com", "headers": {"Accept": "/", "Accept-Encoding": "gzip", "User-Agent": "Tempico Labs health check bot Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", "X-Forwarded-Host": "example.com", "X-Forwarded-Port": "443", "X-Forwarded-Proto": "https", "X-Real-Ip": "143.42.97.213"}, "referer": null, "user_agent": "Tempico Labs health check bot Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", "uri_parsed": {"path": "/", "query": null, "fragment": null}, "referer_parsed": null}, "response": {"body_size": 27074, "status_code": 200, "headers": {"Content-Encoding": "gzip", "Content-Type": "text/html; charset=UTF-8", "Date": "Fri, 24 Nov 2023 04:10:12 GMT", "Last-Modified": "Thu, 23 Nov 2023 23:14:56 GMT", "Server": "nginx", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "DENY"}}, "client_ip_location": {"region_name": "England", "continent_name": "Europe", "region_code": "ENG", "city": "London", "country_name": "United Kingdom", "country_code": "GB", "latitude": 51.5088, "longitude": -0.093, "is_eu": false, "coordinates": "51.5088,-0.093", "currency": "GBP", "phone_code": "+44", "postal_code": "EC4R", "time_zone": "Europe/London"}}, "event_id": "65602225bce100766f8dfb75"}


[GET] List ENV variables

Endpoint
[GET] https://api.itsecurity.ee/v4/services/{service_id}/env
Description

The API endpoint allows to list custom environment (ENV) variables assigned to the service's allocations.


Response Keys
  • name (srt): The name of the environment variable.
  • size (str): The size in bytes of the variable name and its value consumed against the total quota.

Example Response
{
  "additional_data": {
    "bytes_free": 16283,
    "bytes_used": 101,
    "quota": 16384
  },
  "payload": [
    {
      "name": "ERROR_LOG_LEVEL",
      "size": 20
    },
    {
      "name": "PHP_MEMORY_LIMIT",
      "size": 20
    },
    {
      "name": "PHP_WORKERS",
      "size": 13
    }
  ],
  "success": true
}

[PUT] Set/Update ENV Variable

Endpoint
[PUT] https://api.itsecurity.ee/v4/services/{service_id}/env/{VARIABLE_NAME}
Description

This API endpoint allows adding or modifying a custom environment (ENV) variable for a specific service. The variable name must be in UPPER CASE and can only include Latin characters (A-Z) and/or underscores (_).

Making changes to the ENV variables will trigger a rolling restart of the service's allocations.

Response Keys
  • name (str): The name of the environment variable that was inserted or updated.
  • size (str): The size in bytes of the variable name and its value consumed against the total quota.
  • value (str): The value of the environment variable that was inserted or updated.

Example Response
{
  "additional_data": {
    "bytes_free": 16250,
    "bytes_used": 134,
    "quota": 16384
  },
  "payload": [
    {
      "name": "TEST_TOKEN",
      "size": 18,
      "value": "My value"
    }
  ],
  "success": true
}

[DELETE] Delete ENV Variable

Endpoint
[DELETE] https://api.itsecurity.ee/v4/services/{service_id}/env/{VARIABLE_NAME}
Description

This API endpoint deletes a custom environment (ENV) variable linked to the specified service.


Example Response
{
  "additional_data": {
    "bytes_free": 16283,
    "bytes_used": 101,
    "quota": 16384
  },
  "payload": [
    {
      "name": "TEST_TOKEN",
      "size": 0
    }
  ],
  "success": true
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us