Getting started with Deployments

Create a Deployment

You can create deployments using the Gradient CLI and linking an API key. You will also need an existing Project to run your deployment.

Web UI

Gradient CLI

1. Create a YAML spec to manage your deployment

1
image: lucone83/streamlit-nginx
2
port: 8080
3
env:
4
- name: ENV
5
value: VAR
6
resources:
7
replicas: 1
8
instanceType: C3
Copied!

2. Start a deployment

1
gradient deployments create --name [deployment-name] --projectId [project-id] --spec deployment.yaml
Copied!

3. View your running deployments and logs

You can view your running deployment in the console UI, which will information on the current spec applied and the current status of your deployment.
You can also see the status of your deployment via the CLI
1
gradient deployments get --id [deployment-id]
2
3
{
4
"id": "6771ef0c-147d-422b-8ff3-fef2809b6b26",
5
"name": "starter-deployment",
6
"deploymentSpecs": [
7
{
8
"id": "02fe5075-ac1e-4d69-b9c9-4fccc2e75776",
9
"data": {
10
"image": "lucone83/streamlit-nginx",
11
"port": 8080,
12
"resources": {
13
"instanceType": "C3",
14
"replicas": 1
15
},
16
"command": null,
17
"env": [
18
{
19
"name": "ENV",
20
"value": "VAR"
21
}
22
],
23
"models": null
24
},
25
"endpointUrl": "d6771ef0c147d422b8ff3fef2809b6b26.clg07azjl.paperspacegradient.com",
26
"actor": {
27
"avatarUrl": "https://s3.amazonaws.com/ps.profile.images/profileImages/production/te7molbs/2020-08-03T15%3A09%3A11.236Z.png",
28
"fullName": null
29
},
30
"cluster": {
31
"id": "clg07azjl"
32
},
33
"deploymentRuns": [
34
{
35
"id": "19f5fec4-142c-4e09-a6ce-9800ffe0d9ca",
36
"availableReplicas": 1,
37
"readyReplicas": 1,
38
"replicas": 1,
39
"deploymentRunInstances": [
40
{
41
"id": "0831f045-a876-4b99-b60c-ce2b653b2825",
42
"phase": "Running",
43
"dtStarted": "2021-09-21T17:47:36.000Z",
44
"dtFinished": null
45
}
46
]
47
}
48
]
49
}
50
]
51
}
Copied!

Scaling your Deployments

You can manage the state of your deployment by updating your spec file and updating the deployment. To stop your deployment from running you can set the replicas to 0, which turns off all workloads. You are able to edit your deployment spec from the Web UI, or using the Gradient CLI

Web UI

You can click the edit button in the Web UI to update your deployment spec to change the number of desired replicas as well as the other parts of the spec.

Gradient CLI

1
gradient deployments update --id [deployment-id] --spec update-deployment.yaml
Copied!

Using Deployments in a Workflow

You can manage deployments in a workflow using the Gradient CLI. Your Paperspace API key and Project ID are available as environment variables
1
jobs:
2
createdDeployment:
4
with:
5
script: |
6
cat > ./deployment.yaml <<EOF
7
image: paperspace/first-order-model:server
8
port: 8000
9
resources:
10
replicas: 1
11
instanceType: P5000
12
EOF
13
gradient deployments create --name my-deployment --projectId ${PROJECT_ID} --spec ./deployment.yaml
14
image: paperspace/gradient-sdk
Copied!
Last modified 17d ago