> For the complete documentation index, see [llms.txt](https://docs.appfarm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appfarm.io/reference/operations/deploy.md).

# Deploy

Deploy your apps and services to Test, Staging and Production. View the Solution deploy history, and manage Snapshots.

Deploys to the Development environment are instant and the [Appfarm Client](https://docs.appfarm.io/reference/appfarm-client.md) will hot reload by default. You can also revert deployed changes through the use of [Snapshots](#snapshots) and [rollbacks](https://docs.appfarm.io/reference/operations/deploy.md#rollback-a-deploy).

<figure><img src="https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2FhpMafxHvChYapp7dXoFb%2Fimage.png?alt=media&amp;token=396901c7-1ab4-48cd-ba1e-37f939cc558a" alt=""><figcaption><p>The Deploy page in Appfarm Create</p></figcaption></figure>

## Environments

Up to four deployment environments are available. The environments available in your Solution depend on your subscription agreement. To enable, disable and configure an environment, click the **Configure environment** button shown in the image above. Read more about environment configuration [here](https://docs.appfarm.io/reference/configuration/environments.md). The environments are:

<table><thead><tr><th width="155">Environment</th><th>Root URL</th><th>Description</th></tr></thead><tbody><tr><td><strong>Development</strong></td><td><code>https://{SOLUTION_SHORTNAME}-dev.appfarm.app</code></td><td>Instant deploys and with its own database. For Appfarm developers only.</td></tr><tr><td><strong>Test</strong></td><td><code>https://{SOLUTION_SHORTNAME}-test.appfarm.app</code></td><td>A sandbox for non-developers to test in, with its own database.</td></tr><tr><td><strong>Staging</strong></td><td><code>https://{SOLUTION_SHORTNAME}-stage.appfarm.app</code></td><td>A final testing ground before Production.<br><strong>Uses the Production database. Any changes made to data in Staging will be reflected in Production.</strong></td></tr><tr><td><strong>Production</strong></td><td><code>https://{SOLUTION_SHORTNAME}.appfarm.app</code></td><td>The live environment for your end-users.</td></tr></tbody></table>

{% hint style="warning" %}
**Important**

* Users exist across all environments. For example, a user created in Production can be deleted in Test. See [Users](https://docs.appfarm.io/reference/security/users.md) for more details.
  {% endhint %}

## Deploy dialog

The big blue deploy button will be active if there are changes to be deployed from one environment to the next. Click this button to open the Deploy dialog. If the deploy button is disabled, there are no changes to deploy.

<figure><img src="https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2FDmQOYtTsLpoAYZ0KF1kH%2Fimage.png?alt=media&amp;token=59dc6e5c-55ad-4aff-89d3-71c01cb46927" alt=""><figcaption><p>The blue button is active when there are changes to be deployed</p></figcaption></figure>

Appfarm supports two type of deploys, [Solution deploy](#solution-deploy) and [Targeted deploy](#targeted-deploy).

{% hint style="info" %}
If you cannot see the Deploy button, there may be two reasons.\
1\) You have no undeployed changes, or\
2\) Only the Development environment has been enabled. For Free Tiers, the Production environment must be enabled by clicking **Configure environment** for the Production environment. The deploy button then stays on the card, disabled, and its tooltip names the environment to enable, for example `Enable Production to deploy from Test`, with a link to its settings.

An environment you have just enabled shows as starting while it boots.
{% endhint %}

#### Solution deploy

Solution deploys are sequential across environments, so you must first deploy to Test and Staging (if they are active in your solution) before deploying to Production. All changes in a given environment are deployed to the next.

<figure><img src="https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2F1GfxILuVjFj1SC68sypU%2Fsolution%20deploy.png?alt=media&amp;token=e51bfbd9-a06b-4403-9689-0ad9e1d0d5b5" alt="" width="367"><figcaption><p>The solution deploy dialog</p></figcaption></figure>

1. This alert will appear if the deploy will result in an upgrade of the [Appfarm Client](https://docs.appfarm.io/reference/appfarm-client.md). This takes a few minutes.
2. Select when to deploy: **Now**, **In 15 minutes**, **Around midnight (±15 mins CET)**, or **Other** to pick a **Deploy time (CET)**, which must be in the future. Scheduling a deploy is available on Essential, Professional and Dedicated.
3. Optionally provide a custom deploy message to show users alongside the default deploy message. The default deploy message is:\
   "**New version available**\
   A new version of {APP NAME} is ready. Please press reload to get the new version."
4. Optionally include your avatar and name with the deploy message.
5. Optionally, you can provide an internal note to display in Appfarm Create's deploy history.
6. Click to open the [deploy changelog](https://docs.appfarm.io/reference/operations/deploy.md#deploy-changelog).
7. Click to deploy changes and platform upgrades to the next environment.

#### Targeted deploy

{% hint style="info" %}
**Tier-based access**

Available on Essential, Professional and Dedicated. See [Subscription and billing](https://docs.appfarm.io/solution-administration/subscription-and-billing.md#features-by-tier).
{% endhint %}

Targeted deploy allows developers to deploy selected changes directly to selected environments. For instance, a change can be deployed directly to Production without interrupting ongoing testing in the Test environment. These units can be deployed independently of other changes in the environment:

* Apps
* Flows
* Services
* Schedules
* Object classes
* Enumerated types
* Themes
* Languages
* Components

Appfarm Create automatically calculates dependencies when deploying selected changes. For example, if changes to an app are deployed and this app uses a new object class, the new object class will also be deployed.

<figure><img src="https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2FnGY5Fe25L8bPVHrhdxU4%2Ftargeted%20deploy.png?alt=media&amp;token=5cbe2443-1896-40d5-be2e-2811cb9f0e8c" alt=""><figcaption><p>The targeted deploy dialog</p></figcaption></figure>

1. Select which environment to deploy changes to.
2. Choose whether to deploy all or selected changes from the current environment.
3. Select which deployable units to deploy. Only units with deployable changes will be listed in this section. This list is only visible if **Selected changes from Development** is selected.
4. Information about additional dependencies that will be deployed based on the selected changes.
5. Click to show a detailed changelog of the selected changes.

Only entities affected by the deploy will hot reload when deploying selected changes. For example, if there are two apps in the solution and changes are only deployed to one, users of the other app will not be affected.

**Note:** If the deploy includes an [Appfarm Upgrade](https://docs.appfarm.io/reference/operations/deploy.md#appfarm-upgrade), all apps in the Solution will be affected by the upgrade, even if the deploy is targeted.

## Deploy changelog

If you have undeployed changes in an environment you can view a list of what has changed. Click **Change Details** to see an overview of:

* New apps and services
* New and changed actions, data sources and views by app/service
* New and changed themes and schedules
* New and changed enums and object classes
* Number of deleted apps and services
* Number of deleted actions, data sources, and views
* Number of deleted themes and schedules
* Number of deleted enums and object classes

## Appfarm Upgrade

Appfarm Create is updated with new releases. You can read more about Appfarm releases [here](https://docs.appfarm.io/solution-administration/release-channels.md).

When Appfarm Create is upgraded, the next deployment for all Solutions will be affected.

![](https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2F5kXRrCmInQmWSTMnPZ8n%2Fimage.png?alt=media\&token=bb8bce83-72a8-424d-a06a-d0cd80a2cbee)

When Appfarm Create has been upgraded, so has your Development environment (the client). Other environments are upgraded on the next deploy to them, as in the example above.

Appfarm Upgrades are mandatory and cannot be removed from the Deploy.

Note that such upgrades of the Test or Production environment are only experienced as an information dialog followed by a refresh for the end user. *But we recommend to schedule such deploys to midnight.*

To see which Appfarm version an environment runs, hover the environment name on the Deploy page. When a newer version is available for the next environment, the environment card shows **Upgrade to** with the version number.

{% hint style="success" %}
**Best practice**

New Appfarm versions, including bug fixes and security fixes, reach Test, Staging and Production only when you deploy to them. Deploy to all your environments regularly, at least once a month, even when you have no other changes.
{% endhint %}

## Snapshots

A snapshot is a copy of your solution model at a point in time. Your solution model contains the definition of your global data model, apps, services, and other solution-specific metadata generated from Appfarm Create.

{% hint style="warning" %}
**Important**

A snapshot does *not* contain any data from the database, such as objects you create and persist via data sources. It contains only the definition of your solution in Appfarm Create.
{% endhint %}

You can take a snapshot of model currently in Development at any time by clicking **+** next to **Snapshots**. Snapshots should be used as a regular part of your development process to protect against unintended changes and avoid data loss. It is often a good idea to take a snapshot before beginning on large scale or destructive changes.

The number of manual snapshots is limited by your plan. The counter under **Snapshots** shows how many you have, for example **3/5 snapshots used**. At the limit, delete a snapshot before you take a new one.

**Automatic snapshots** are available on Essential, Professional and Dedicated. These will be taken roughly every 5-20 minutes when there is activity and changes made in the solution. A systematic clean-up is performed in order to spread out the snapshots so that there is more time between the stored snapshots the further back in time you go. If you do not have Automatic snapshots enabled, please contact <support@appfarm.io>.

## Rollback to a snapshot

Rollback to a snapshot means to restore the solution (apps, Flows, services, and the data model) in Development back to a previous state. This may be used for disaster recovery if you delete or break a part of your application, or to perform a controlled rollback if you have been experimenting with a feature and would like to roll everything back. Note that only the solution (everything created in Appfarm Create) will be rolled back - not the application *data.*

You may rollback to both manual and automatic snapshots.

Rollback to a manual snapshot: open the three-dot menu for the snapshot you wish to use and select **Apply snapshot to Development**.

![](https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2FNNm3riF0VIzEMUljznlf%2Fimage.png?alt=media\&token=8313818c-1f1b-4d3e-847c-2d8410b4fae3)

Rollback to an automatic snapshot: click the restore icon on the snapshot row (**Apply snapshot to Development**).

![](https://29237295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiLU-xcHu0eLZiTxcmZ%2Fuploads%2FIwNYiSgwslrzBQLdTpy2%2Fimage.png?alt=media\&token=ea1987c3-e7c8-4f61-85b3-6c9d5893a912)

Combining rollback to snapshot with the Copy to clipboard feature will also allow you to rollback a view etc. to a previous state:

1. Take a new manual snapshot (give it a proper name)
2. Rollback to a previous snapshot. Refresh Appfarm Create.
3. Locate the View, right-click and **Copy to clipboard**
4. Rollback to the manual snapshot created in 1). Refresh Appfarm Create.
5. Paste the View into your App.

## Rollback a deploy

As you deploy across environments, a deploy history is generated. This provides a record of who made the deploy, the solution model version deployed, and when the deploy occurred. If you run into issues on a new deploy, you can rollback to a previous deploy listed in the history. To do so, open the three-dot menu for the deploy you wish to rollback to and select **Rollback to this version**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appfarm.io/reference/operations/deploy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
