Back

Appwrite Environments (Development, Staging, Production)

  • 3
  • Self Hosted
  • Tools
  • Web
  • Databases
skavank
19 Jul, 2023, 19:19

I've seen some posts about this already but I'm not satisfied with the answers as they basically say "not possible".

It's absolutely crucial to be able to manage your database structures without losing data. This should preferably be done without user involvement, during a CI operation.

This is the flow I would expect to be able to run:

  • Update my Staging server's buckets, teams, collections
  • Develop my features locally, using the Staging server for development data
  • Push my feature in a Pull Request, test it in a staging production environment, run e2e tests, etc
  • Merge my changes to main, CI runs, updates the production Appwrite databases, buckets, etc, using the appwrite.json
  • Frontend is deployed to production, everything works in harmony 🌟

From what I can tell, the documentation says that this should work https://appwrite.io/docs/command-line-deployment#deployCollections, however official word from people here is that this command is not usable on production, as it wipes all data?

Do we need to write custom migration scripts using the API's whenever our Appwrite structure changes?

TL;DR
User wants to be able to manage database structures without losing data in Appwrite. They are looking for a flow that allows updating staging server, developing features locally, testing in a staging production environment, and deploying to production. User mentions a command that wipes all data and asks if custom migration scripts are required. Solution: Use custom migration scripts or a migration system to handle database structure changes.
IsItBathTime
19 Jul, 2023, 19:20

I know your pain bruh πŸ˜…

Drake
19 Jul, 2023, 19:24

if you need to make changes over time, I suggest creating custom migration scripts or a whole migration system.

skavank
19 Jul, 2023, 19:29

To be fair, there's no good way of doing this with Firebase either... at least that's a collection storage, so migrations might not even be relevant, fields and sub-documents can be added or deprecated on the fly.

Since Appwrite is using a "fake" document storage, but still uses a column-like document structure, attribute syncing without data loss is crucial.

skavank
19 Jul, 2023, 19:30

Would this be mitigated by the upcoming mongodb database? Or will it still require strict attributes?

skavank
19 Jul, 2023, 19:32

I really want to love Appwrite, but I keep running into walls wherever I turn!

skavank
19 Jul, 2023, 19:35

So many great features, self-hosted and for free, it's incredible. I really can't complain. Just gotta find workarounds for some of the basics.

Drake
19 Jul, 2023, 19:35

updating schemas is a pretty complex/complicated topic (especially when trying to do it at scale in production).

skavank
19 Jul, 2023, 19:36

Yeah you're right of course, not calling the operation basic. Just that it's one of the things that every serious project will need.

skavank
19 Jul, 2023, 19:37

And having to make proprietary scripts with proprietary API's can be a bottleneck.

IsItBathTime
19 Jul, 2023, 19:41

Am afraid to go live with my website as once the database is gets filled in making changes to the database structure would be slow and difficult

IsItBathTime
19 Jul, 2023, 19:41

So planning ahead for what I'm doing and for what I'm planning in the future πŸ˜…

skavank
19 Jul, 2023, 19:53

I've worked with CMSaaS, like Storyblok where it's not really a thing to use multiple environments for the data structure. When working with that, we made backwards compatible changes directly on the production structure in their dashboard. Works fine for content, but I don't think it's suitable for app-data.

Drake
19 Jul, 2023, 19:57

we made backwards compatible changes I think this should definitely be the approach for an app in production, especially for mobile apps where people can be on different versiosn

skavank
19 Jul, 2023, 19:59

Yeah in that scenario, we simply just had one source of truth which was production. It could be one way of doing it.

D5
19 Jul, 2023, 20:59

True, upgrading mobile apps is a mess πŸ˜…

D5
19 Jul, 2023, 21:00

I even needed adding a message that is shown to make people go and upgrade the app 😬

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more