Apps
Deploy, manage, and monitor containerized applications.
Overview
The client.apps resource lets you:
- Create and deploy containerized applications
- Manage the full application lifecycle (start, stop, restart, deploy)
- Monitor status, logs, and resource metrics
- Configure environment variables, replicas, and resource limits
Basic Usage
from strongly import Strongly
client = Strongly()
# List all running apps
for app in client.apps.list(status="running"):
print(f"{app.name} — {app.status} — {app.url}")
# Create a new app
app = client.apps.create({
"name": "my-api",
"description": "Customer-facing REST API",
"image": "my-org/my-api:latest",
"port": 8080,
})
print(f"Created: {app.id}")
Creating an App
Pass a dictionary with your app configuration to create():
from strongly import Strongly
client = Strongly()
app = client.apps.create({
"name": "data-processor",
"description": "Processes incoming data events",
"image": "my-org/data-processor:v2.1",
"port": 8000,
"replicas": 2,
"environment": {
"LOG_LEVEL": "info",
"WORKERS": "4",
},
"resources": {
"cpu": "500m",
"memory": "1Gi",
},
"labels": {
"team": "backend",
"tier": "production",
},
})
print(f"App ID: {app.id}")
print(f"Status: {app.status}")
Create Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | str | Yes | Unique application name |
description | str | No | Human-readable description |
image | str | No | Container image (e.g., my-org/app:v1) |
port | int | No | Port the container listens on |
replicas | int | No | Number of replicas (default: 1) |
environment | dict | No | Environment variables as key-value pairs |
resources | dict | No | CPU/memory resource limits |
project_id | str | No | Project to associate the app with |
labels | dict | No | Key-value labels for organization |
Deploying an App
After creating an app, deploy it to make it live:
from strongly import Strongly
client = Strongly()
app = client.apps.create({
"name": "my-service",
"image": "my-org/my-service:latest",
"port": 3000,
})
# Deploy the app
client.apps.deploy(app.id)
Application Lifecycle
Control your application with lifecycle methods:
from strongly import Strongly
client = Strongly()
app_id = "app-abc123"
# Stop a running app
client.apps.stop(app_id)
# Start a stopped app
client.apps.start(app_id)
# Restart an app (rolling restart)
client.apps.restart(app_id)
Checking Status
Monitor deployment health and readiness:
from strongly import Strongly
import time
client = Strongly()
# Deploy and wait for readiness
client.apps.deploy(app.id)
while True:
status = client.apps.status(app.id)
print(f"State: {status.state}, Ready: {status.ready_replicas}/{status.replicas}")
if status.ready_replicas and status.ready_replicas > 0:
print(f"App is live at {status.url}")
break
time.sleep(5)
AppStatus Fields
| Field | Type | Description |
|---|---|---|
state | str | Current state (e.g., running, deploying, stopped) |
message | str | Human-readable status message |
replicas | int | Desired number of replicas |
ready_replicas | int | Number of replicas that are ready |
url | str | Public URL of the application |
Viewing Logs
Retrieve container logs for debugging:
from strongly import Strongly
client = Strongly()
# Get the last 100 lines
logs = client.apps.logs("app-abc123", lines=100)
print(logs)
# Get logs from the last 30 minutes
logs = client.apps.logs("app-abc123", since="30m")
# Get logs from a specific container
logs = client.apps.logs("app-abc123", container="worker")
Viewing Metrics
Retrieve resource usage metrics:
from strongly import Strongly
client = Strongly()
metrics = client.apps.metrics("app-abc123")
print(metrics)
Updating an App
Update any field on an existing app. All body fields are optional:
from strongly import Strongly
client = Strongly()
updated = client.apps.update("app-abc123", {
"description": "Updated description",
"replicas": 3,
"environment": {
"LOG_LEVEL": "debug",
"WORKERS": "8",
},
})
print(f"Replicas: {updated.replicas}")
Deleting an App
from strongly import Strongly
client = Strongly()
client.apps.delete("app-abc123")
Filtering and Searching
Use keyword arguments on list() to filter results:
from strongly import Strongly
client = Strongly()
# Filter by status
for app in client.apps.list(status="running"):
print(app.name)
# Filter by environment
for app in client.apps.list(environment="production"):
print(f"{app.name} — {app.environment}")
# Search by name
for app in client.apps.list(search="api"):
print(app.name)
# Combine filters
for app in client.apps.list(status="running", environment="production"):
print(f"{app.name}: {app.url}")
# Get all results as a list
all_apps = client.apps.list().to_list()
print(f"Total apps: {len(all_apps)}")
Complete Example
from strongly import Strongly
import time
def main():
client = Strongly()
# --- Create and deploy ---
print("Creating app...")
app = client.apps.create({
"name": "example-api",
"description": "Example REST API service",
"image": "my-org/example-api:v1.0",
"port": 8080,
"replicas": 2,
"environment": {
"NODE_ENV": "production",
"LOG_LEVEL": "info",
},
"resources": {
"cpu": "500m",
"memory": "512Mi",
},
"labels": {
"team": "platform",
"tier": "production",
},
})
print(f"Created app: {app.id}")
# --- Deploy ---
print("\nDeploying...")
client.apps.deploy(app.id)
# --- Wait for readiness ---
while True:
status = client.apps.status(app.id)
print(f" State: {status.state}, Ready: {status.ready_replicas}/{status.replicas}")
if status.ready_replicas and status.ready_replicas >= 2:
print(f" Live at: {status.url}")
break
time.sleep(5)
# --- View logs ---
print("\nRecent logs:")
logs = client.apps.logs(app.id, lines=20)
print(logs)
# --- View metrics ---
print("\nMetrics:")
metrics = client.apps.metrics(app.id)
print(metrics)
# --- Scale up ---
print("\nScaling to 4 replicas...")
client.apps.update(app.id, {"replicas": 4})
client.apps.restart(app.id)
# --- Cleanup ---
print("\nStopping app...")
client.apps.stop(app.id)
status = client.apps.status(app.id)
print(f"Final state: {status.state}")
if __name__ == "__main__":
main()
App Model
| Field | Type | Description |
|---|---|---|
id | str | Unique app identifier |
name | str | Application name |
description | str | Human-readable description |
status | str | Current status (e.g., running, stopped, deploying) |
image | str | Container image |
port | int | Container port |
replicas | int | Desired replica count |
environment | dict | Environment variables |
resources | dict | CPU/memory resource configuration |
url | str | Public URL |
organization_id | str | Owning organization |
project_id | str | Associated project |
labels | dict | Key-value labels |
owner | str | Owner user ID |
permissions | dict | Access permissions |
created_at | str | Creation timestamp |
updated_at | str | Last update timestamp |
Method Reference
| Method | Description | Returns |
|---|---|---|
list(*, status=None, environment=None, search=None, limit=50) | List apps with optional filters | SyncPaginator[App] |
create(body) | Create a new app | App |
retrieve(app_id) | Get an app by ID | App |
update(app_id, body) | Update app fields | App |
delete(app_id) | Delete an app | dict |
deploy(app_id, **kwargs) | Deploy the app | dict |
start(app_id) | Start a stopped app | dict |
stop(app_id) | Stop a running app | dict |
restart(app_id) | Restart the app | dict |
status(app_id) | Get deployment status | AppStatus |
create_with_upload(file, *, name=None, description=None, framework=None, runtime=None, **kwargs) | Create an app from a file upload | dict |
deploy_upload(app_id, file, **kwargs) | Deploy from a file upload | dict |
logs(app_id, *, lines=None, since=None, container=None) | Retrieve container logs | Any |
metrics(app_id) | Get resource usage metrics | dict |