Skip to content
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

Merged
merged 22 commits into from
Dec 10, 2024
Merged

Conversation

balegas
Copy link
Contributor

@balegas balegas commented Dec 9, 2024

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.

@balegas
Copy link
Contributor Author

balegas commented Dec 9, 2024

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(
Copy link
Contributor

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

Copy link
Contributor Author

@balegas balegas Dec 9, 2024

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

Copy link
Contributor

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,
Copy link
Contributor

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 toELECTRIC_URL` above and providing a default value there. It keeps the actual shape definition cleaner.

Copy link
Contributor Author

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 =
Copy link
Contributor

@thruflo thruflo Dec 10, 2024

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'

Copy link
Contributor

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.

Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit 99ba1e6
🔍 Latest deploy log https://app.netlify.com/sites/electric-next/deploys/675899a79e44ed0008e83e24
😎 Deploy Preview https://deploy-preview-2129--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@KyleAMathews KyleAMathews merged commit e267c28 into main Dec 10, 2024
32 of 33 checks passed
@KyleAMathews KyleAMathews deleted the balegas/write-patterns-deployment branch December 10, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants