Comment on page

Draft environment

Develop with confidence with your changes isolated from production
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
  • Python packages (requirements.txt)
  • System packages (system-packages.txt)
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
Again, changes to global resources will be applied immediately to all applications in your account, regardless of draft or production environment.

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 will be marked as Added, Modified, or Deleted.
From the dropdown, you pick whether the major, minor, or patch version of an application is incremented every time the application is published. We recommend following semantic versioning.
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.