Closed gedw99 closed 4 months ago
That's an interesting idea. Can it be provided in a way that doesn't modify the existing code (ie, in a deploy
directory, or something along those lines)? I've never used Fly.io before.
Perhaps also adding an example for GCP Cloud Run, Cloud SQL, and Memorystore would be useful.
Yep deploy folder is perfect .
GitHub actions can use it and deploy.
The other hosting providers can be done too of course. I tend to use fly because it’s anycast. So I standup an instance and via the cli or GitHub actions can scale the instance to any of the 30 data centers and it Al remains in sync.
also postresql works and scales in a master sake pattern . I normally pick Amsterdam as it’s the best for global origin. Than all slaves in the other 29 auto sync .
Clients get automatically send and load balanced to nearest DC and LB in each DC to how many instances you have in that DC.
this is why I guess I don’t use GCP or AWS.
S3 proxying also works and postresql is automatically Snapshot so if you blow away your Origin your can get your postresql data and s3 blobs.
https://github.com/superfly/flyctl For cli.
https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ for git ops.
https://github.com/superfly/flyctl-actions
https://github.com/superfly/fly-pr-review-apps for GitHub or ops
https://github.com/superfly/fly-log-shipper For log shipping. I use nats as they suggest so I can log async which is much faster and takes load off main servers.
For back control plane is also nats but hosted :
it’s identical to nats golang server used for logging but I can control fky, s3, dns, etc etc via ngs Nats. GitHub actions just call a makefile that modifies all the operational things. Ngs is just the command and control system for talking to all this things
Just realised that the docker compose has Redis and postresql.
2 options:
https://github.com/fly-apps/redis/ https://github.com/fly-apps/postgres-ha
Then run pagoda as a dock on fly
So what would be required to add to this repo in order to make deploying via fly easier? Does this app require anything highly specific? I'm curious if including it will actually be of much help to people. As always, my concern with adding things is that it's another thing to maintain and stay on top of, so it has to be worth it. I thought about adding something for cloud run but I'm not really sure how helpful that is. The other problem is that the list of cloud providers is very long.
A fly.toml A dockerfile that runs the golang main.
The fly cli is used to run the deployment The fly GitHub action to auto deploy it.
postresql is supported on fly. You can even scale it out using the fly cli
Redis i think is provided on fly. https://fly.io/docs/reference/redis/ I tend to use NATS Jetstream instead of Redis because you can run NATS embedded in your golang binary .
I'm going to close this. There's an endless amount of places and way to host this and there's really nothing specific about this app that requires anything custom. I'm also considering removing both Postgres and Redis as a default in favor of SQLite and something in-memory to really make this template as rapid/easy/fast as possible. If that is done, then there's really nothing regarding deployment required.
Yeah I changed to SQLite and marmot . It’s been great having clustering and real time updates
The architecture is fast thanks for the smart layering of caches.
I was thinking that deployment examples might be useful for devs .
Fly.io can scale out Postresql and Redis automatically for example. Its requires slight changes to the Docker as fly only allow a Docker and not a Docker compose. This might sound like a problem but it is not and just requires a Dockerfile that can boot Redis and Postresql.
Anyway, there is no Dockerfile in the repo for the main golang code anyway, so we could make one that is designed for fly and scaling out Redis and Postresql if we want.
It can also be used for non fly too btw, but shaping the docker appropriately.
https://fly.io/docs/reference/redis/ for edit but you can also just boot your own.
https://fly.io/docs/postgres/ but you can also boot your own and scale out your own.
Fly makes all databases sync into all regions automatically.
The golang code scales to zero so is server less. So costs you close to nothing if you users hitting your system.
fly cli is golang and is insanely easy.
Fly anycast / bop automatically does nearest server LB, so its seamless scale out at that level too. Its pretty no brainer stuff
Most people use Cloudflare but any DNS works. SSL is done for you.