# Deployments in Cube Cloud

Deployments are top-level entities in Cube Cloud. They include the source
code, configuration, allocated resources, API endpoints and essentially
do all the heavy lifting, running workloads and fulfilling requests.

## List of deployments

Each account in Cube Cloud can have multiple deployments. Once you've
logged in, you can access the list of deployments by clicking on
the&nbsp;<Btn>Cube Cloud</Btn> logo in the top left corner.

<Screenshot src="https://ucarecdn.com/cdd5831a-a8f8-4342-bc3e-25aab2c04a5b/"/>

## Creating a new deployment

Creating a new deployment is an essential prerequisite to running a Cube
project in Cube Cloud.

After you've created your [Cube Cloud account][cube-cloud-signup],
click&nbsp;<Btn>+ Create Deployment</Btn> in the top-right corner of your
list of deployments to jump into the wizard. Watch the following video for
guidance on the rest of the steps:

<YouTubeVideo url="https://www.youtube.com/embed/HVZ4ytDEjqc" />

All deployments within a Cube Cloud account should have uniqie names.

## Demo deployments

After you've created your [Cube Cloud account][cube-cloud-signup] and
proceeded to create a new deployment, you would be prompted to set up a
connection to your [data source][ref-data-source].

If, for any reason, you're not ready or unable to connect your staging or
production data source at the moment, you can click&nbsp;<Btn>Create a demo
deployment</Btn> in the yellow box:

<Screenshot src="https://ucarecdn.com/559aeebe-d20f-4510-a22c-62532b59cbcc/"/>

Shortly, Cube Cloud will create and pre-configure a new deployment in your
account. You will see it as&nbsp;<Btn>Demo deployment</Btn> in the list of
deployments. This new deployment will be:

- Configured to use [DuckDB][ref-duckdb] as the data source.
- Provided with a sample [data model][ref-data-model] backed with CSV files
in a public S3 bucket.
- Provided with an example of [dynamic data modeling][ref-dynamic-data-models]
and programmatic [configuration options][ref-config-options].

Watch the following video to for a step-by-step walkthrough:

<YouTubeVideo
  url="https://www.youtube.com/embed/XeaZPUQRC8M"
  aspectRatio={4/2.78}
/>

Exploring the demo deployment is a great way to understand how Cube works.
Use the [data model editor][ref-data-model] to review the data model and
make sure to run a few queries in [Playground][ref-playground].

## Deployment overview

The&nbsp;<Btn>Overview</Btn> page of each deployment provides a high-level
summary of its components and state:
* API endpoints with URLs and connection instructions.
* Allocated resources in line with the [deployment type][ref-deployment-types].
* Activity log of the most recent events.

<Screenshot src="https://ucarecdn.com/af8129b4-19bb-4dc1-90db-a726da367de8/"/>

Additionally, the bar under the&nbsp;<Btn>Cube Cloud</Btn> logo displays
user-specific state of the deployment:
* Branch selector displays the source code branch that is currently
  selected and being viewed by the user.
* <Btn>Enter Development Mode</Btn> button indicates whether a user has
  entered the [development mode][ref-dev-mode].

## Deployment settings

You can manage various settings of a deployment, such as [environment
variables](#environment-variables), by navigating to the <Btn>Settings</Btn> page of the
deployment.

### Environment variables

You can configure environment variables by navigating to <Btn>Settings → Environment
variables</Btn> where you can add, edit, or remove environment variables for your
deployment.

For convenience, environment variables are split into two lists: ones that relate to
the [data source][ref-data-sources] configuration and all other variables.
Browsing environment variables is reflected in the [Audit Log][ref-audit-log].

<Screenshot src="https://ucarecdn.com/e7d6cbc3-ed83-492c-9376-dee501ae747a/" />

## Cube version

Each [environment][ref-environments] within a Cube Cloud deployment runs a specific
version of Cube that depends on the environment type and the selected [update
channel](#update-channels).

### Current version

You can check the current version of Cube that your deployment (environment) runs by
navigating to <Btn>Overview → Resources & Logs → Cube API</Btn>:

<Screenshot
  src="https://ucarecdn.com/83a5010a-3c02-4ce1-8e4f-fdbb2efc6a90/"
  highlight="inset(42.5% 42.5% 32.5% 4% round 10px)"
/>

### Update channels

Cube Cloud provides two update channels:

* <Btn>LTS channel</Btn> for infrequent [long-term support][ref-lts] releases with
critical fixes.
* <Btn>Regular channel</Btn> for regular releases, which occur more frequently and
contain both fixes and new features.

You can view or change the update channel by navigating to <Btn>Settings →
General → Cube version</Btn>:

<Screenshot
  src="https://ucarecdn.com/3ef5fa36-4b27-437c-aa70-dbc0aa01255d/-/format/auto/"
  highlight="inset(36% 41% 34% 21% round 10px)"
/>

You can select a specific version in the drop-down. Only versions that have been used by
a deployment during the last 6 months are available in the list.

There's an option to <Btn>Upgrade automatically to new patch versions</Btn>, which is
available for both update channels. When it's turned on, an upgrade will occur if a new
[patch version][link-semver] is available in the selected channel. To trigger an upgrade,
deploy a new build to the [production environment][ref-environments-prod] or change its
settings, e.g., by updating environment variables of the Cube Cloud deployment.

Generally, it's recommended to use the _regular channel_ to get the latest updates.
You can _pin the version_ to a specific one by turning the <Btn>Upgrade automatically...</Btn>
toggle off.

If you choose to pin the version, make sure to upgrade periodically, especially when the
next [minor version][ref-distribution-versions] is released. If you use the _LTS channel_,
make sure to upgrade to the latest [LTS version][ref-lts] every few months.

## Resource consumption

Cube Cloud deployments only consume resources when they are needed to run workloads:

* For the [production environment][ref-environments-prod], resources are always consumed
unless a deployment is [suspended][ref-auto-sus].
* For any other [environment][ref-environments], a development instance is allocated
while it's active. After a period of inactivity, the development instance is deallocated.
* For pre-aggregations, Cube Store workers are allocated while there's some
  activity related to pre-aggregations, e.g., API endpoints are serving
  requests to pre-aggregations, pre-aggregations are being built, etc.
  After a period of inactivity, Cube Store workers are deallocated.

Please refer to [total cost examples][ref-total-cost] to learn more about
resource consumption in different scenarios.


[cube-cloud-signup]: https://cubecloud.dev/auth/signup
[ref-deployment-types]: /product/deployment/cloud/deployment-types
[ref-dev-mode]: /product/data-modeling/dev-mode
[ref-auto-sus]: /product/deployment/cloud/auto-suspension
[ref-total-cost]: /product/administration/pricing#total-cost-examples
[ref-data-source]: /product/configuration/data-sources
[ref-duckdb]: /product/configuration/data-sources/duckdb
[ref-data-model]: /product/data-modeling/overview
[ref-dynamic-data-models]: /product/data-modeling/dynamic
[ref-config-options]: /product/configuration#configuration-options
[ref-data-model]: /product/data-modeling/data-model-ide
[ref-playground]: /product/workspace/playground
[ref-environments]: /product/administration/deployment/environments
[ref-environments-prod]: /product/administration/deployment/environments#production-environment
[ref-lts]: /product/distribution#long-term-support
[link-semver]: https://semver.org
[ref-data-sources]: /product/configuration/data-sources
[ref-audit-log]: /product/administration/monitoring/audit-log
[ref-distribution-versions]: /product/distribution#versions