greeny / SatisfactoryTools

Satisfactory Tools for planning and building the perfect base.
https://www.satisfactorytools.com/
MIT License
268 stars 57 forks source link

Hosting can be cheaper with changes to SPA build and hosting #83

Closed prosser closed 1 year ago

prosser commented 2 years ago

I don't know what you're paying for hosting, but you could potentially use cheaper AWS Lambda + AWS EV2 or Azure Function + Azure Blob Storage hosting by changing a small bit about how you're bootstrapping the app. If you're interested, I've done this sort of thing before, and the hosting costs are generally about 1/10 of paying for compute time.

Basically, instead of running a PHP frontend and proxying all calls through an always-on compute resource, you instead use serverless hosting to bootstrap the JS download from a blob storage account. You pay for the resources used, instead of paying for an almost-idle web server. In addition to being cheaper, you get better availability, as you can scale out geographically with minimal cost.

Let me know if you want help, or you'd rather I keep my nose out of it.

greeny commented 2 years ago

Hi, I'm renting a whole dedicated server, it runs way more things than just SFTools, there's like 10 other websites (all PHP based), it also runs Factorio server, Minecraft server and will probably run Satisfactory server as well. There are also some other tools and services there. I could probably pay less if I wanted, but having a server available at hand at any time has proven useful several times.

That's also the reason why I didn't bother with excluding PHP. Also the whole API runs on PHP, so it has to exist there anyway (unless I host API somewhere else, but then again, I already have the server, so why not use it).

prosser commented 2 years ago

Makes sense :) If you have a reason to keep the API private, then keep doing what you're doing! If not, then we could actually inline all the processing directly in the client itself--which gives us a lot of flexibility to do things like intense computations without server impact, local saving of factories, integration with map data... lots of fun coding to be done.

If you want to chat a bit more interactively, I'm on vacation this week, and all of December, so I just might have cycles to help out. I created a Discord at https://discord.gg/KaxSWTnj if you want to chat! Can't promise I'll be omnipresent... ;-)

greeny commented 2 years ago

The reason is mostly low quality code that's being rewritten so I don't really feel like there's need to opensource it (as any contribution would probably get overwritten sooner or later due to me rewriting a lot of code). When v2 version is ready, I'll opensource the API so that I can accept some contributions.

I'd love to chat but honestly I already have tons of servers. Unless there's more people on that server, I'd prefer just talking in DMs, you can add me (greeny#4945).

For computing server-side, it's actually super fast (I'm using lp_solver CLI) and the API is mostly just converting the production request to a format which lp solver understands and then decoding the output. I've tried client-side computations before but no javascript library that I found was able to produce results fast enough and I had to switch to server-side.

greeny commented 1 year ago

Closing as discussion is done