PowerSync Template Review
kobiebotha
HOBBYOP

2 years ago

I'm still tweaking the branding, the Deploy button etc, but <@539512869780455445> could you eyeball the meat of this and let me know if anything looks off?

0 Replies


brody
EMPLOYEE

2 years ago

currently out Christmas shopping for the day so I'll look at it when I'm back home!


kobiebotha
HOBBYOP

2 years ago

No rush! On my way out too


brody
EMPLOYEE

2 years ago

im seeing
DATABASE_HOST=postgres.railway.internal
and
DATABASE_PORT=5432
on the powersync-nodejs-backend service, instead, on the postgres service set these variables
PGHOST_PRIVATE=${{RAILWAY_PRIVATE_DOMAIN}}
and
PGPORT_PRIVATE=${{RAILWAY_TCP_APPLICATION_PORT}}
and then reference those new variables on the powersync-nodejs-backend service


kobiebotha
HOBBYOP

2 years ago

when I edit the template and make those changes, the button at the bottom says Fork Template, that doesn't seem right

1187423583421616000


brody
EMPLOYEE

2 years ago

uhhh you made this template on your team didn't you


kobiebotha
HOBBYOP

2 years ago

yeah


brody
EMPLOYEE

2 years ago

that's bugged right now 😬


kobiebotha
HOBBYOP

2 years ago

haha I feel you


kobiebotha
HOBBYOP

2 years ago

so fork and delete old one?


brody
EMPLOYEE

2 years ago

you can't delete it either I don't think


brody
EMPLOYEE

2 years ago

but try


kobiebotha
HOBBYOP

2 years ago

Yep can confirm


kobiebotha
HOBBYOP

2 years ago

1187424267420311600


brody
EMPLOYEE

2 years ago

welp, fix coming in 2024


brody
EMPLOYEE

2 years ago

the majority of the team is on vacation


kobiebotha
HOBBYOP

2 years ago

nice time of year to say that


kobiebotha
HOBBYOP

2 years ago

fix could be round the corner!


brody
EMPLOYEE

2 years ago

haha yeah not ideal, but there's not much I can do for bugs that don't affect users workloads


kobiebotha
HOBBYOP

2 years ago

yep same… all good, worst case if a developer uses it, I can help them update these vars in their deployed project


brody
EMPLOYEE

2 years ago

I mean it would still work just fine


kobiebotha
HOBBYOP

2 years ago

yeah


kobiebotha
HOBBYOP

2 years ago

I was able to update the description a bit to include some more info on what the template does, so there's that. Anyway, appreciate all the help thus far and happy holidays 🙂


brody
EMPLOYEE

2 years ago

no problem, always happy to help when templates are involved


brody
EMPLOYEE

2 years ago

and happy holidays to you too


kobiebotha
HOBBYOP

2 years ago

Thanks!
p.s. The Deploy button totally fits into the color scheme of our docs https://docs.powersync.com/integration-guides/railway-+-powersync


brody
EMPLOYEE

2 years ago

I noticed, it looks great!


kobiebotha
HOBBYOP

2 years ago

@Brody We’re gearing up to release our Open Edition by the end of May which will let customers run full-stack Postgres+PowerSync+Backend on Railway and I want to get your input on our updated Template since it seems we've had nonzero downloads of the previous one. Can I still msg you here when it's ready for a review?


kobiebotha
HOBBYOP

2 years ago

(previous Template was Postgres + Backend connected to hosted PowerSync, the update will make it fully self-hosted on Railway with no external deps)


brody
EMPLOYEE

2 years ago

absolutely!


kobiebotha
HOBBYOP

2 years ago

are mongodb replicasets supported using the stock mongodb?


brody
EMPLOYEE

2 years ago

they do not, it's something you'd have to setup yourself, and I've heard mongo does not make it easy


kobiebotha
HOBBYOP

2 years ago

I have a docker-compose config that sets it up, might give it a whirl

    entrypoint:
      - bash
      - -c
      - 'sleep 10 && mongosh --host mongo:27017 --eval ''rs.initiate({_id: "rs0", version: 1, members: [{ _id: 0, host : "mongo:27017" }]})'''

kobiebotha
HOBBYOP

2 years ago

oh, you mean mongo doesn't make it easy on Railway


brody
EMPLOYEE

2 years ago

never hardcode the host and port like you're doing there


kobiebotha
HOBBYOP

2 years ago

yup!


brody
EMPLOYEE

2 years ago

mongo doesn't make it easy even in a docker compose file lol


kobiebotha
HOBBYOP

2 months ago

Hi @Brody , I'm going to create a new Template with all the latest hotness. Busy checking out all the new updates to Templates since we last spoke and had a question:

Is it possible to create a configurable template that, when the user deploys it, will conditionally include either postgres, mongodb or mysql depending on some config the user specifies on the template deploy config page?

I don't think this is possible, so I'll probably create powersync-mysql, powersync-mongodb, powersync-postgres, etc templates. Just checking that I'm on the right track 🙂


noahd
EMPLOYEE

2 months ago

Unfortunately from what i know it isnt possible to optionally change databases.


