I think that especially for an environment which compiles to a static binary – such as Rust – a basic VPS still offers the best bang/buck experience. I am considering doing the startup thing and wrote a prototype with Go. I deployed it to a $5/month Linode to show some people. My deployment tools? scp and tmux. Works well enough, and for the $5 I get the same as a $25 Heroku plan. I can also run my database (currently SQLite), Varnish, and the app itself on that $5 VPS; I don’t think I can do that with Heroku?
The advantages of Docker also don’t strike me as very significant in this scenario.
I do the same with Go: I just compile to a static binary and run it in a chroot. I don’t think Docker would add anything to this except extra complexity.
I can’t do this with Rust because I don’t know how to compile to a static binary. Is there an argument I can pass to cargo to make it produce a static binary?
That said, that page has more information on it than when I last looked. I don’t remember reading about the crt-static feature flag before. Maybe if I specify that on OpenBSD it will just work? I’ll try it out when I get a chance.
Whenever you learn something new, take this mental model: Never do things for their own sake.
Which translate to: Never learn Rust just because you want to learn Rust.
This is great advice to follow! I have a related rule for personal projects: I can either write something I know in a language I don’t know, or I can write something I don’t know in a language I know. Mixing the two means bad news.
(side-note: I just signed up for Rust and Tell Berlin! see you there)
I wish there would be another platform where I could publish articles as easy I can on Medium. I hate their layout for not loggedin users (and a lot more). But it’s easy to see how well an article is doing and to be able to write on the go.
I think that especially for an environment which compiles to a static binary – such as Rust – a basic VPS still offers the best bang/buck experience. I am considering doing the startup thing and wrote a prototype with Go. I deployed it to a $5/month Linode to show some people. My deployment tools? scp and tmux. Works well enough, and for the $5 I get the same as a $25 Heroku plan. I can also run my database (currently SQLite), Varnish, and the app itself on that $5 VPS; I don’t think I can do that with Heroku?
The advantages of Docker also don’t strike me as very significant in this scenario.
I do the same with Go: I just compile to a static binary and run it in a chroot. I don’t think Docker would add anything to this except extra complexity.
I can’t do this with Rust because I don’t know how to compile to a static binary. Is there an argument I can pass to cargo to make it produce a static binary?
I never used Rust beyond the “getting started” tutorials, but the article mentions this: https://github.com/emk/rust-musl-builder
Thank you, but I’m afraid I’m not using musl: I’m on OpenBSD.
I would expect that the same technique would work on any platform? It looks like it works by setting some env vars
It uses the cargo target
x86_64-unknown-linux-musl
. You can specify a different target but I don’t know of any non-musl cargo targets that result in a statically linked binary: https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimesThat said, that page has more information on it than when I last looked. I don’t remember reading about the
crt-static
feature flag before. Maybe if I specify that on OpenBSD it will just work? I’ll try it out when I get a chance.Perhaps?
UPDATE: Nope, didn’t work. I guess the
x86_64-unknown-openbsd
target does not support changing the linkage of the C runtime.UPDATE: It looks like we need, at least, a line like this:
in here: https://github.com/rust-lang/rust/blob/master/src/librustc_target/spec/openbsd_base.rs
I think that’ll get us here: https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/back/link.rs#L1013
Which might be enough?
This is great advice to follow! I have a related rule for personal projects: I can either write something I know in a language I don’t know, or I can write something I don’t know in a language I know. Mixing the two means bad news.
(side-note: I just signed up for Rust and Tell Berlin! see you there)
I wish there would be another platform where I could publish articles as easy I can on Medium. I hate their layout for not loggedin users (and a lot more). But it’s easy to see how well an article is doing and to be able to write on the go.
Maybe https://write.as/ or https://dev.to could work. As a reader, I certainly prefer both over Medium.
Does anyone have uBlock Origin filters or UserStyle to decrapify Medium?
If not I will make one.
as much as I hate the name, https://makemediumreadable.com/ really helps with this
https://github.com/yourduskquibbles/webannoyances
I use Stylus to apply custom CSS.
https://dev.to/gruberb/web-programming-in-rust-02x-deploy-your-first-app-1k05
https://github.com/notriddle/remove-fixed-banners ?
needs to cover the fullscreen popup as well
You can find the article (series) now also on dev.to: https://dev.to/gruberb/web-programming-in-rust-02x-deploy-your-first-app-1k05