-
Notifications
You must be signed in to change notification settings - Fork 9
Expand docs on self-hosting production setup #98
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e5c4926
Expand docs on self-hosting production setup.
rkistner 1ef02af
Fix links.
rkistner 91399f8
Add docs on migrating between instances.
rkistner 8a52e01
Apply suggestions from code review
rkistner bb9a1eb
Add more clarifications.
rkistner 87b735b
Fix typos.
rkistner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "Migrating between instances" | ||
description: "Migrating users between PowerSync instances" | ||
--- | ||
|
||
## Overview | ||
|
||
In some cases, you may want to migrate users between PowerSync instances. This may be between cloud and self-hosted instances, or even just to change the endpoint. | ||
|
||
If the PowerSync instances use the same source database and have the same basic configuration and sync rules, you can migrate users by just changing the endpoint to the new instance. | ||
|
||
To make this process easier, we recommend using an API to retrieve the PowerSync endpoint, intead of hardcoding the endpoint in the client application. If you're using custom authentication, this can be done in the same API call as getting the authentication token. | ||
|
||
There should be no downtime for users when switching between endpoints. The client will have to re-sync all data, but this will all happen automatically, and the client will atomically switch between the two. The main effect visible to users will be a delay in syncing new data while the client is re-syncing. All data will remain available to read on the client for the entire process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "Multiple PowerSync Instances" | ||
description: "Scaling using multiple instances" | ||
--- | ||
|
||
## Overview | ||
|
||
<Warning> | ||
Multiple instances are not required in most cases. See the [Overview](self-hosting/lifecycle-maintenance) for details on standard horizontal scaling setups. | ||
</Warning> | ||
|
||
When exceeding a couple thousand concurrent connections, the standard PowerSync setup may not scale sufficiently to handle the load. In this case, we recommend you [contact us](/resources/contact-us) to discuss the options. However, we give a basic overview of using multiple PowerSync instances to scale here. | ||
|
||
Each PowerSync "instance" is a single endpoint (URL), that is backend by: | ||
1. One replication container. | ||
2. Multiple API containers, scaling horizontally. | ||
3. One bucket storage database. | ||
|
||
This setup is described in the [Overview](self-hosting/lifecycle-maintenance). | ||
|
||
To scale further, multiple copies of this setup can be run, using the same source database. | ||
|
||
## Mapping user -> PowerSync endpoint | ||
|
||
Since each PowerSync instance maintains its own copy of the bucket data, the exact list of operations and associated checksum will be different between them. This means the same client must connect to the same endpoint every time, otherwise they will have to re-sync all their data every time they switch. Multiple PowerSync instances cannot be load-balanced behind the same subdomain. | ||
|
||
To ensure the same user always connects to the same endpoint, we recommend: | ||
1. Do an API lookup from the client application to get the PowerSync endpoint, don't hardcode it in the application. | ||
2. Either store the endpoint associated with each user, or compute it automatically using a hash function on the user id. | ||
rkistner marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.