noahd
EMPLOYEE

2 months ago

This is definitely some tooling for templates though which i’d like to see


brody
EMPLOYEE

2 months ago

What Noah said, you would have to create seprate templates.


kobiebotha
HOBBYOP

2 months ago

Thx!


brody
EMPLOYEE

2 months ago

Hey @k0b13 - We would love for you to become a template partner, you already have the template, and your templates are already published by your own PowerSync workspace.

You can apply here - https://railway.com/partners

And I am also happy to answer any questions you may have!


kobiebotha
HOBBYOP

2 months ago

Awesome, thanks! I'll apply. I got the new stack working yesterday in a new project, it's now just bundling, shipping and some light docs on our end before I can publish the new templates.


brody
EMPLOYEE

2 months ago

Amazing! Please do apply, and we can get your partnership set up and your templates verified!

And please let me know when the templates are ready for review! 🙂


kobiebotha
HOBBYOP

2 months ago

our service accepts env vars as base64 encoded since the config is quite chonky, so encoding a config file into base64 will be one manual step to use the templates, but otherwise it's looking very promising compared to the current template


kobiebotha
HOBBYOP

2 months ago

also briefly checked out volumes but no luck alas


kobiebotha
HOBBYOP

2 months ago

I'm a sucker for automation


brody
EMPLOYEE

2 months ago

No luck with volumes? anything I could help with?


kobiebotha
HOBBYOP

2 months ago

Nope, more just that what I was thinking is something Railway doesn't support (basically creating a volume and then editing a config file on the volume from the Railway dashboard, but I know this is not a supported use case)


brody
EMPLOYEE

2 months ago

Ah, yeah, not something we support, unfortunately.


kobiebotha
HOBBYOP

2 months ago

Last thing I'd like to get going is a healthcheck


kobiebotha
HOBBYOP

2 months ago

The service boots and our healthcheck endpoint returns 200

1423035169295565000


kobiebotha
HOBBYOP

2 months ago

The service boots and our healthcheck on /probes/startup returns 200

1423035288845947000


kobiebotha
HOBBYOP

2 months ago

I then configure it on the service (manual testing for now, will drop it into the template later)

1423035460246049000


kobiebotha
HOBBYOP

2 months ago

but that just fails to succeed

1423035993384161300


kobiebotha
HOBBYOP

2 months ago

1423036042197340200


kobiebotha
HOBBYOP

2 months ago

probably trying to connect on the wrong port or something, digging around in docs…


brody
EMPLOYEE

2 months ago

That red info text may take you to the applicable docs.


kobiebotha
HOBBYOP

2 months ago

ah yeah was missing a PORT, solved - thanks


brody
EMPLOYEE

2 months ago

No problem!


dean-journeyapps
PRO

2 months ago

Hey @Brody 👋

I am part of the PowerSync team and have been building the new template. Everything is working well but there is a bit of manual intervention required and I was wondering if it could be automated.

There are 5 main services:

  • Postgres Data Source - main database

  • Postgres Bucket Storage - storage database

  • Node.js Backend - backend api that is configured with public networking

  • PowerSync Service - configured with public networking

  • Execute Scripts (bun function) - this creates the necessary tables, seeds them and creates the powersync publication in the Postgres Data Source

When deploying the template, the PowerSync Service fails because the user must base64-encode a .yaml template file and set it as the value of the POWERSYNCCONFIGB64 environment variable.

They need insert the following values into the template and base64-encode it:

  • ${{"Postgres Source Data".DATABASE_URL}}

  • ${{"Postgres Bucket Storage".DATABASE_URL}}

  • The Node.js backend public url

  • The PowerSync Service public url

And then set the base-64 encoded string to the {{"PowerSync Service".POWERSYNCCONFIGB64}} environment variable.

My question is, is there a way to automate this? Perhaps by using another function?


brody
EMPLOYEE

2 months ago

We don't have a function to base64 encode something, the best way I can think of would be to move away from base64 encoding and allow for configurations to be done via individual environment variables.


dean-journeyapps
PRO

2 months ago

I think I would be able to do it in a bun function but I'm not sure how to get all of those values I need inside the template string and also I am not sure how I can set the {{"PowerSync Service".POWERSYNCCONFIGB64}} variable from a function or if it is possible.


brody
EMPLOYEE

2 months ago

I would recommend allowing power sync to be configured with environment variables instead of base64 encoded yaml


brody
EMPLOYEE

2 months ago

That's going to be easier for the Railway template, and anyone self hosting powersync outside of Railway as well.


dean-journeyapps
PRO

a month ago

Hey @Brody 👋

Quick question, how exactly are the arrows created? Is it just when a service references another services environment variables?

I can't find anything concrete in the documentation on this. I see at the bottom of this changelog it mentions that it's also when you have Service Groups enabled.

1433372347859206100


brody
EMPLOYEE

a month ago

Yes, it is based on reference variables.


kobiebotha
HOBBYOP

25 days ago

Filled out the form


brody
EMPLOYEE

25 days ago

Awesome, we will take a look at that from our side.


Loading...