-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow emulators to export on exit #2224
Comments
I've requested this indeed! Great that it is actually picked up here :). I could try to make a PR if that is appreciated. Let me know. |
@michi88 if you're interested in sending a PR for this I'd be happy to accept it. But we have to follow a bit of a process:
Sound like something you're up for? I know it sounds slow and bureaucratic but I'll be handling the bad parts mostly. |
Great, I’m up for giving that a try! So let’s settle on the API. What do you think about the My general use case here is with :exec in the ‘default’ What might make sense though is that the Not sure what would be best here. Let me know what you think. |
@michi88 thanks for asking all the right questions. My personal take:
If that sounds good to you I'll propose it to the API people. |
I'm leaning towards that indeed as we have this --import flag already to work with. On the other hand something like a --data-dir would maybe also make sense where we import from and export to. It feels a bit cumbersome that we need to set 2 flags in order to get this behavior (importing and exporting). I'd say the --import flag is super useful for seeding data for tests and the --data-dir is what you want during development. The downside of this is that we're actually not really using it as a persistent data dir but only export on exit (which is not guaranteed to succeed). Unless we can change that and use it like that (in the future) but that is doubtful. I'm ok with --export-on-exit as well though :). |
@michi88 totally makes sense, although right now we do want import and export to feel explicit and separate for the reason you said: they're one-time expensive operations. Something like I'll go ahead and kick this off. |
Alright I sent out the API proposal so we'll see how it goes. For googlers: https://go/firebase-emulators-export-on-exit |
@michi88 thanks for your patience, the API proposal was approved today! I think this is all stated above but here's a succinct version of the proposal you can use for your implementation guide: # VALID: This would export to the same directory as import (./data)
$ firebase emulators:start --import=./data --export-on-exit
# VALID: This would export to a brand new directory
$ firebase emulators:start --import=./data --export-on-exit=./new-data
# VALID: No import is required to export
$ firebase emulators:start --export-on-exit=./new-data
# INVALID: In this case we don't have an --import flag to infer the directory
$ firebase emulators:start --export-on-exit Of course if your circumstances have changed and you no longer want to implement this just let me know and I will happily do the PR myself. |
I’ll have a look right now, keep you posted. |
Waiting with anticipation. I didn't realise that data was not saved automatically after restarting and was wondering what was wrong with my app until I checked the db, I'm glad I'm not crazy. |
So when we want to export the data from the emulator do we just exit (control c on mac) and it will be pulled to the same path we used in $ firebase emulators:start --import=./data --export-on-exit ? |
@salaryazdjerdi yes exactly! |
If I delete all my data in the UI by clicking x on the root node, then restart then I still see the old data using |
@quantuminformation we really appreciate all of your feedback but please don't comment on old closed issues with new bug reports. If you have an issue to report, start a new issue and follow the template (or find an existing open issue that is a duplicate and add a comment) |
Ok, sometimes I am reluctant because I don't want to create a new issue in case it's already a known one or its a feature by design. Will create a new one . new issue https://github.com/firebase/firebase-tools-ui/issues/366 |
Should this export auth accounts as well? |
@steveoh Yes it does by default if the Auth emulator is started. |
What are the exit methods that trigger export? |
Originally requested through FIrebase support, there is some demand for a flag like this:
This would import from a location but save any mutations made on exit.
The text was updated successfully, but these errors were encountered: