-
Notifications
You must be signed in to change notification settings - Fork 174
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
Write patterns deployment #2129
Conversation
This should generally be working, but I wasn't able to test it. Opening PR for visibility and for someone to take over if necessary. |
) | ||
|
||
const vpc = new sst.aws.Vpc(`write-patterns-${$app.stage}-vpc`) | ||
const cluster = new sst.aws.Cluster( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's reuse the our dev cluster from cloud
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. We’ll have to do that though all examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that'd be good — they're slow to setup & fairly expensive
@@ -19,6 +20,8 @@ export default function OnlineWrites() { | |||
url: `${ELECTRIC_URL}/v1/shape`, | |||
params: { | |||
table: 'todos', | |||
database_id: import.meta.env.VITE_ELECTRIC_DATABASE_ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The challenge here is that this complicates the example code just for our deployment purposes.
One request is please can you follow the pattern of declaring a const
DATABASE_URL ...next to
ELECTRIC_URL` above and providing a default value there. It keeps the actual shape definition cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the params to the top but is not great. I suggest you change it to your taste.
In general is a bit of a pain that we need to set Cloud params explicitly. One possible way to hide is to pass Cloud in the base url, but I'm not sure if the code picks it up properly
@@ -3,7 +3,17 @@ import { v4 as uuidv4 } from 'uuid' | |||
import { useShape } from '@electric-sql/react' | |||
import api from '../../shared/app/client' | |||
|
|||
const ELECTRIC_URL = import.meta.env.ELECTRIC_URL || 'http://localhost:3000' | |||
const ELECTRIC_URL = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could wrap this up into:
const { ELECTRIC_URL, envParams } from '../../shared/app/config'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e.: across all the patterns, given that it's a bunch of noise at the top of the code samples that are all displayed on the page in the Writes guide, etc.
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployment and dockers files for hosting Write patterns example.
I did some changes to load env vars and add db ids, etc.
There seems to be some problem with pattern 4, but I'm not sure if is just me.