Happy to see this! Was just thinking: rust, static binaries, ... FROM scratch is the way to go!
This should result in a much smaller image, and with fewer moving parts to go wrong. No distro inconsistencies. Just you're rust binary running in docker.
Is it still completely network capable due to docker?
What reasons are there for people to not go this route?
For small projects, there's an alternative in the form of WASM and "edge" computing. Fastly CDN and Cloudflare Workers will run WASM binaries for you, and you can compile Rust to WASM. In such case you run single short-lived Rust functions, more like command-line executables, instead of Actix servers.
For Actix servers a VPS works well. I'm using cargo-deb to package Actix server as a Debian package, and then systemd service config to run it.
Ok so I bought a domain name from namecheap and connected that with my linode vps. Could someone explain to me on how I upload the actix server to linode?
Hmm, I was under the impression with VPS you can support any serverside code. Was I wrong with that assumption? Otherwise, why do rust web frameworks even exist? In any case, I'll take a look at Heroku.
Luckily Rust web frameworks do exist. That means I can put them on my Digital Ocean and other virtual machines in the cloud. That means I don't have to use PHP, Java or such like. That means I can have Rust through and through. From the embedded, remote, sensor nodes to the services in the cloud to the web browser client (Only just started experimenting with that last one). Having only one language to deal with is sweet. Especially when it's one as good as Rust.
Hi petar, I'm kind of concerned with how well Heroku can scale. Compared to VPS plans which show you the ram, cpu, ssd storage, and data transfer limits, Heroku doesn't really show much of that. Although there are semblance measurements of provided ram which is about 10X more expensive than other providers from what I can tell.
Hi cerber,
I'm not really sure what a compiled artifact is. Could you explain in further detail how I can produce one and how I can send it over to Linode?
We are still old school about that. On our server instances we clone the git repository and build the executables there. Only recently started thinking about starting to catching up with the state of the art by using Docker containers.
I don't know anything about Linode. To me it sounds like short for "Linux Node". As such I would at least expect one could do what we currently do on it. Maybe not.
You can do it in multiple ways. But the easiest way is to ssh into the machine, and from there you can download your binary if it's compiled for linux/x86 (x86_64-unknown-linux-gnu). Then just run it with ./myappname
An even easier way, if you have the sourcode on github or similar, is just install rust (using rustup), then pull the source code to the linux server (using git), then cargo build --release.
If you want your app to keep running you would need to install it as a service (depending on the linux distro you selected)
Linode is a VPS service. A VPS gives you access to virtual machines and the operating system running on top. Linode gives you access to multiple Linux flavors, e.g. Ubuntu.
You SSH into the box, and you run your app just like you would on your local machine. You install a database service using e.g. apt. You can install Docker if you prefer that.
A VPS leaves every option open, you can do anything. But a VPS is not a managed app deployment platform so you have to do everything yourself. But that's why it's cheap.
I did explain some things above but I would recommend you to look into the following:
How to use SSH
How to create a private repository on Github (or Gitlab, or Bitbucket, or any other git host)
It's also possible to create a public repo if you want to share your code.
How to upload your code to your repo
How to clone your code from your repo on a Linux machine you have connected to using SSH
How to setup HTTPS using Let's encrypt. You probably need some sort of reverse proxy, maybe nginx
How to configure your app and/or Linux firewall to block access to private ports.
The list goes on. If you have the time and patience, you will learn A LOT. If you don't, then it isn't too late to back off and start using a more managed service.
Well, I'm in it to win it so I might as well get started now. I know how to use ssh to connect to my instance, and also have been using a private repository on Github to store my code. I'll learn how to clone and hopefully knock the rest off the list.
I don't know much about linode. By "not supported" I meant exactly what you explained. If it's cheaper for you to maintain all the infrastructure yourself, fine. However, dev time is expensive and I would rather pay more for an environment that I don't need to worry about and spend my time more productively.
If you have more questions I can probably point you in the right direction. Just make sure to click on the "reply to message" button on one of my messages so that I am notified when you ask something.