Environments vs Deployments

The environments docs states that:

We recommend using Deployments in place of Environments.

But it’s unclear to me how deployments replace environments. Is there a way to set a specific deployment for a specific URL? Are there any docs related to how to effectively have different environments using deployments?

The terminology around this all is a little confusing, sorry. Let me see if I can summarise.

Originally, Cloudflare introduced Service Environments. These allowed users to create environments in the dash, and split config between them. This had issues and was “temporarily” disabled. This is what you see in the dash today with the “production” environment dropdowns and things.

All the time during this, Wrangler offered its own version of Environments. These are controlled and managed by Wrangler itself, and will result in multiple workers being created per env, such as your-project-prod, your-project-dev. This works really well, and lets you split absolutely everything per environment, but isn’t the most ergonomic with multiple workers.

And then Deployments was introduced recently. The blog post describes a lot of things that are planned in future for Deployments, but today they’re essentially just a historic report of when/how you deployed your worker.

If you want control over your bindings, vars, etc. per environment then I would recommend using Wrangler environments.

3 Likes

Thanks very much. That kind of clarifies it, although I still don’t understand in what way deployments could possibly replace environments. Deployments are just a record, whereas environments allow to you deploy to a different target. They don’t seem related to me.

1 Like

The long-term goal is for them to allow configuration of everything like Environments can today, as far as I know, so that they can replace Environments at some point.

I completely agree that pointing people to use them instead of Environments today is confusing, and created this issue to track:

Ah gotcha, ok thanks very much - that really helps.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.