Running Rust on Sandstorm?

43 views
Skip to first unread message

Kevin Reid

unread,
Sep 25, 2020, 12:10:43 AM9/25/20
to Sandstorm Development
Has anyone packaged an app written in Rust for Sandstorm?

When I tried a bit with vagrant-spk, I ran into trouble with the version of Rust available in the Debian image being very old, and Rust's recommended independent installation tool (`rustup`) uses the approach of installing everything under ~/, which doesn't work so well when the package installation step is run as root and the app build isn't. Perhaps there's configuration options but I didn't get to looking harder yet.

An alternative would be to do a pure cross-compile rather than installing a toolchain in a VM (the app I'm thinking about is my own work and I've designed it to be exactly one binary, so it seems like this should be straightforward, but I might be missing something since I haven't tried it).

Does anyone have experience with either of these options or another recommendation?

Jacob Weisz

unread,
Sep 25, 2020, 12:40:42 AM9/25/20
to sandst...@googlegroups.com
We definitely have an app built in Rust: Collections! But it isn't built with vagrant-spk, or even the sandstorm-http-bridge, so it's not exactly a good example of what you are likely experiencing.

It may be good to build a Rust stack for vagrant-spk... Note that if Debian Buster has a new enough version of Rust, vagrant-spk works fine with Buster... we just haven't updated all of the stacks to work with it yet. You'd use a diy stack to get started, of course, and then replace contrib-stretch64 with contrib-buster64 in the Vagrantfile before you use "vm up".

--
  Jacob Weisz

--
You received this message because you are subscribed to the Google Groups "Sandstorm Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-de...@googlegroups.com.

Ian Denhardt

unread,
Sep 25, 2020, 12:53:10 AM9/25/20
to Jacob Weisz, sandst...@googlegroups.com
There's also this repo, in which I experimented with some ideas which
I've put on hold for now:

https://github.com/zenhack/sandstorm-webpub-sysgrain

...but it builds a one-executable Rust package using raw spk, so
probably a good reference for your purposes.

Note that both of these apps incidentally also don't use
sandstorm-http-bridge, instead using the capnproto APIs directly.

-Ian

Quoting Jacob Weisz (2020-09-25 00:40:38)
> an email to [1]sandstorm-de...@googlegroups.com.
>
> To view this discussion on the web visit
> [2]https://groups.google.com/d/msgid/sandstorm-dev/CANkSj9WUa%3DW8g7Z%3
> Dozem8SopeV-Awe49Y5EF4-CHtDeEGrVCsQ%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Sandstorm Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [3]sandstorm-de...@googlegroups.com.
> To view this discussion on the web visit
> [4]https://groups.google.com/d/msgid/sandstorm-dev/cd04aa2a-b2b3-42dc-a
> 23a-9f49fc2870b6%40www.fastmail.com.
>
> Verweise
>
> 1. mailto:sandstorm-de...@googlegroups.com
> 2. https://groups.google.com/d/msgid/sandstorm-dev/CANkSj9WUa%3DW8g7Z%3Dozem8SopeV-Awe49Y5EF4-CHtDeEGrVCsQ%40mail.gmail.com?utm_medium=email&utm_source=footer
> 3. mailto:sandstorm-de...@googlegroups.com
> 4. https://groups.google.com/d/msgid/sandstorm-dev/cd04aa2a-b2b3-42dc-a23a-9f49fc2870b6%40www.fastmail.com?utm_medium=email&utm_source=footer

Kevin Reid

unread,
Sep 25, 2020, 12:03:38 PM9/25/20
to sandst...@googlegroups.com
On Thu, Sep 24, 2020 at 9:40 PM Jacob Weisz <goo...@jacobweisz.com> wrote:
We definitely have an app built in Rust: Collections! But it isn't built with vagrant-spk, or even the sandstorm-http-bridge, so it's not exactly a good example of what you are likely experiencing.

I'm planning to target Sandstorm only (well, possibly also static file hosting) so that should be feasible.

Possible problem: If I'm not using vagrant-spk and not developing on Linux, is there a good replacement for vagrant-spk's setup of a local Sandstorm server when using raw spk? I accidentally emailed Jacob only first, and he suggested using vagrant-spk's VM but running spk commands inside it.

I'm also wondering if there's a way to use my Sandstorm server that lives on a different machine instead of a local one — probably not, because IIRC the dev mode uses a local unpacked directory directly as the app files the server uses?

Ian Denhardt

unread,
Sep 25, 2020, 12:08:08 PM9/25/20
to Kevin Reid, sandst...@googlegroups.com
Quoting Kevin Reid (2020-09-25 12:03:00)

> Possible problem: If I'm not using vagrant-spk and not developing on
> Linux, is there a good replacement for vagrant-spk's setup of a local
> Sandstorm server when using raw spk? I accidentally emailed Jacob only
> first, and he suggested using vagrant-spk's VM but running spk commands
> inside it.

That was my first instinct as well (or more generally, set up sandstorm
in a VM; the usual `curl ... | bash` installer can set up a dev box
pretty easily).


> I'm also wondering if there's a way to use my Sandstorm server that
> lives on a different machine instead of a local one � probably not,
> because IIRC the dev mode uses a local unpacked directory directly as
> the app files the server uses?

Correct, you'll have to somehow get your build onto the Sandstorm box's
filesystem.

-Ian

Jacob Weisz

unread,
Sep 25, 2020, 1:49:24 PM9/25/20
to sandst...@googlegroups.com
Possibly some perks of using vagrant-spk to do this, even if you aren't using a vagrant-spk stack or build process:

- It handles setup of a good dev mode install of Sandstorm and makes it accessible to the host machine by default.
- The ~\.sandstorm directory from the host is shared into the VM, so you could arguably (ab)use that to share files between the two.
- It already blocks client-side loading by default when it sets up Sandstorm, so you'll also be ready to test against the future of Sandstorm's sandboxing strategy.

--
Jacob Weisz
goo...@jacobweisz.com
> --
> You received this message because you are subscribed to the Google
> Groups "Sandstorm Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sandstorm-de...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sandstorm-dev/160105008510.1828.7305682124065699217%40localhost.localdomain.
>
Reply all
Reply to author
Forward
0 new messages