Dev/staging/prod promotion

Hi.

Is there a way to develop locally with a dev uplink key, then take the same app and push it to a staging url, then test it, then if it’s good promote the same packaged code to production?

I don’t love having the prod key lying around on my local box, and need to test the app before putting it in front of users.

Thanks!

Just saw this. It’s somewhat related, but pushing copies of the app, not actually promoting the same app.

I don’t believe this is possible David.

Alongside no access to global variables and all server modules having to be loaded on every request, this is a significant disadvantage of Anvil.

Indeed, it was these three factors which had us choose Heroku over Anvil for our web API.

I suppose if you had dns that was lightning fast like cloudflare it could work if you changed the cname for staging to each new “preview” app if they have unique hostmames ( I think they do ), then test it, then swap the prod cname to the preview app cname.

This raises an interesting question - are the preview environments as scalable as the designated prod environments?

I still don’t get warm fuzzies moving this task to dns but it may be good enough.

Seems reasonable to set a low ttl for this. Some pros and cons https://serverfault.com/questions/225999/any-disadvantage-to-short-dns-ttl

But if you’re using fly.io for prerendering some urls, you’d have to change all those too. Pretty open invitation for human mistakes there. Could fix that by automating it with cloudflare and fly APIs I suppose.

If ( when ) a user has a dns cache disrespect the ttl, the userbase would be using different endpoints.

It raises another interesting question - are schemes and data transferred on preview environment creation and as such immutable, or shared and mutable. If shared and mutable, this approach would be a data consistency disaster.

I guess you could invent your own connection draining “maintenance mode”, but you’d never really be sure when it’s be safe to re enable traffic.

Looking into it a bit more, this makes it sound like dns ttl’s don’t matter with cloudflare. One of their customers proposes the “promote test domain to production” pattern.