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


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


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


2 years ago

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


kobiebotha
HOBBYOP

2 years ago

yeah


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?


2 years ago

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


2 years ago

but try


kobiebotha
HOBBYOP

2 years ago

Yep can confirm


kobiebotha
HOBBYOP

2 years ago

1187424267420311600


2 years ago

welp, fix coming in 2024


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!


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


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 πŸ™‚


2 years ago

no problem, always happy to help when templates are involved


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


2 years ago

I noticed, it looks great!


kobiebotha
HOBBYOP

a year 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

a year ago

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


a year ago

absolutely!


kobiebotha
HOBBYOP

a year ago

are mongodb replicasets supported using the stock mongodb?


a year 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

a year 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

a year ago

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


a year ago

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


kobiebotha
HOBBYOP

a year ago

yup!


a year ago

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


kobiebotha
HOBBYOP

a month 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 πŸ™‚


a month ago

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


a month ago

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


a month ago

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


kobiebotha
HOBBYOP

a month ago

Thx!


a month 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

a month 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.


a month 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

a month 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

a month ago

also briefly checked out volumes but no luck alas


kobiebotha
HOBBYOP

a month ago

I'm a sucker for automation


a month ago

No luck with volumes? anything I could help with?


kobiebotha
HOBBYOP

a month 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)


a month ago

Ah, yeah, not something we support, unfortunately.


kobiebotha
HOBBYOP

a month ago

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


kobiebotha
HOBBYOP

a month ago

The service boots and our healthcheck endpoint returns 200

1423035169295565000


kobiebotha
HOBBYOP

a month ago

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

1423035288845947000


kobiebotha
HOBBYOP

a month ago

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

1423035460246049000


kobiebotha
HOBBYOP

a month ago

but that just fails to succeed

1423035993384161300


kobiebotha
HOBBYOP

a month ago

1423036042197340200


kobiebotha
HOBBYOP

a month ago

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


a month ago

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


kobiebotha
HOBBYOP

a month ago

ah yeah was missing a PORT, solved - thanks


a month ago

No problem!


dean-journeyapps
PRO

a month 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?


a month 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

a month 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.


a month ago

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


a month ago

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


dean-journeyapps
PRO

12 days 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


11 days ago

Yes, it is based on reference variables.


PowerSync Template Review - Railway Help Station