-
Notifications
You must be signed in to change notification settings - Fork 185
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
Postgres winglib does not retain state in simulator after reloading #6284
Comments
I tested this locally - the state is retained as long as We have an issue for removing this feature flag here #6185, so I'll mark this resolved - @staycoolcall911 feel free to reopen if needed |
I expect to have it serialized between wing ribs and not just in
hotreloading
…On Mon, Apr 22, 2024 at 18:54 Chris Rybicki ***@***.***> wrote:
I tested this locally - the state is retained as long as
WING_ENABLE_INPLACE_UPDATES=true is enabled in your shell.
We have an issue for removing this feature flag here #6185
<#6185>, so I'll mark this
resolved - @staycoolcall911 <https://github.com/staycoolcall911> feel
free to reopen if needed
—
Reply to this email directly, view it on GitHub
<#6284 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANFVK26FNLG3HXNLS76DGTY6UXDJAVCNFSM6AAAAABGRNLVTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZHE4TIOJZGA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I mean persistent between two new runs |
You'll notice that I am using this flag in package.json |
Ah, I misunderstood. Thanks @ekeren, makes sense 👍 I'll look into this, it feels like there should be some way to do this with the |
To support retaining the state of `sim.Container` across separate Wing Console sessions, this PR adds the capability to reference the resource's state directory through the `WING_STATE_DIR` environment variable. This will be used by the `postgres` winglib to persist state through a mounted volume: ```js let container = new sim.Container( name: "postgres", image: image, env: { POSTGRES_PASSWORD: "password" }, volumes: ["$WING_STATE_DIR/pgdata:/var/lib/postgresql/data"], containerPort: 5432 ); ``` Related to #6284 ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Another pass at solving #6284 The approach taken in #6295 where we allow users to bind to the state directory is problematic because docker sometimes changes the permissions of directories on the user's file system after mounting them. This was causing `wing test` to fail (fixed in #6320) and `wing pack` to fail as well. This PR reworks the API so that data can be persisted via named volumes. Specifically, an anonymous docker volume can be specified, and Wing will automatically name it and reuse it across Wing Console runs. The change should fix the previous issues since named volumes are managed by docker. The main downside of this approach is that deleting your `target` directory or the state files in `.state/` will not clean everything up all resources/files created by Wing from your machine, as Docker volumes may still exist. Eventually we can provide some facilities for automatically cleaning these, but we're leaving it intentionally out of scope until this general approach has been validated. ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [ ] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Use Case
Postgres db is currently losing its state when the simulator is reloaded.
The use case here is to use postgres populated with some test data and avoiding having to re-populate the data frequently.
Proposed Solution
The Postgres Winglib
sim
implementation should save state to a local dir, similar to what was done forcloud.Bucket
s in #5164Implementation Notes
See #5164 which added this capability to
cloud.Bucket
sComponent
Libraries
Community Notes
The text was updated successfully, but these errors were encountered: