Skip to main content

Restack Cloud sdk

Restack Cloud SDK allows you to manage and deploy stacks and applications to the Restack platform.

Installation

First, install the necessary dependencies:

pip install restack-sdk-cloud

Configuration

Create a .env file in the root of your project and add your Restack Cloud token: To get your cloud token navigate to the restack console and generate a new one under your workspace settings.

RESTACK_CLOUD_TOKEN=your_restack_cloud_token

In case you don't want the SDK to ask for your confirmation before applying changes set on your .env. This is ideally set on your cicd pipeline so there is no blocking prompt and deployment doesn't asks for user confirmation.

RESTACK_CICD=true

Usage

Below is an example of how to use the Restack Cloud SDK to create and deploy stacks and applications.

Example

Create a file named restack_up.py and add the following content:

import os
from restack_sdk_cloud import RestackCloud

async def main():
    # Initialize the RestackCloud client with the Cloud token from environment variables
    restack_cloud_client = RestackCloud(os.getenv('RESTACK_CLOUD_TOKEN'))

    # Define the frontend application configuration
    frontend_app = {
        'name': 'frontend-python',
        'dockerFilePath': 'frontend/Dockerfile',
        'dockerBuildContext': 'frontend',
        'environmentVariables': [
            {
                'name': 'NEXT_PUBLIC_API_HOSTNAME',
                'linkTo': backend_app['name'],
            },
        ],
    }

    # Configure the stack with the applications
    await restack_cloud_client.stack({
        'name': 'development environment python',
        'previewEnabled': False,
        'applications': [frontend_app],
    })

    # Deploy the stack
    await restack_cloud_client.up()

# Run the main function
if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

API

- `token`: Your Restack SDK token. You can generate a token in the Restack console under your workspace settings.

## Notes

Stack names are used as unique identifiers, so when creating multiple stacks on restack_up config file please make sure names are unique. Application name uniqueness is only bound to the scope inside the stack it belongs to. Meaning you can have two apps with same name as long as they are not part of the same stack.

Release files for restack-sdk-cloud 1.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for restack-sdk-cloud 1.0.14
File Interpreter ABI Platform
restack_sdk_cloud-1.0.14-py3-none-any.whl Python 3 none any Details

Release files / restack_sdk_cloud-1.0.14-py3-none-any.whl

Download URL restack_sdk_cloud-1.0.14-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f627cdec352885f9766cf9e0ec33dfa8723a144bef5b524d3e5d7f111345910d
BLAKE2b-256 checksum
How to use checksums
a37aacf6ce7e425e8af227f40d4cff16904e2f1564fc677573e4e70e2374d6dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

1.0.14 This release

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page