Draft environment
Develop with confidence with your changes isolated from production
The draft environment is a paid feature that is not enabled by default. Please reach out to [email protected] to enable this feature in your Baseten organization.
By default, changes made to an application on Baseten are immediately live in production. The draft environment feature changes this by giving you access to two environments:
  • Draft: an environment to experiment and test your changes
  • Production: a polished environment ready for critical workflows
The draft environment lets you develop your application with confidence as changes are isolated from production until you are ready to publish a new version of your application.

What is isolated in the draft environment?

When working in a draft environment, changes to application-specific resources do not go live until sent to production in a versioned publication of the application. However, changes to global resources will immediately be applied to both draft and production environments. These resources are listed below.
Application-specific resources that differ by environment:
  • Views
  • Worklets
  • Code files
In addition, Baseten Postgres table data is isolated within each environment. See accessing production data for more details.
Global resources that are equivalent between environments (and applications across the entire Baseten account):
  • Models
  • Baseten Postgres table schema
  • External data connections
  • Queries
  • Secrets
  • Python packages (requirements.txt)
  • System packages
Again, changes to global resources will be applied immediately to all applications in your account, regardless of draft or production environment.

Migrating to a draft environment

When you contact us to enable the draft environment feature, there are a couple of decisions to make together as we migrate your account to this feature:

Baseten Postgres table data

While table schemas are a global resource, the data in your Baseten Postgres tables differs between draft and production. When a draft environment is created, it is filled with a copy of any existing data. Let us know whether you want your production environment data to be reset with empty data tables or retain the existing data.

Publishing current applications

Let us know whether you want your existing applications to start published or unpublished. If existing applications start unpublished, they will not be accessible to any operators or public users, even at existing shared links, until a version is published. So if your existing applications have active operators or public usage, choose to have your existing applications start published or said users will lose access to the application.

Switching environments

Users that have the Owner, Admin, or Creator roles can toggle between draft and production environments for any published application.
Switching environments with the toggle

Publishing to production

When publishing an application, you will see a list of all changes that have been made to the application’s views, worklets, and code files. These resources can be marked as Added, Modified, or Deleted. The major (X.0.0) version of an application is incremented every time the application is published, starting from 1.0.0.
Publishing changes to the production environment
On the applications page, you can check application statuses:
  • Draft: the application hasn't been published.
  • Unpublished changes: the application has been changed in the draft environment since the last time it was published.
  • Published: the application is published and has not been changed since the last time it was published.
Application statuses on applications page

Using the Production environment

Production is the only environment that operators and the public have access to. When a draft environment is enabled, operators will only be able to operate views that have been published. If there are no published applications with views, then users with these roles will not be shown any views to operate. If you share an application, only the published version is available to users with the shared link.

Accessing production data

The production and draft environments have separate Baseten Postgres databases. Applications running in the production environment only have access to the production database, and applications running in the draft environment only have access to the draft database. Any data created or modified in production remains in the production database and does not affect the draft database.
The query editor allows you to choose which environment's database to run any given query against. Use the environment dropdown in the query editor to select which environment's data to access with the query.

Testing in production environments

You have access to the Data and Logs tabs in an application in the production environment. You are able to access and query your production Baseten Postgres tables and inspect logs for events that happen in production.

Making changes while in the production environment

As defined above, data can be created, modified, and queried in production. Everything else in the production version of an application is read-only. Any user with any role can interact with views, but no modifications can be made to them.