1. 8
  1.  

  2. 6

    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.

    1. 1

      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?

      1. 2

        I never used Rust beyond the “getting started” tutorials, but the article mentions this: https://github.com/emk/rust-musl-builder

        1. 1

          Thank you, but I’m afraid I’m not using musl: I’m on OpenBSD.

          1. 2

            I would expect that the same technique would work on any platform? It looks like it works by setting some env vars

            1. 1

              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-runtimes

              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.

              RUSTFLAGS='-C target-feature=+crt-static' cargo build
              

              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:

              crt_static_respected = true;
              

              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?

    2. 3

      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)

      1. 2

        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.

        1. 8

          Maybe https://write.as/ or https://dev.to could work. As a reader, I certainly prefer both over Medium.

        2. 2

          Does anyone have uBlock Origin filters or UserStyle to decrapify Medium?

          If not I will make one.

          1. 4

            as much as I hate the name, https://makemediumreadable.com/ really helps with this

              1. 1

                I use Stylus to apply custom CSS.

                .js-stickyFooter,
                .overlay,
                .js-metabar,
                .js-metabarSpacer,
                .js-postShareWidget,
                .collectionHeader,
                .progressiveMedia-image,
                .progressiveMedia-canvas,
                .progressiveMedia,
                .aspectRatioPlaceholder,
                .butterBar.
                .postMeterBar {
                    display: none;
                }
                .avatar-image {
                    border-radius: 4px !important;
                }
                
                    1. 1

                      needs to cover the fullscreen popup as well

                  1. 1

                    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