Metadata-Version: 2.1
Name: restack-sdk-cloud
Version: 1.0.11
Summary: Deploy to Restack with cloud SDK
Home-page: https://github.com/restackio/restack-sdk-cloud-py
Author: Restack
Author-email: 
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: colorama
Requires-Dist: GitPython
Requires-Dist: pydantic
Requires-Dist: requests

# Restack cloud sdk

The Restack SDK allows you to manage and deploy stacks and applications to the Restack platform. This README provides instructions on how to use the SDK.

## Installation

First, install the necessary dependencies:

```node
pip install restack-sdk-cloud
```

## Configuration

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

```env
RESTACK_SDK_TOKEN=your_restack_sdk_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.

```env
RESTACK_CICD=true
```

## Usage

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

### Example

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

```python
import os
from restack_sdk_cloud import RestackCloud

async def main():
    # Initialize the RestackCloud client with the SDK token from environment variables
    restack_cloud_client = RestackCloud(os.getenv('RESTACK_SDK_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

```typescript

- `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.
```


